Require cleaning up after our specs rather than setting up before

It's easier to catch issues this way.
This commit is contained in:
Jo Liss 2012-01-04 19:40:27 +01:00
parent 7a856b702b
commit 21977817bf
5 changed files with 2 additions and 15 deletions

View File

@ -2,14 +2,11 @@ require 'spec_helper'
require 'capybara/dsl'
describe Capybara::DSL do
before do
Capybara.app = TestApp
end
after do
Capybara.session_name = nil
Capybara.default_driver = nil
Capybara.use_default_driver
Capybara.app = TestApp
end
describe '#default_driver' do

View File

@ -7,7 +7,6 @@ end
feature "Capybara's feature DSL" do
background do
Capybara.app = TestApp
@in_background = true
end

View File

@ -6,10 +6,6 @@ describe Capybara::RSpecMatchers do
include Capybara::DSL
include Capybara::RSpecMatchers
before :each do
Capybara.app = TestApp
end
describe "have_css matcher" do
it "gives proper description" do
have_css('h1').description.should == "has css \"h1\""

View File

@ -1,10 +1,6 @@
require 'spec_helper'
describe 'capybara/rspec', :type => :request do
before :each do
Capybara.app = TestApp
end
it "should include Capybara in rspec" do
visit('/foo')
page.body.should include('Another World')
@ -43,14 +39,12 @@ end
describe 'capybara/rspec', :type => :other do
it "should not include Capybara" do
Capybara.app = TestApp
expect { visit('/') }.to raise_error(NoMethodError)
end
end
feature "Feature DSL" do
scenario "is pulled in" do
Capybara.app = TestApp
visit('/foo')
page.body.should include('Another World')
end

View File

@ -22,6 +22,7 @@ require 'capybara/spec/session'
alias :running :lambda
Capybara.app = TestApp
Capybara.default_wait_time = 0 # less timeout so tests run faster
module TestSessions