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
03b5ba94
Commit
03b5ba94
authored
Jan 12, 2018
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a MockSource for the resolver tests
parent
88276c47
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
resolver_spec.rb
spec/unit/resolver_spec.rb
+62
-0
No files found.
spec/unit/resolver_spec.rb
View file @
03b5ba94
...
...
@@ -13,6 +13,68 @@ end
module
Pod
describe
Resolver
do
class
MockSource
<
Source
attr_reader
:name
def
initialize
(
name
,
&
blk
)
@name
=
name
@_pods_by_name
=
Hash
.
new
{
|
h
,
k
|
h
[
k
]
=
[]
}
@_current_pod
=
nil
instance_eval
(
&
blk
)
super
(
'/mock/repo'
)
end
def
pod
(
name
,
version
=
nil
,
platform:
[[
:ios
,
'9.0'
]],
test_spec:
false
,
&
_blk
)
cp
=
@_current_pod
Pod
::
Specification
.
new
(
cp
,
name
,
test_spec
)
do
|
spec
|
@_current_pod
=
spec
if
cp
cp
.
subspecs
<<
spec
else
spec
.
version
=
version
end
platform
.
each
{
|
pl
,
dt
|
spec
.
send
(
pl
).
deployment_target
=
dt
}
yield
spec
if
block_given?
end
@_pods_by_name
[
name
]
<<
@_current_pod
if
cp
.
nil?
ensure
@_current_pod
=
cp
end
def
test_spec
(
name:
'Tests'
,
&
blk
)
pod
(
name
,
:test_spec
=>
true
,
&
blk
)
end
def
all_specs
@_pods_by_name
.
values
.
flatten
(
1
)
end
def
pods
@_pods_by_name
.
keys
end
def
search
(
query
)
query
=
query
.
root_name
if
query
.
is_a?
(
Dependency
)
set
(
query
)
if
@_pods_by_name
.
key?
(
query
)
end
def
specification
(
name
,
version
)
@_pods_by_name
[
name
].
find
{
|
s
|
s
.
version
==
Pod
::
Version
.
new
(
version
)
}
end
def
versions
(
name
)
@_pods_by_name
[
name
].
map
(
&
:version
)
end
def
specification_path
(
name
,
version
)
pod_path
(
name
).
join
(
version
.
to_s
,
"
#{
name
}
.podspec"
)
end
def
specs_dir
repo
end
end
describe
'In general'
do
before
do
@podfile
=
Podfile
.
new
do
...
...
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