Test the status code of a response in Cucumber

Posted Over 13 years ago. Visible to the public.

Webrat

Then /^I should get a response with status (\d+)$/ do |status|
  response.status.should include(status)
end

Capybara

Then /^I should get a response with status (\d+)$/ do |status|
  page.status_code.should include(status.to_i)
end
Henning Koch
Last edit
Almost 12 years ago
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2011-02-01 10:20)