Commit f02baaac authored by Daniel Tomlinson's avatar Daniel Tomlinson Committed by Samuel Giddins

Address code review comments

parent 6858ddc5
...@@ -91,7 +91,7 @@ module Pod ...@@ -91,7 +91,7 @@ module Pod
def spec_sets def spec_sets
@spec_sets ||= begin @spec_sets ||= begin
analyzer.send(:update_repositories) unless config.skip_repo_update? analyzer.send(:update_repositories) unless config.skip_repo_update?
aggregate = Source::Aggregate.new(analyzer.sources.map) aggregate = Source::Aggregate.new(analyzer.sources)
installed_pods.map do |pod_name| installed_pods.map do |pod_name|
aggregate.search(Dependency.new(pod_name)) aggregate.search(Dependency.new(pod_name))
end.compact.uniq end.compact.uniq
......
...@@ -475,7 +475,7 @@ module Pod ...@@ -475,7 +475,7 @@ module Pod
# #
def source_from_path(path) def source_from_path(path)
return Source.new(path) unless path.basename.to_s == 'master' return Source.new(path) unless path.basename.to_s == 'master'
return MasterSource.new(path) MasterSource.new(path)
end end
# @return [Source::Aggregate] The aggregate of the sources from repos. # @return [Source::Aggregate] The aggregate of the sources from repos.
......
...@@ -296,15 +296,18 @@ module Pod ...@@ -296,15 +296,18 @@ module Pod
describe 'Updating Sources' do describe 'Updating Sources' do
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
before 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 => {})
end
after do after do
WebMock.reset! WebMock.reset!
end end
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/
...@@ -312,20 +315,12 @@ module Pod ...@@ -312,20 +315,12 @@ 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment