[rspec-users] after :each invoked before formatter?
jarmo.p at gmail.com
Thu Jun 12 06:21:02 EDT 2008
I'm using RSpec with Watir to do some automated tests on IE.
I've ran into problem, where I want to make a screenshot of a browser window
when example fails. For that I made custom formatter where in
extra_failure_content i'm invoking screenshot taking methods. Now,
everything works like a charm, as long as I'm not using after :each. I
remember that I had this problem before with after :all with version 1.0.8
(at the moment I'm using 1.1.4).
In after :each block I'm invoking Watir to close IE (and maybe some other
stuff). So if each example finishes, IE is closed. Now, my logic is telling
me that after example has failed, formatter's methods should be invoked (as
example_failed or extra_failure_content methods), but it's not like that!
Those methods are called AFTER after :each block has finished. So, at the
moment it's like that:
1) it block executes
2) it block failed
3) after :each block executes
4) formatter's example_failed and extra_failure_content methods are executed
shouldn't be step 4 before step 3? With after :all, everything is working as
expected (so steps are executed as 1,2,4,3 with one failing it method in
describe block). So the problem in my case is that when screenshot taking
methods are invoked, IE has already been closed - thus unable to get any
As I mentioned before, everything was working alright with after :each in
rspec 1.0.8, but the problem was with after :all... now the problem is
Any ideas or suggestions or temporary patches?
Thank You for great framework!
View this message in context: http://www.nabble.com/after-%3Aeach-invoked-before-formatter--tp17796760p17796760.html
Sent from the rspec-users mailing list archive at Nabble.com.
More information about the rspec-users