Skip to content

Commit

Permalink
Use VCR to record tarball downloads and speed up subsequent spec runs.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeredpath committed Mar 5, 2012
1 parent 83da2fb commit 8e6bf19
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -15,4 +15,5 @@ spec/fixtures/integration/Headers/
pod
/concatenated.*
spec/fixtures/mercurial-repo/.hg/*cache
.hg
.hg
spec/fixtures/vcr
2 changes: 2 additions & 0 deletions Gemfile
Expand Up @@ -8,4 +8,6 @@ group :development do
gem "rb-fsevent"
gem "growl"
gem "mocha-on-bacon"
gem "vcr"
gem "webmock"
end
8 changes: 8 additions & 0 deletions Gemfile.lock
@@ -1,7 +1,9 @@
GEM
remote: http://rubygems.org/
specs:
addressable (2.2.7)
bacon (1.1.0)
crack (0.3.1)
growl (1.0.3)
guard (0.8.8)
thor (~> 0.14.6)
Expand All @@ -15,6 +17,10 @@ GEM
rake (0.9.2.2)
rb-fsevent (0.9.0)
thor (0.14.6)
vcr (2.0.0)
webmock (1.8.0)
addressable (>= 2.2.7)
crack (>= 0.1.7)

PLATFORMS
ruby
Expand All @@ -27,3 +33,5 @@ DEPENDENCIES
mocha-on-bacon
rake
rb-fsevent
vcr
webmock
10 changes: 6 additions & 4 deletions spec/functional/downloader_spec.rb
Expand Up @@ -46,7 +46,8 @@
:git => "git://github.com/lukeredpath/libPusher.git", :download_only => true
)
downloader = Pod::Downloader.for_pod(@pod)
downloader.download

VCR.use_cassette('tarballs', :record => :new_episodes) { downloader.download }

# deliberately keep this assertion as loose as possible for now
(@pod.root + 'README.md').readlines[0].should =~ /libPusher/
Expand All @@ -57,7 +58,8 @@
:git => "git://github.com/lukeredpath/libPusher.git", :tag => 'v1.1', :download_only => true
)
downloader = Pod::Downloader.for_pod(@pod)
downloader.download

VCR.use_cassette('tarballs', :record => :new_episodes) { downloader.download }

# deliberately keep this assertion as loose as possible for now
(@pod.root + 'libPusher.podspec').readlines.grep(/1.1/).should.not.be.empty
Expand All @@ -68,12 +70,12 @@
:git => "git://github.com/lukeredpath/libPusher.git", :commit => 'eca89998d5', :download_only => true
)
downloader = Pod::Downloader.for_pod(@pod)
downloader.download

VCR.use_cassette('tarballs', :record => :new_episodes) { downloader.download }

# deliberately keep this assertion as loose as possible for now
(@pod.root + 'README.md').readlines[0].should =~ /PusherTouch/
end

end

describe "for Mercurial" do
Expand Down
8 changes: 8 additions & 0 deletions spec/spec_helper.rb
Expand Up @@ -49,3 +49,11 @@ def copy_fixture_to_pod(name, pod)
end

SpecHelper::Fixture.fixture('banana-lib') # ensure it exists

require 'vcr'
require 'webmock'

VCR.configure do |c|
c.cassette_library_dir = (ROOT + 'spec/fixtures/vcr').to_s
c.hook_into :webmock # or :fakeweb
end

0 comments on commit 8e6bf19

Please sign in to comment.