Permalink
Browse files

Use local tmp folder rather than Dir.mktmpdir for spec isolation.

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...
1 parent fb9d0f7 commit d039c5b770e39f647b558f0f38ab8a47696b7c31 @myronmarston committed Apr 9, 2011
Showing with 3 additions and 8 deletions.
  1. +3 −8 spec/spec_helper.rb
View
@@ -43,7 +43,9 @@ def reset!(stubbing_lib = :fakeweb)
config.color_enabled = true
config.debug = (using_git && RUBY_INTERPRETER == :mri)
+ tmp_dir = File.expand_path('../../tmp/cassette_library_dir', __FILE__)
config.before(:each) do
+ VCR::Config.cassette_library_dir = tmp_dir
VCR.turn_on! unless VCR.turned_on?
VCR.eject_cassette while VCR.current_cassette
@@ -58,15 +60,8 @@ def reset!(stubbing_lib = :fakeweb)
VCR::HttpStubbingAdapters::Faraday.reset!
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
+ FileUtils.rm_rf tmp_dir
VCR::HttpStubbingAdapters::Common.adapters.each do |a|
a.ignored_hosts = []
end

0 comments on commit d039c5b

Please sign in to comment.