2009/3/28 Yi <hayafi...@gmail.com>:

> How can I test flash.now[:key] is being set in a controller test? Both
> flash[:key] and flash.now[:key].should == message didn't work
>
> I can use response.session["flash"][:key].should == message . Just looks bad

That's odd.  In a controller example, you should have a #flash method
available to do exactly what you tried:

http://rspec.rubyforge.org/rspec-rails/1.2.2/classes/Spec/Rails/Example/FunctionalExampleGroup.html#M000051

Try this: where you would like to put the expectation, put "puts
self.class".  Then run it and see what class name it prints.  If it's
ControllerExampleGroup, then there's something weird going on.  If
it's not, then it hasn't figured out that you're spec'ing a
controller.  In that case, post the opening of the describe block and
we'll be able to see what's going on.

Peter
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to