2009-11-07 14:44:45 -05:00
|
|
|
require File.expand_path('../spec_helper', File.dirname(__FILE__))
|
|
|
|
|
2009-11-16 16:02:16 -05:00
|
|
|
describe Capybara::Session do
|
2009-11-07 14:44:45 -05:00
|
|
|
context 'with rack test driver' do
|
|
|
|
before do
|
2009-11-16 16:02:16 -05:00
|
|
|
@session = Capybara::Session.new(:rack_test, TestApp)
|
2009-11-07 14:44:45 -05:00
|
|
|
end
|
2009-12-12 07:33:00 -05:00
|
|
|
|
2009-11-07 14:44:45 -05:00
|
|
|
describe '#driver' do
|
|
|
|
it "should be a rack test driver" do
|
2009-11-16 16:02:16 -05:00
|
|
|
@session.driver.should be_an_instance_of(Capybara::Driver::RackTest)
|
2009-11-07 14:44:45 -05:00
|
|
|
end
|
|
|
|
end
|
2009-12-12 07:33:00 -05:00
|
|
|
|
2009-11-07 14:44:45 -05:00
|
|
|
describe '#mode' do
|
|
|
|
it "should remember the mode" do
|
|
|
|
@session.mode.should == :rack_test
|
|
|
|
end
|
|
|
|
end
|
2009-12-12 07:33:00 -05:00
|
|
|
|
2010-04-09 08:01:17 -04:00
|
|
|
describe '#click_link' do
|
|
|
|
it "should use data-method if available" do
|
|
|
|
@session.visit "/with_html"
|
|
|
|
@session.click_link "A link with data-method"
|
|
|
|
@session.body.should == 'The requested object was deleted'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-11-07 14:44:45 -05:00
|
|
|
it_should_behave_like "session"
|
2009-12-12 15:56:32 -05:00
|
|
|
it_should_behave_like "session without javascript support"
|
2009-12-18 13:33:36 -05:00
|
|
|
it_should_behave_like "session with headers support"
|
2010-06-06 23:14:40 -04:00
|
|
|
it_should_behave_like "session with status code support"
|
2009-11-07 14:44:45 -05:00
|
|
|
end
|
|
|
|
end
|