Commit a5e83f3f authored by Daniel Tomlinson's avatar Daniel Tomlinson

Make unit tests pass

parent 82850e0d
......@@ -352,7 +352,7 @@ module Pod
if dependency && dependency.podspec_repo
return SourcesManager.aggregate_for_dependency(dependency)
else
@aggregate ||= Source::Aggregate.new(sources.map(&:repo))
@aggregate ||= Source::Aggregate.new(sources)
end
end
......
......@@ -4,7 +4,7 @@ module Pod
describe Installer::Analyzer do
describe 'Analysis' 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)
Pod::SourcesManager.stubs(:aggregate).returns(aggregate)
aggregate.sources.first.stubs(:url).returns(SpecHelper.test_repo_url)
......@@ -323,7 +323,7 @@ module Pod
describe 'no-integrate platform validation' do
before do
repos = [fixture('spec-repos/test_repo')]
repos = [Source.new(fixture('spec-repos/test_repo'))]
aggregate = Pod::Source::Aggregate.new(repos)
Pod::SourcesManager.stubs(:aggregate).returns(aggregate)
aggregate.sources.first.stubs(:url).returns(SpecHelper.test_repo_url)
......
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
set_up_test_repo
......@@ -260,8 +273,8 @@ module Pod
it 'runs `pod repo add` when there is no matching source' do
Command::Repo::Add.any_instance.stubs(:run).once
SourcesManager.stubs(:source_with_url).returns(nil).then.returns('Source')
SourcesManager.find_or_create_source_with_url('https://github.com/artsy/Specs.git').
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').name.
should == 'Source'
end
......@@ -297,6 +310,9 @@ module Pod
it 'updates source backed by a git repository' do
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.update(test_repo_path.basename.to_s, true)
UI.output.should.match /is up to date/
......@@ -304,12 +320,20 @@ module Pod
it 'uses the only fast forward git option' do
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' }
SourcesManager.expects(:update_search_index_if_needed_in_background).with({}).returns(nil)
SourcesManager.update(test_repo_path.basename.to_s, true)
end
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 = ''
set_up_test_repo_for_update
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