Ruby Forum RSpec > Return code for running stories

Posted by Kero (Guest)
on 02.05.2008 21:57
(Received via mailing list)
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 :)
Posted by Ben Mabey (mabes)
on 03.05.2008 01:24
(Received via mailing list)
Kero wrote:
>
> 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@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>   

Kero,
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.:
http://rspec.lighthouseapp.com/projects/5645/tickets/228-story-runner-exit-code

-Ben
Posted by Kero (Guest)
on 03.05.2008 10:35
(Received via mailing list)
> functionality and it has already been accepted.  So you can upgrade to  
> edge rspec to get this functionality or just apply my patch.:
> http://rspec.lighthouseapp.com/projects/5645/tickets/228-story-runner-exit-code

Ironic, this is about the first thing that happened when I stepped
off the list ;)

Also, I had looked at HEAD svn, but it seems I need a git repo.
Good, I like git!

OK, seems to work, great! thanks!

Bye,
Kero.