From d039c5b770e39f647b558f0f38ab8a47696b7c31 Mon Sep 17 00:00:00 2001 From: Myron Marston Date: Fri, 8 Apr 2011 22:56:58 -0700 Subject: [PATCH] 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. --- spec/spec_helper.rb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cf42a02b..fafcf77c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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