[rspec-users] newb q: Can story steps report a view rendering error?

Alex Satrapa grail at goldweb.com.au
Wed Apr 2 20:37:53 EDT 2008


On 03/04/2008, at 10:09 , Tim Haines wrote:

> For now I can add response.code.should == "200" or something similar..

The page returned by Rails to provide you with the stack trace and  
stuff? That is a valid HTML page, and it comes along with a HTTP 200  
OK response.

What you need to do is look for stuff that you expect to see or not  
see on the page:

# This will complain when your page isn't rendered using the expected  
template
response.should have_tag('title', 'This is the title I expect to see')

There used to be an article on using the have_tag matcher here:  
http://rubypond.com/articles/2008/03/31/using-rspec-have_tag/

... however at the time of writing this email, I get a page stating  
only, "The page you are looking for is temporarily unavailable.  
Please try again later."  Hopefully it comes back, I go back to read  
it for a refresher every now and then.

Hope this helps!
Alex



More information about the rspec-users mailing list