Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
136672ff
Commit
136672ff
authored
Oct 31, 2015
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[AbstractExternalSource] Add specs for validating pods
parent
9d6900de
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
abstract_external_source.rb
lib/cocoapods/external_sources/abstract_external_source.rb
+5
-1
abstract_external_source_spec.rb
spec/unit/external_sources/abstract_external_source_spec.rb
+34
-0
No files found.
lib/cocoapods/external_sources/abstract_external_source.rb
View file @
136672ff
...
@@ -154,7 +154,7 @@ module Pod
...
@@ -154,7 +154,7 @@ module Pod
end
end
def
validate_podspec
(
podspec
)
def
validate_podspec
(
podspec
)
validator
=
Validator
.
new
(
podspec
,
[]
)
validator
=
validator_for_podspec
(
podspec
)
validator
.
quick
=
true
validator
.
quick
=
true
validator
.
allow_warnings
=
true
validator
.
allow_warnings
=
true
validator
.
ignore_public_only_results
=
true
validator
.
ignore_public_only_results
=
true
...
@@ -165,6 +165,10 @@ module Pod
...
@@ -165,6 +165,10 @@ module Pod
raise
Informative
,
"The `
#{
name
}
` pod failed to validate due to
#{
validator
.
failure_reason
}
:
\n
#{
validator
.
results_message
}
"
raise
Informative
,
"The `
#{
name
}
` pod failed to validate due to
#{
validator
.
failure_reason
}
:
\n
#{
validator
.
results_message
}
"
end
end
end
end
def
validator_for_podspec
(
podspec
)
Validator
.
new
(
podspec
,
[])
end
end
end
end
end
end
end
spec/unit/external_sources/abstract_external_source_spec.rb
View file @
136672ff
...
@@ -32,6 +32,7 @@ module Pod
...
@@ -32,6 +32,7 @@ module Pod
describe
'Subclasses helpers'
do
describe
'Subclasses helpers'
do
it
'pre-downloads the Pod and stores the relevant information in the sandbox'
do
it
'pre-downloads the Pod and stores the relevant information in the sandbox'
do
@subject
.
expects
(
:validate_podspec
).
with
{
|
spec
|
spec
.
name
.
should
==
'Reachability'
}
@subject
.
send
(
:pre_download
,
config
.
sandbox
)
@subject
.
send
(
:pre_download
,
config
.
sandbox
)
path
=
config
.
sandbox
.
specifications_root
+
'Reachability.podspec.json'
path
=
config
.
sandbox
.
specifications_root
+
'Reachability.podspec.json'
path
.
should
.
exist?
path
.
should
.
exist?
...
@@ -43,6 +44,39 @@ module Pod
...
@@ -43,6 +44,39 @@ module Pod
},
},
}
}
end
end
describe
'podspec validation'
do
before
do
@podspec
=
Pod
::
Specification
.
from_file
(
fixture
(
'spec-repos'
)
+
'master/Specs/JSONKit/1.4/JSONKit.podspec.json'
)
end
it
'returns a validator for the given podspec'
do
validator
=
@subject
.
send
(
:validator_for_podspec
,
@podspec
)
validator
.
spec
.
should
==
@podspec
end
before
do
@validator
=
mock
(
'Validator'
)
@validator
.
expects
(
:quick
=
).
with
(
true
)
@validator
.
expects
(
:allow_warnings
=
).
with
(
true
)
@validator
.
expects
(
:ignore_public_only_results
=
).
with
(
true
)
@validator
.
expects
(
:validate
)
@subject
.
stubs
(
:validator_for_podspec
).
returns
(
@validator
)
end
it
'validates with the correct settings'
do
@validator
.
expects
(
:validated?
).
returns
(
true
)
@subject
.
send
(
:validate_podspec
,
@podspec
)
end
it
'raises when validation fails'
do
@validator
.
expects
(
:validated?
).
returns
(
false
)
@validator
.
stubs
(
:results_message
).
returns
(
'results_message'
)
@validator
.
stubs
(
:failure_reason
).
returns
(
'failure_reason'
)
should
.
raise
(
Informative
)
{
@subject
.
send
(
:validate_podspec
,
@podspec
)
}.
message
.
should
.
include
"The `Reachability` pod failed to validate due to failure_reason:
\n
results_message"
end
end
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment