[rspec-users] rspec-rails render_views doesn't render layouts? / how to check flash isn't rendered

nruth nick.rutherford at gmail.com
Mon Aug 29 07:38:52 EDT 2011

Hi David

Something like:

Given I am a user about to receive an arbitrary flash notice
When I visit one of the application's static pages which has not yet been 
Then I should not see my flash notice in the page
  And another user should not see my flash notice when they visit the same 
page afterwards

The aim is to produce a sort of tripwire test which checks that nobody has 
added <%= flash[:notice] %> or similar to any of the ERB files involved in 
rendering this page.
It's to prevent a problem where someone might log out (devise), be sent to / 
and trigger static (or varnish) page caching saying "You have been logged 
out" which everyone else would then also see. 

I agree it's more of an integration test, as it's testing the view and 
controller, so I'll try a request spec with dummy controller/routing to set 
a flash message next.
I'd thought I could manipulate the flash in a controller spec, but now I 
remember it's for inspecting it after a request.

Thanks for the help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110829/06c9da49/attachment-0001.html>

More information about the rspec-users mailing list