How to detect test fail on after(:each) method?

Hi All:

I am working on a test, and I need to detect if the test failed on the
after(:each) method, just to call a WebService.

Thanks!

On Aug 10, 2011, at 8:15 AM, Leo wrote:

Hi All:

I am working on a test, and I need to detect if the test failed on the
after(:each) method, just to call a WebService.

You can’t use after(:each) for this purpose because the status of each
example isn’t reported until the example and all of its hooks have run.

Your best bet is a custom formatter:
http://relishapp.com/rspec/rspec-core/docs/formatters/custom-formatters.

HTH,
David