Commit 9978432d authored by Luke Redpath's avatar Luke Redpath

Get the downloader functional specs passing again with the new Downloader API.

parent e6c4a42a
...@@ -15,3 +15,4 @@ spec/fixtures/integration/Headers/ ...@@ -15,3 +15,4 @@ spec/fixtures/integration/Headers/
pod pod
/concatenated.* /concatenated.*
spec/fixtures/mercurial-repo/.hg/*cache spec/fixtures/mercurial-repo/.hg/*cache
.hg
\ No newline at end of file
...@@ -7,4 +7,5 @@ group :development do ...@@ -7,4 +7,5 @@ group :development do
gem "guard-bacon" gem "guard-bacon"
gem "rb-fsevent" gem "rb-fsevent"
gem "growl" gem "growl"
gem "mocha"
end end
...@@ -8,6 +8,9 @@ GEM ...@@ -8,6 +8,9 @@ GEM
guard-bacon (1.0.2) guard-bacon (1.0.2)
guard (~> 0.8.4) guard (~> 0.8.4)
schmurfy-bacon (~> 1.2) schmurfy-bacon (~> 1.2)
metaclass (0.0.1)
mocha (0.10.4)
metaclass (~> 0.0.1)
rake (0.9.2.2) rake (0.9.2.2)
rb-fsevent (0.9.0) rb-fsevent (0.9.0)
schmurfy-bacon (1.2.1) schmurfy-bacon (1.2.1)
...@@ -23,5 +26,6 @@ DEPENDENCIES ...@@ -23,5 +26,6 @@ DEPENDENCIES
growl growl
guard guard
guard-bacon guard-bacon
mocha
rake rake
rb-fsevent rb-fsevent
...@@ -12,7 +12,7 @@ module Pod ...@@ -12,7 +12,7 @@ module Pod
end end
def download_head def download_head
svn "checkout '#{url}' '#{pod_root}'" svn "checkout '#{url}' '#{pod.root}'"
end end
def download_revision def download_revision
......
...@@ -2,112 +2,90 @@ require File.expand_path('../../spec_helper', __FILE__) ...@@ -2,112 +2,90 @@ require File.expand_path('../../spec_helper', __FILE__)
describe "Pod::Downloader" do describe "Pod::Downloader" do
before do before do
@dir = temporary_directory + 'banana-lib' @pod = Pod::LocalPod.new(fixture_spec('banana-lib/BananaLib.podspec'), temporary_sandbox)
end end
describe "for Git" do describe "for Git" do
extend SpecHelper::TemporaryDirectory extend SpecHelper::TemporaryDirectory
it "check's out a specific commit" do 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' :git => fixture('banana-lib'), :commit => '02467b074d4dc9f6a75b8cd3ab80d9bf37887b01'
) )
downloader = Pod::Downloader.for_pod(@pod)
downloader.download downloader.download
(@dir + 'README').read.strip.should == 'first commit'
(@pod.root + 'README').read.strip.should == 'first commit'
end end
it "check's out a specific tag" do 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' :git => fixture('banana-lib'), :tag => 'v1.0'
) )
downloader = Pod::Downloader.for_pod(@pod)
downloader.download downloader.download
(@dir + 'README').read.strip.should == 'v1.0' (@pod.root + 'README').read.strip.should == 'v1.0'
end end
it "removes the .git directory" do it "removes the .git directory when cleaning" do
downloader = Pod::Downloader.for_source(@dir, @pod.specification.stubs(:source).returns(
:git => fixture('banana-lib'), :tag => 'v1.0' :git => fixture('banana-lib')
) )
downloader = Pod::Downloader.for_pod(@pod)
downloader.download downloader.download
downloader.clean downloader.clean
(@dir + '.git').should.not.exist (@pod.root + '.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
end end
end end
describe "for Mercurial" do describe "for Mercurial" do
extend SpecHelper::TemporaryDirectory
it "check's out a specific revision" do 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' :hg => fixture('mercurial-repo'), :revision => '46198bb3af96'
) )
downloader = Pod::Downloader.for_pod(@pod)
downloader.download downloader.download
(@dir + 'README').read.strip.should == 'first commit' (@pod.root + 'README').read.strip.should == 'first commit'
end end
it "removes the .hg directory" do it "removes the .hg directory when cleaning" do
downloader = Pod::Downloader.for_source(@dir, @pod.specification.stubs(:source).returns(
:hg => fixture('mercurial-repo') :hg => fixture('mercurial-repo')
) )
downloader = Pod::Downloader.for_pod(@pod)
downloader.download downloader.download
downloader.clean downloader.clean
(@dir + '.hg').should.not.exist (@pod.root + '.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
end end
end end
describe "for Subversion" do describe "for Subversion" do
extend SpecHelper::TemporaryDirectory
it "check's out a specific revision" do 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' :svn => "file://#{fixture('subversion-repo')}", :revision => '1'
) )
downloader = Pod::Downloader.for_pod(@pod)
downloader.download downloader.download
(@dir + 'README').read.strip.should == 'first commit' (@pod.root + 'README').read.strip.should == 'first commit'
end end
it "check's out a specific tag" do 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" :svn => "file://#{fixture('subversion-repo')}/tags/tag-1"
) )
downloader = Pod::Downloader.for_pod(@pod)
downloader.download downloader.download
(@dir + 'README').read.strip.should == 'tag 1' (@pod.root + 'README').read.strip.should == 'tag 1'
end end
it "removes the .svn directories" do it "removes the .svn directories when cleaning" do
downloader = Pod::Downloader.for_source(@dir, @pod.specification.stubs(:source).returns(
:svn => "file://#{fixture('subversion-repo')}/trunk" :svn => "file://#{fixture('subversion-repo')}/trunk"
) )
downloader = Pod::Downloader.for_pod(@pod)
downloader.download downloader.download
downloader.clean downloader.clean
(@dir + '.svn').should.not.exist (@pod.root + '.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
end end
end end
end end
......
require 'rubygems' require 'rubygems'
require 'bacon' require 'bacon'
require 'mocha'
require 'pathname' require 'pathname'
ROOT = Pathname.new(File.expand_path('../../', __FILE__)) ROOT = Pathname.new(File.expand_path('../../', __FILE__))
......
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