[rspec-users] Cucumber Custom Logging

Joseph Wilk lists at ruby-forum.com
Mon Nov 24 16:01:28 EST 2008

>I gather that before / after block only work within 
>step files? If so then that requires each step file be modified to turn 
>custom logging on or off, which is something I would much rather avoid.

I don't think this is the case. Every Before/After that is in a required 
file is run before a scenario. So in theory you could create one Before 
(in for example env.rb) which would get called for all scenarios.

As for steps well, that sounds a lot trickier. I cannot think of a clean 
way to get at that.

If you want steps now in a clean way I would suggest looking at making a 
custom formatter. Cucumber supports multiple formatters so you could run 
your rails logging formatter with other formatters. Bundle this up in a 
--profile to save typing long command line args. The formatter knows 
when every scenario is executed and when every step passes/fails/skips 

If you look at the progress formatter in cucumber it should be a good 
start for you.

Joseph Wilk
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list