Skip to content

Commit

Permalink
Use local tmp folder rather than Dir.mktmpdir for spec isolation.
Browse files Browse the repository at this point in the history
On travis, the jruby build is failing every spec with an error like "Permission denied - /tmp/d20110408-13741-ptyay/."  This should fix it.
  • Loading branch information
myronmarston committed Apr 9, 2011
1 parent fb9d0f7 commit d039c5b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions spec/spec_helper.rb
Expand Up @@ -43,7 +43,9 @@ def reset!(stubbing_lib = :fakeweb)
config.color_enabled = true config.color_enabled = true
config.debug = (using_git && RUBY_INTERPRETER == :mri) config.debug = (using_git && RUBY_INTERPRETER == :mri)


tmp_dir = File.expand_path('../../tmp/cassette_library_dir', __FILE__)
config.before(:each) do config.before(:each) do
VCR::Config.cassette_library_dir = tmp_dir
VCR.turn_on! unless VCR.turned_on? VCR.turn_on! unless VCR.turned_on?
VCR.eject_cassette while VCR.current_cassette VCR.eject_cassette while VCR.current_cassette


Expand All @@ -58,15 +60,8 @@ def reset!(stubbing_lib = :fakeweb)
VCR::HttpStubbingAdapters::Faraday.reset! VCR::HttpStubbingAdapters::Faraday.reset!
end end


# Ensure each example uses a different cassette library to keep them isolated.
config.around(:each) do |example|
Dir.mktmpdir do |dir|
VCR::Config.cassette_library_dir = dir
example.run
end
end

config.after(:each) do config.after(:each) do
FileUtils.rm_rf tmp_dir
VCR::HttpStubbingAdapters::Common.adapters.each do |a| VCR::HttpStubbingAdapters::Common.adapters.each do |a|
a.ignored_hosts = [] a.ignored_hosts = []
end end
Expand Down

0 comments on commit d039c5b

Please sign in to comment.