Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing rendering of a given layout with RSpec & Rails

Is it possible to test the use of a given layout using RSpec with Rails, for example I'd like a matcher that does the following:

response.should use_layout('my_layout_name') 

I found a use_layout matcher when Googling but it doesn't work as neither the response or controller seem to have a layout property that matcher was looking for.

like image 382
DEfusion Avatar asked Sep 20 '08 20:09

DEfusion


1 Answers

David Chelimsky posted a good answer over on the Ruby Forum:

response.should render_template("layouts/some_layout") 
like image 58
Kevin Ansfield Avatar answered Sep 17 '22 15:09

Kevin Ansfield