[rspec-users] rspec-rails render_views doesn't render layouts? / how to check flash isn't rendered
nick.rutherford at gmail.com
Mon Aug 29 07:38:52 EDT 2011
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
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...
More information about the rspec-users