[rspec-users] Testing update, flash[:error]

Robert Dober robert.dober at gmail.com
Mon Nov 22 18:23:08 EST 2010

On Mon, Nov 22, 2010 at 11:26 PM, Paul Nelligan <nellboy at gmail.com> wrote:
> the question you need to ask is: is flash[:error] a variable within the
> scope that you're working ? ... I suspect that it's not, although I could be
> wrong.
> with that in mind,  does anyone know of a way of determining which variables
> are accessible via rspec on each (MVC) layer ?,  Is it a simple case of
> 'what's accessible in the controller is accessible in the controller spec'
> (for example) ?,  or is it more complicated ?
> cheers
> On Mon, Nov 22, 2010 at 9:55 PM, Robert Dober <robert.dober at gmail.com>
> wrote:
Paul, it was a little bit tricky to answer this because of the top
post, most of us are not used to that. So please if you can, do rather
bottom post or inline post.
That said, I am not sure what you mean by flash[:error] being a variable?
As the trace shows flash[:error] is nil, from this alone, we can
follow that flash points to an object which responds to the #[]
message. In our case it replies to [:error] with nil. However in the
given context we *know* that flash is a Hash representing well, the
flash. I am not an expert to tell you where in the rspec setup this is
mocked, but this should not be the problem in our case.
That said I would be happy to learn more about that mechanism.


More information about the rspec-users mailing list