[rspec-users] Return code for running stories

Ben Mabey ben at benmabey.com
Fri May 2 19:21:32 EDT 2008

Kero wrote:
> Hi all!
> Just wrote a few stories and committed code to a project of mine,
> then realized I made a mistake (with the commit, not the code or
> tests). It would be nice to put the script
> that runs the stories as a pre-commit hook, preventing the commit
> from succeeding if the stories fail.
> For that, I need to set the right exit code.
> In turn, I need to know he result of the tests.
> Given the prescription of running stories:
>   with_steps_for :accounts do
>     run 'path/to/file/with/story'
>   end
> I see neither #with_steps_for, nor #run return anything resembling
> the result of the tests (which does not really surprise me).
> So how to get the success/pending/failure of the stories out?
> Should I write a formatter/listener that exit(1)s on failure?
> Bye,
> Kero.
> PS: I'm back after a few months, and -behold- it looks like I
> can use rspec for work, too :)
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

This does not work in rspec 1.1.3.  I submitted a patch to add this 
functionality and it has already been accepted.  So you can upgrade to 
edge rspec to get this functionality or just apply my patch.:


More information about the rspec-users mailing list