Skip to content

Commit

Permalink
Require cleaning up after our specs rather than setting up before
Browse files Browse the repository at this point in the history
It's easier to catch issues this way.
  • Loading branch information
joliss committed Jan 4, 2012
1 parent 7a856b7 commit 2197781
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 15 deletions.
5 changes: 1 addition & 4 deletions spec/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
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
Expand Down
1 change: 0 additions & 1 deletion spec/rspec/features_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

feature "Capybara's feature DSL" do
background do
Capybara.app = TestApp
@in_background = true
end

Expand Down
4 changes: 0 additions & 4 deletions spec/rspec/matchers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
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\""
Expand Down
6 changes: 0 additions & 6 deletions spec/rspec_spec.rb
Original file line number Diff line number Diff line change
@@ -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')
Expand Down Expand Up @@ -43,14 +39,12 @@

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
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

alias :running :lambda

Capybara.app = TestApp
Capybara.default_wait_time = 0 # less timeout so tests run faster

module TestSessions
Expand Down

0 comments on commit 2197781

Please sign in to comment.