Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 788
deb Avatar asked Oct 26 '11 21:10

deb


People also ask

What is Capybara in testing?

Capybara is a web-based test automation software that simulates scenarios for user stories and automates web application testing for behavior-driven software development. It is written in the Ruby programming language. Capybara.

What is Capybara gem in rails?

Capybara is an integration testing tool for rack based web applications. It simulates how a user would interact with a website.


1 Answers

As an aside. This line

page.status_code.should = '404' 

Should be

page.status_code.should == 404 

This worked for me with capybara-webkit.

like image 87
Apie Avatar answered Sep 21 '22 13:09

Apie