1
0
Fork 0
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:
Gareth Townsend 2010-06-07 13:14:40 +10:00
parent 6acb113497
commit d1fc4d6e1a
16 changed files with 26 additions and 23 deletions

View file

@ -26,7 +26,7 @@ class Capybara::Driver::Base
raise Capybara::NotSupportedByDriverError
end
def response_code
def status_code
raise Capybara::NotSupportedByDriverError
end

View file

@ -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

View file

@ -205,7 +205,7 @@ class Capybara::Driver::RackTest < Capybara::Driver::Base
response.headers
end
def response_code
def status_code
response.status
end

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

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 with response code support"
it_should_behave_like "driver with status code support"
end

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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.."

View file

@ -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

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 with response code support"
it_should_behave_like "session with status code support"
end
end

View file

@ -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