[rspec-users] How to detect test fail on after(:each) method?
dchelimsky at gmail.com
Tue Aug 16 07:58:01 EDT 2011
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.
More information about the rspec-users