mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Implement status_code method for rack_test_driver.
This commit is contained in:
parent
072e697130
commit
d80471982d
5 changed files with 8 additions and 4 deletions
|
@ -204,6 +204,10 @@ class Capybara::Driver::RackTest < Capybara::Driver::Base
|
||||||
def response_headers
|
def response_headers
|
||||||
response.headers
|
response.headers
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def response_code
|
||||||
|
response.status
|
||||||
|
end
|
||||||
|
|
||||||
def submit(method, path, attributes)
|
def submit(method, path, attributes)
|
||||||
path = current_path if not path or path.empty?
|
path = current_path if not path or path.empty?
|
||||||
|
|
|
@ -133,7 +133,7 @@ end
|
||||||
shared_examples_for "driver with response code support" do
|
shared_examples_for "driver with response code support" do
|
||||||
it "should make the response code available through response_code" do
|
it "should make the response code available through response_code" do
|
||||||
@driver.visit('/with_simple_html')
|
@driver.visit('/with_simple_html')
|
||||||
@driver.response_code.should == '200'
|
@driver.response_code.should == 200
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ shared_examples_for "session with response code support" do
|
||||||
describe '#response_code' do
|
describe '#response_code' do
|
||||||
it "should return response codes" do
|
it "should return response codes" do
|
||||||
@session.visit('/with_simple_html')
|
@session.visit('/with_simple_html')
|
||||||
@session.response_code.should == '200'
|
@session.response_code.should == 200
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,6 +13,6 @@ describe Capybara::Driver::RackTest do
|
||||||
|
|
||||||
it_should_behave_like "driver"
|
it_should_behave_like "driver"
|
||||||
it_should_behave_like "driver with header support"
|
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
|
end
|
||||||
|
|
|
@ -29,6 +29,6 @@ describe Capybara::Session do
|
||||||
it_should_behave_like "session"
|
it_should_behave_like "session"
|
||||||
it_should_behave_like "session without javascript support"
|
it_should_behave_like "session without javascript support"
|
||||||
it_should_behave_like "session with headers 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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue