Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Get the downloader functional specs passing again with the new Downlo…

…ader API.
  • Loading branch information...
commit 9978432d3e00546ad0d567731e8b3300c459d6e7 1 parent e6c4a42
@lukeredpath lukeredpath authored
View
1  .gitignore
@@ -15,3 +15,4 @@ spec/fixtures/integration/Headers/
pod
/concatenated.*
spec/fixtures/mercurial-repo/.hg/*cache
+.hg
View
1  Gemfile
@@ -7,4 +7,5 @@ group :development do
gem "guard-bacon"
gem "rb-fsevent"
gem "growl"
+ gem "mocha"
end
View
4 Gemfile.lock
@@ -8,6 +8,9 @@ GEM
guard-bacon (1.0.2)
guard (~> 0.8.4)
schmurfy-bacon (~> 1.2)
+ metaclass (0.0.1)
+ mocha (0.10.4)
+ metaclass (~> 0.0.1)
rake (0.9.2.2)
rb-fsevent (0.9.0)
schmurfy-bacon (1.2.1)
@@ -23,5 +26,6 @@ DEPENDENCIES
growl
guard
guard-bacon
+ mocha
rake
rb-fsevent
View
2  lib/cocoapods/downloader/subversion.rb
@@ -12,7 +12,7 @@ def download
end
def download_head
- svn "checkout '#{url}' '#{pod_root}'"
+ svn "checkout '#{url}' '#{pod.root}'"
end
def download_revision
View
82 spec/functional/downloader_spec.rb
@@ -2,112 +2,90 @@
describe "Pod::Downloader" do
before do
- @dir = temporary_directory + 'banana-lib'
+ @pod = Pod::LocalPod.new(fixture_spec('banana-lib/BananaLib.podspec'), temporary_sandbox)
end
describe "for Git" do
extend SpecHelper::TemporaryDirectory
it "check's out a specific commit" do
- downloader = Pod::Downloader.for_source(@dir,
+ @pod.specification.stubs(:source).returns(
:git => fixture('banana-lib'), :commit => '02467b074d4dc9f6a75b8cd3ab80d9bf37887b01'
)
+ downloader = Pod::Downloader.for_pod(@pod)
downloader.download
- (@dir + 'README').read.strip.should == 'first commit'
+
+ (@pod.root + 'README').read.strip.should == 'first commit'
end
it "check's out a specific tag" do
- downloader = Pod::Downloader.for_source(@dir,
+ @pod.specification.stubs(:source).returns(
:git => fixture('banana-lib'), :tag => 'v1.0'
)
+ downloader = Pod::Downloader.for_pod(@pod)
downloader.download
- (@dir + 'README').read.strip.should == 'v1.0'
+ (@pod.root + 'README').read.strip.should == 'v1.0'
end
- it "removes the .git directory" do
- downloader = Pod::Downloader.for_source(@dir,
- :git => fixture('banana-lib'), :tag => 'v1.0'
+ it "removes the .git directory when cleaning" do
+ @pod.specification.stubs(:source).returns(
+ :git => fixture('banana-lib')
)
+ downloader = Pod::Downloader.for_pod(@pod)
downloader.download
downloader.clean
- (@dir + '.git').should.not.exist
- end
-
- it "removes the clean_paths files and directories" do
- downloader = Pod::Downloader.for_source(@dir,
- :git => fixture('banana-lib'), :tag => 'v1.0'
- )
- downloader.download
- downloader.clean([@dir + 'README'])
- (@dir + 'README').should.not.exist
+ (@pod.root + '.git').should.not.exist
end
end
describe "for Mercurial" do
- extend SpecHelper::TemporaryDirectory
-
it "check's out a specific revision" do
- downloader = Pod::Downloader.for_source(@dir,
+ @pod.specification.stubs(:source).returns(
:hg => fixture('mercurial-repo'), :revision => '46198bb3af96'
)
+ downloader = Pod::Downloader.for_pod(@pod)
downloader.download
- (@dir + 'README').read.strip.should == 'first commit'
+ (@pod.root + 'README').read.strip.should == 'first commit'
end
- it "removes the .hg directory" do
- downloader = Pod::Downloader.for_source(@dir,
+ it "removes the .hg directory when cleaning" do
+ @pod.specification.stubs(:source).returns(
:hg => fixture('mercurial-repo')
)
+ downloader = Pod::Downloader.for_pod(@pod)
downloader.download
downloader.clean
- (@dir + '.hg').should.not.exist
- end
-
- it "removes the clean_paths files and directories" do
- downloader = Pod::Downloader.for_source(@dir,
- :hg => fixture('mercurial-repo')
- )
- downloader.download
- downloader.clean([@dir + 'README'])
- (@dir + 'README').should.not.exist
+ (@pod.root + '.hg').should.not.exist
end
end
describe "for Subversion" do
- extend SpecHelper::TemporaryDirectory
-
it "check's out a specific revision" do
- downloader = Pod::Downloader.for_source(@dir,
+ @pod.specification.stubs(:source).returns(
:svn => "file://#{fixture('subversion-repo')}", :revision => '1'
)
+ downloader = Pod::Downloader.for_pod(@pod)
downloader.download
- (@dir + 'README').read.strip.should == 'first commit'
+ (@pod.root + 'README').read.strip.should == 'first commit'
end
it "check's out a specific tag" do
- downloader = Pod::Downloader.for_source(@dir,
+ @pod.specification.stubs(:source).returns(
:svn => "file://#{fixture('subversion-repo')}/tags/tag-1"
)
+ downloader = Pod::Downloader.for_pod(@pod)
downloader.download
- (@dir + 'README').read.strip.should == 'tag 1'
+ (@pod.root + 'README').read.strip.should == 'tag 1'
end
- it "removes the .svn directories" do
- downloader = Pod::Downloader.for_source(@dir,
+ it "removes the .svn directories when cleaning" do
+ @pod.specification.stubs(:source).returns(
:svn => "file://#{fixture('subversion-repo')}/trunk"
)
+ downloader = Pod::Downloader.for_pod(@pod)
downloader.download
downloader.clean
- (@dir + '.svn').should.not.exist
- end
-
- it "removes the clean_paths files and directories" do
- downloader = Pod::Downloader.for_source(@dir,
- :svn => "file://#{fixture('subversion-repo')}/trunk"
- )
- downloader.download
- downloader.clean([@dir + 'README'])
- (@dir + 'README').should.not.exist
+ (@pod.root + '.svn').should.not.exist
end
end
end
View
1  spec/spec_helper.rb
@@ -1,5 +1,6 @@
require 'rubygems'
require 'bacon'
+require 'mocha'
require 'pathname'
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
Please sign in to comment.
Something went wrong with that request. Please try again.