[rspec-users] How call a method/something after ALL specs?

David Chelimsky dchelimsky at gmail.com
Fri Jan 8 08:48:26 EST 2010

On Fri, Jan 8, 2010 at 7:24 AM, mix <fausto.galli at email.it> wrote:

> hi, is there a way to call a method/print something after ALL the
> specs are run ? (with all, i mean all, after all the spec files, just
> before the rspec output which say how many spec have passed)..
> i want to print some text telling which is the average response time
> and which is the action which takes more time
> I've tried with the ruby at_exit method, but it puts the result 3
> times, any hint?

Best bet is probably a custom formatter. I'd make a subclass of the
formatter you want to use, for example
Spec::Runner::Formatter::ProgressBarFormatter, and override the dump_summary
method (which is defined in Spec::Runner::Formatter::BaseTextFormatter).

Then you can say:

spec spec --formatter <path/to/your/custom/formatter>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100108/c66fac91/attachment.html>

More information about the rspec-users mailing list