On Thu, Jan 20, 2011 at 8:49 PM, David Chelimsky <dchelim...@gmail.com> wrote: > 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. >
oops, what I meant was succeeded or failed, not run. >> 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? I'm running functional tests (ui driven tests) and whenever a spec has failed, I'd like to grab a screenshot and save it. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users