diff --git a/lib/capybara/spec/spec_helper.rb b/lib/capybara/spec/spec_helper.rb index 6bd8f300..00e8a92e 100644 --- a/lib/capybara/spec/spec_helper.rb +++ b/lib/capybara/spec/spec_helper.rb @@ -12,15 +12,6 @@ module Capybara end end config.filter_run_excluding :requires => filter - config.around do |block| - if example.metadata[:requires] and example.metadata[:requires].include?(:js) - Capybara.default_wait_time = 1 - block.run - Capybara.default_wait_time = 0 - else - block.run - end - end end def spec(name, options={}, &block) diff --git a/spec/dsl_spec.rb b/spec/dsl_spec.rb index 7d9481f4..f871c67b 100644 --- a/spec/dsl_spec.rb +++ b/spec/dsl_spec.rb @@ -110,13 +110,21 @@ describe Capybara::DSL do end describe '#using_wait_time' do + before do + @previous_wait_time = Capybara.default_wait_time + end + + after do + Capybara.default_wait_time = @previous_wait_time + end + it "should switch the wait time and switch it back" do in_block = nil Capybara.using_wait_time 6 do in_block = Capybara.default_wait_time end in_block.should == 6 - Capybara.default_wait_time.should == 0 + Capybara.default_wait_time.should == @previous_wait_time end it "should ensure wait time is reset" do @@ -125,11 +133,7 @@ describe Capybara::DSL do raise "hell" end end.to raise_error - Capybara.default_wait_time.should == 0 - end - - after do - Capybara.default_wait_time = 0 + Capybara.default_wait_time.should == @previous_wait_time end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e661347c..9ed64e15 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -38,7 +38,7 @@ require 'capybara/spec/session' alias :running :lambda Capybara.app = TestApp -Capybara.default_wait_time = 0 # less timeout so tests run faster +Capybara.default_wait_time = 1 # less timeout so tests run faster module TestSessions RackTest = Capybara::Session.new(:rack_test, TestApp)