Search code examples
ruby-on-railsseleniumrspeccapybara

How to test the response code with Capybara + Selenium


I have the following spec:

it "deletes post", :js => true do 
...
...
page.status_code.should = '404'

end 

The page.status_code line is giving me this error:

Capybara::NotSupportedByDriverError

How do I check the page's status code?


Solution

  • status_code is not currently supported by the Selenium driver. You will need to write a different test to check the response status code.