How to test the response code with Capybara + Selenium
As an aside. This line
page.status_code.should = '404'
Should be
page.status_code.should == 404
This worked for me with capybara-webkit.
status_code
is not currently supported by the Selenium driver. You will need to write a different test to check the response status code.
Either switch to another driver (like rack-test
) for that test, or test that the displayed page is the 404 page (should have content 'Not Found' in h1).
As @eugen said, Selenium doesn't support status codes.