Implement status_code method for rack_test_driver.

This commit is contained in:
Gareth Townsend 2010-06-07 11:45:09 +10:00
parent 072e697130
commit d80471982d
5 changed files with 8 additions and 4 deletions

View File

@ -204,6 +204,10 @@ class Capybara::Driver::RackTest < Capybara::Driver::Base
def response_headers
response.headers
end
def response_code
response.status
end
def submit(method, path, attributes)
path = current_path if not path or path.empty?

View File

@ -133,7 +133,7 @@ end
shared_examples_for "driver with response code support" do
it "should make the response code available through response_code" do
@driver.visit('/with_simple_html')
@driver.response_code.should == '200'
@driver.response_code.should == 200
end
end

View File

@ -2,7 +2,7 @@ shared_examples_for "session with response code support" do
describe '#response_code' do
it "should return response codes" do
@session.visit('/with_simple_html')
@session.response_code.should == '200'
@session.response_code.should == 200
end
end
end

View File

@ -13,6 +13,6 @@ describe Capybara::Driver::RackTest do
it_should_behave_like "driver"
it_should_behave_like "driver with header support"
it_should_behave_like "driver without response code support"
it_should_behave_like "driver with response code support"
end

View File

@ -29,6 +29,6 @@ describe Capybara::Session do
it_should_behave_like "session"
it_should_behave_like "session without javascript support"
it_should_behave_like "session with headers support"
it_should_behave_like "session without response code support"
it_should_behave_like "session with response code support"
end
end