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
a5e83f3f
Commit
a5e83f3f
authored
Mar 09, 2016
by
Daniel Tomlinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make unit tests pass
parent
82850e0d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
5 deletions
+29
-5
resolver.rb
lib/cocoapods/resolver.rb
+1
-1
analyzer_spec.rb
spec/unit/installer/analyzer_spec.rb
+2
-2
sources_manager_spec.rb
spec/unit/sources_manager_spec.rb
+26
-2
No files found.
lib/cocoapods/resolver.rb
View file @
a5e83f3f
...
@@ -352,7 +352,7 @@ module Pod
...
@@ -352,7 +352,7 @@ module Pod
if
dependency
&&
dependency
.
podspec_repo
if
dependency
&&
dependency
.
podspec_repo
return
SourcesManager
.
aggregate_for_dependency
(
dependency
)
return
SourcesManager
.
aggregate_for_dependency
(
dependency
)
else
else
@aggregate
||=
Source
::
Aggregate
.
new
(
sources
.
map
(
&
:repo
)
)
@aggregate
||=
Source
::
Aggregate
.
new
(
sources
)
end
end
end
end
...
...
spec/unit/installer/analyzer_spec.rb
View file @
a5e83f3f
...
@@ -4,7 +4,7 @@ module Pod
...
@@ -4,7 +4,7 @@ module Pod
describe
Installer
::
Analyzer
do
describe
Installer
::
Analyzer
do
describe
'Analysis'
do
describe
'Analysis'
do
before
do
before
do
repos
=
[
fixture
(
'spec-repos/test_repo'
),
fixture
(
'spec-repos/master'
)]
repos
=
[
Source
.
new
(
fixture
(
'spec-repos/test_repo'
)),
MasterSource
.
new
(
fixture
(
'spec-repos/master'
)
)]
aggregate
=
Pod
::
Source
::
Aggregate
.
new
(
repos
)
aggregate
=
Pod
::
Source
::
Aggregate
.
new
(
repos
)
Pod
::
SourcesManager
.
stubs
(
:aggregate
).
returns
(
aggregate
)
Pod
::
SourcesManager
.
stubs
(
:aggregate
).
returns
(
aggregate
)
aggregate
.
sources
.
first
.
stubs
(
:url
).
returns
(
SpecHelper
.
test_repo_url
)
aggregate
.
sources
.
first
.
stubs
(
:url
).
returns
(
SpecHelper
.
test_repo_url
)
...
@@ -323,7 +323,7 @@ module Pod
...
@@ -323,7 +323,7 @@ module Pod
describe
'no-integrate platform validation'
do
describe
'no-integrate platform validation'
do
before
do
before
do
repos
=
[
fixture
(
'spec-repos/test_repo'
)]
repos
=
[
Source
.
new
(
fixture
(
'spec-repos/test_repo'
)
)]
aggregate
=
Pod
::
Source
::
Aggregate
.
new
(
repos
)
aggregate
=
Pod
::
Source
::
Aggregate
.
new
(
repos
)
Pod
::
SourcesManager
.
stubs
(
:aggregate
).
returns
(
aggregate
)
Pod
::
SourcesManager
.
stubs
(
:aggregate
).
returns
(
aggregate
)
aggregate
.
sources
.
first
.
stubs
(
:url
).
returns
(
SpecHelper
.
test_repo_url
)
aggregate
.
sources
.
first
.
stubs
(
:url
).
returns
(
SpecHelper
.
test_repo_url
)
...
...
spec/unit/sources_manager_spec.rb
View file @
a5e83f3f
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
require
'webmock'
module
Bacon
class
Context
alias_method
:after_webmock
,
:after
def
after
(
&
block
)
after_webmock
do
block
.
call
WebMock
.
reset!
end
end
end
end
def
set_up_test_repo_for_update
def
set_up_test_repo_for_update
set_up_test_repo
set_up_test_repo
...
@@ -260,8 +273,8 @@ module Pod
...
@@ -260,8 +273,8 @@ module Pod
it
'runs `pod repo add` when there is no matching source'
do
it
'runs `pod repo add` when there is no matching source'
do
Command
::
Repo
::
Add
.
any_instance
.
stubs
(
:run
).
once
Command
::
Repo
::
Add
.
any_instance
.
stubs
(
:run
).
once
SourcesManager
.
stubs
(
:source_with_url
).
returns
(
nil
).
then
.
returns
(
'Source'
)
SourcesManager
.
stubs
(
:source_with_url
).
returns
(
nil
).
then
.
returns
(
Source
.
new
(
'Source'
)
)
SourcesManager
.
find_or_create_source_with_url
(
'https://github.com/artsy/Specs.git'
).
SourcesManager
.
find_or_create_source_with_url
(
'https://github.com/artsy/Specs.git'
).
name
.
should
==
'Source'
should
==
'Source'
end
end
...
@@ -297,6 +310,9 @@ module Pod
...
@@ -297,6 +310,9 @@ module Pod
it
'updates source backed by a git repository'
do
it
'updates source backed by a git repository'
do
set_up_test_repo_for_update
set_up_test_repo_for_update
WebMock
::
API
.
stub_request
(
:get
,
"https://api.github.com/repos/cocoapods/specs/commits/master"
)
.
with
(
:headers
=>
{
'Accept'
=>
'application/vnd.github.chitauri-preview+sha'
})
.
to_return
(
:status
=>
200
,
:body
=>
''
,
:headers
=>
{})
SourcesManager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
SourcesManager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
SourcesManager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
SourcesManager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
UI
.
output
.
should
.
match
/is up to date/
UI
.
output
.
should
.
match
/is up to date/
...
@@ -304,12 +320,20 @@ module Pod
...
@@ -304,12 +320,20 @@ module Pod
it
'uses the only fast forward git option'
do
it
'uses the only fast forward git option'
do
set_up_test_repo_for_update
set_up_test_repo_for_update
WebMock
::
API
.
stub_request
(
:get
,
"https://api.github.com/repos/cocoapods/specs/commits/master"
)
.
with
(
:headers
=>
{
'Accept'
=>
'application/vnd.github.chitauri-preview+sha'
})
.
to_return
(
:status
=>
200
,
:body
=>
''
,
:headers
=>
{})
Source
.
any_instance
.
expects
(
:git!
).
with
{
|
options
|
options
.
should
.
include?
'--ff-only'
}
Source
.
any_instance
.
expects
(
:git!
).
with
{
|
options
|
options
.
should
.
include?
'--ff-only'
}
SourcesManager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
SourcesManager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
SourcesManager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
SourcesManager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
end
end
it
'prints a warning if the update failed'
do
it
'prints a warning if the update failed'
do
WebMock
::
API
.
stub_request
(
:get
,
"https://api.github.com/repos/cocoapods/specs/commits/master"
)
.
with
(
:headers
=>
{
'Accept'
=>
'application/vnd.github.chitauri-preview+sha'
})
.
to_return
(
:status
=>
200
,
:body
=>
''
,
:headers
=>
{})
UI
.
warnings
=
''
UI
.
warnings
=
''
set_up_test_repo_for_update
set_up_test_repo_for_update
Dir
.
chdir
(
test_repo_path
)
do
Dir
.
chdir
(
test_repo_path
)
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