Test flash notice in layout view spec (rspec2, rails3)

Posted by jbpros on Stack Overflow See other posts from Stack Overflow or by jbpros
Published on 2010-05-02T15:46:50Z Indexed on 2010/05/02 15:58 UTC
Read the original article Hit count: 346

Filed under:
|

Hi!

I'd like to spec the fact that my application layout view prints out flash notices. However the following code does not run, the flash method does not exist in view specs (as opposed to controller specs where it works perfectly):

describe 'layouts/application' do
  it "renders flash notices" do
    flash[:notice] = "This is a notice!"
    render
    response.should contain "This is a notice!"
  end
end

Is my code wrong or is it a "not-yet-implemented feature" in Rspec 2? I'm on Rails3 and Rspec2 from its master branch on Git.

Thanks!

© Stack Overflow or respective owner

Related posts about rspec

Related posts about ruby-on-rails