Permalink
Browse files

Added a global before/after that sets default settings for VCR and fa…

…keweb, so our specs don't have to keep setting things back to the defaults in their own before and after blocks.
  • Loading branch information...
1 parent a35de86 commit 6a989339196a0efff085d49fdad6bc8342e572b3 @myronmarston committed Mar 9, 2010
Showing with 7 additions and 32 deletions.
  1. +0 −12 spec/cassette_spec.rb
  2. +1 −12 spec/extensions/net_http_spec.rb
  3. +6 −0 spec/spec_helper.rb
  4. +0 −8 spec/vcr_spec.rb
View
@@ -1,18 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe VCR::Cassette do
- before(:all) do
- VCR::Config.default_cassette_options = { :record => :unregistered }
- end
-
- after(:all) do
- VCR::Config.default_cassette_options = { :record => :unregistered }
- end
-
- before(:each) do
- FakeWeb.clean_registry
- end
-
describe '#cache_file' do
temp_dir File.expand_path(File.dirname(__FILE__) + '/fixtures/cache_file'), :assign_to_cache_dir => true
@@ -1,19 +1,8 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "Net::HTTP Extensions" do
- before(:all) do
- @orig_allow_net_connect = FakeWeb.allow_net_connect?
- FakeWeb.allow_net_connect = true
- end
-
- after(:all) do
- FakeWeb.allow_net_connect = @orig_allow_net_connect
- end
-
before(:each) do
- @current_cassette = mock
- VCR.stub!(:current_cassette).and_return(@current_cassette)
- FakeWeb.clean_registry
+ VCR.stub!(:current_cassette).and_return(@current_cassette = mock)
end
describe 'a request that is not registered with FakeWeb' do
View
@@ -20,4 +20,10 @@
Spec::Runner.configure do |config|
config.extend TempCacheDir
config.extend DisableWarnings
+
+ config.before(:each) do
+ VCR::Config.default_cassette_options = { :record => :unregistered }
+ FakeWeb.allow_net_connect = true
+ FakeWeb.clean_registry
+ end
end
View
@@ -1,14 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe VCR do
- before(:all) do
- VCR::Config.default_cassette_options = { :record => :unregistered }
- end
-
- after(:all) do
- VCR::Config.default_cassette_options = { :record => :unregistered }
- end
-
def create_cassette
VCR.create_cassette!(:cassette_test)
end

0 comments on commit 6a98933

Please sign in to comment.