On Jan 20, 2011, at 8:17 AM, vishnu wrote:

> Hi
>   inside an after :each block, whats the best way to find out if the
> current spec has run?

If you're in an after block, the current spec has run. No need to query 
anything.

> Right now the only solution I have is
> self.example.instance_variable_get(:@exception).nil?. Is there a
> better solution?

There is not. There is example.metadata[:execution_result], but it doesn't get 
the exception until after the afters (in case one has an exception).

What is it you're trying to do?

> Also, is there an on_error hook I can use instead of an after :each block?

That's an interesting idea, but again, what are you trying to accomplish?

Cheers,
David
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to