Set Capybara.app at spec run time, not at definition time

This bug got triggered on Travis.
This commit is contained in:
Jo Liss 2012-01-03 17:18:42 +01:00
parent 363b43acb7
commit 9fd6c85949
4 changed files with 11 additions and 10 deletions

View File

@ -1,9 +1,7 @@
require 'spec_helper'
require 'capybara/dsl'
describe Capybara::DSL do
before do
Capybara.app = TestApp
end
@ -257,5 +255,4 @@ describe Capybara::DSL do
foo.using_wait_time(6)
end
end
end

View File

@ -1,14 +1,13 @@
require 'spec_helper'
require 'capybara/rspec'
Capybara.app = TestApp
RSpec.configuration.before(:each, :example_group => {:file_path => __FILE__}) do
@in_filtered_hook = true
end
feature "Capybara's feature DSL" do
background do
Capybara.app = TestApp
@in_background = true
end

View File

@ -2,12 +2,14 @@ require 'spec_helper'
require 'capybara/dsl'
require 'capybara/rspec/matchers'
Capybara.app = TestApp
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\""
@ -564,4 +566,3 @@ describe Capybara::RSpecMatchers do
end
end
end

View File

@ -1,8 +1,10 @@
require 'spec_helper'
Capybara.app = TestApp
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')
@ -41,12 +43,14 @@ 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