mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Rename response_code to status_code for consistency.
Update selenium specs to ensure that it raises the Capybara::NotSupportedByDriverError error.
This commit is contained in:
parent
6acb113497
commit
d1fc4d6e1a
16 changed files with 26 additions and 23 deletions
|
|
@ -26,7 +26,7 @@ class Capybara::Driver::Base
|
|||
raise Capybara::NotSupportedByDriverError
|
||||
end
|
||||
|
||||
def response_code
|
||||
def status_code
|
||||
raise Capybara::NotSupportedByDriverError
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ class Capybara::Driver::Celerity < Capybara::Driver::Base
|
|||
browser.response_headers
|
||||
end
|
||||
|
||||
def response_code
|
||||
def status_code
|
||||
browser.status_code
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ class Capybara::Driver::RackTest < Capybara::Driver::Base
|
|||
response.headers
|
||||
end
|
||||
|
||||
def response_code
|
||||
def status_code
|
||||
response.status
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ module Capybara
|
|||
def_delegator :driver, :cleanup!
|
||||
def_delegator :driver, :current_url
|
||||
def_delegator :driver, :response_headers
|
||||
def_delegator :driver, :response_code
|
||||
def_delegator :driver, :status_code
|
||||
def_delegator :driver, :visit
|
||||
def_delegator :driver, :body
|
||||
def_delegator :driver, :source
|
||||
|
|
|
|||
|
|
@ -130,18 +130,18 @@ shared_examples_for "driver with header support" do
|
|||
end
|
||||
end
|
||||
|
||||
shared_examples_for "driver with response code support" do
|
||||
it "should make the response code available through response_code" do
|
||||
shared_examples_for "driver with status code support" do
|
||||
it "should make the status code available through status_code" do
|
||||
@driver.visit('/with_simple_html')
|
||||
@driver.response_code.should == 200
|
||||
@driver.status_code.should == 200
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for "driver without response code support" do
|
||||
it "should raise when trying to access the response code available through response_code" do
|
||||
shared_examples_for "driver without status code support" do
|
||||
it "should raise when trying to access the status code available through status_code" do
|
||||
@driver.visit('/with_simple_html')
|
||||
lambda {
|
||||
@driver.response_code
|
||||
@driver.status_code
|
||||
}.should raise_error(Capybara::NotSupportedByDriverError)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
shared_examples_for "session with response code support" do
|
||||
describe '#response_code' do
|
||||
shared_examples_for "session with status code support" do
|
||||
describe '#status_code' do
|
||||
it "should return response codes" do
|
||||
@session.visit('/with_simple_html')
|
||||
@session.response_code.should == 200
|
||||
@session.status_code.should == 200
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for "session without response code support" do
|
||||
describe "#response_code" do
|
||||
shared_examples_for "session without status code support" do
|
||||
describe "#status_code" do
|
||||
before{ @session.visit('/with_simple_html') }
|
||||
it "should raise an error" do
|
||||
running {
|
||||
@session.response_code
|
||||
@session.status_code
|
||||
}.should raise_error(Capybara::NotSupportedByDriverError)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ if RUBY_PLATFORM =~ /java/
|
|||
it_should_behave_like "driver"
|
||||
it_should_behave_like "driver with javascript support"
|
||||
it_should_behave_like "driver with header support"
|
||||
it_should_behave_like "driver with response code support"
|
||||
it_should_behave_like "driver with status code support"
|
||||
|
||||
end
|
||||
else
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@ describe Capybara::Driver::Culerity do
|
|||
it_should_behave_like "driver"
|
||||
it_should_behave_like "driver with javascript support"
|
||||
it_should_behave_like "driver with header support"
|
||||
it_should_behave_like "driver with response code support"
|
||||
it_should_behave_like "driver with status code support"
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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 with response code support"
|
||||
it_should_behave_like "driver with status code support"
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,5 +20,5 @@ describe Capybara::Driver::Culerity do
|
|||
it_should_behave_like "driver"
|
||||
it_should_behave_like "driver with javascript support"
|
||||
it_should_behave_like "driver with header support"
|
||||
it_should_behave_like "driver with response code support"
|
||||
it_should_behave_like "driver with status code support"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,4 +15,5 @@ describe Capybara::Driver::Selenium do
|
|||
|
||||
it_should_behave_like "driver"
|
||||
it_should_behave_like "driver with javascript support"
|
||||
it_should_behave_like "driver without status code support"
|
||||
end
|
||||
|
|
@ -8,4 +8,5 @@ describe Capybara::Driver::Selenium do
|
|||
it_should_behave_like "driver"
|
||||
it_should_behave_like "driver with javascript support"
|
||||
it_should_behave_like "driver with frame support"
|
||||
it_should_behave_like "driver without status code support"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ if RUBY_PLATFORM =~ /java/
|
|||
it_should_behave_like "session"
|
||||
it_should_behave_like "session with javascript support"
|
||||
it_should_behave_like "session with headers support"
|
||||
it_should_behave_like "session with response code support"
|
||||
it_should_behave_like "session with status code support"
|
||||
end
|
||||
else
|
||||
puts "#{File.basename(__FILE__)} requires JRuby; skipping.."
|
||||
|
|
|
|||
|
|
@ -21,6 +21,6 @@ describe Capybara::Session do
|
|||
it_should_behave_like "session"
|
||||
it_should_behave_like "session with javascript support"
|
||||
it_should_behave_like "session with headers support"
|
||||
it_should_behave_like "session with response code support"
|
||||
it_should_behave_like "session with status code support"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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 with response code support"
|
||||
it_should_behave_like "session with status code support"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,5 +21,6 @@ describe Capybara::Session do
|
|||
it_should_behave_like "session"
|
||||
it_should_behave_like "session with javascript support"
|
||||
it_should_behave_like "session without headers support"
|
||||
it_should_behave_like "session without status code support"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue