2010-12-10 08:54:46 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2012-09-07 14:17:38 -04:00
|
|
|
describe 'capybara/rspec', :type => :feature do
|
2011-02-03 17:18:07 -05:00
|
|
|
it "should include Capybara in rspec" do
|
2010-12-10 08:54:46 -05:00
|
|
|
visit('/foo')
|
|
|
|
page.body.should include('Another World')
|
|
|
|
end
|
|
|
|
|
|
|
|
context "resetting session" do
|
|
|
|
it "sets a cookie in one example..." do
|
|
|
|
visit('/set_cookie')
|
|
|
|
page.body.should include('Cookie set to test_cookie')
|
|
|
|
end
|
|
|
|
|
|
|
|
it "...then it is not availbable in the next" do
|
|
|
|
visit('/get_cookie')
|
|
|
|
page.body.should_not include('test_cookie')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "setting the current driver" do
|
|
|
|
it "sets the current driver in one example..." do
|
|
|
|
Capybara.current_driver = :selenium
|
|
|
|
end
|
|
|
|
|
|
|
|
it "...then it has returned to the default in the next example" do
|
|
|
|
Capybara.current_driver.should == :rack_test
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it "switches to the javascript driver when giving it as metadata", :js => true do
|
2010-12-23 18:36:22 -05:00
|
|
|
Capybara.current_driver.should == Capybara.javascript_driver
|
2010-12-10 08:54:46 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it "switches to the given driver when giving it as metadata", :driver => :culerity do
|
|
|
|
Capybara.current_driver.should == :culerity
|
|
|
|
end
|
|
|
|
end
|
2011-01-09 07:57:41 -05:00
|
|
|
|
|
|
|
describe 'capybara/rspec', :type => :other do
|
|
|
|
it "should not include Capybara" do
|
|
|
|
expect { visit('/') }.to raise_error(NoMethodError)
|
|
|
|
end
|
|
|
|
end
|
2011-02-11 08:44:58 -05:00
|
|
|
|
|
|
|
feature "Feature DSL" do
|
|
|
|
scenario "is pulled in" do
|
|
|
|
visit('/foo')
|
|
|
|
page.body.should include('Another World')
|
|
|
|
end
|
|
|
|
end
|