#228 √ resolved
Ben Mabey

story runner exit code

Reported by Ben Mabey | January 10th, 2008 @ 09:40 PM | in 1.1.4

When running a story the exit code for a passing story should be 0.

The exit code for a failing story it should be 1.

I am also assuming that a pending story (a story whose only errors and due to pending exceptions) should be classified as a success and return 0 just like the spec runner. Or should it exit with a different number?

I'm more than happy to submit a patch for this.. It looks like there was a TODO for this at lib/spec/story/runner.rb. So, I was thinking of having story/runner/story_runner.rb#run_stories and story/runner/scenario_runner.rb#run to return booleans. Does that sound good?

Comments and changes to this ticket

  • Ben Mabey

    Ben Mabey January 16th, 2008 @ 02:33 AM

    Ok, I went ahead and made a patch for this. It seems like there should be a story to test the exit codes but it doesn't seem like the story runner is really eating it's own dog food yet. I saw stories are currently being used to test the spec command and saw one story for stories but I didn't see how it was being ran and tested (stories/resources/stories/failing_story.rb)

    Anyways, specs are in the patch. I tried to keep consistent with the current use of specs but let me know if you want me to change things around.

    Thanks,

    Ben

  • Ben Mabey
  • Chris Parsons

    Chris Parsons January 23rd, 2008 @ 10:39 AM

    This is a nice patch, but unfortunately there's an at_exit bug in 1.8.6 which seems to prevent it working ("ruby-talk post":http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/10789) Not sure the best way to work around this - although you can patch ruby if you're building it from source.

    We're running 1.8.5 on our cruise control server, and it works fine on there.

  • Aslak Hellesøy

    Aslak Hellesøy February 20th, 2008 @ 09:50 AM

    • → Assigned user changed from “” to “Aslak Hellesøy”
    • → State changed from “new” to “open”

    I'm going to start working on this now. The patch is a little outdated....

  • Aslak Hellesøy

    Aslak Hellesøy February 20th, 2008 @ 10:09 AM

    Actually, the patch still works with HEAD. Will apply when I get svn access.

  • Aslak Hellesøy

    Aslak Hellesøy February 21st, 2008 @ 06:21 PM

    • → Milestone changed from “” to “1.1.4”
    • → State changed from “open” to “resolved”

    Great patch Ben!

    Applied in r3317.

    Chris, I cannot reproduce the bug you're mentioning. I'm on ruby 1.8.6 (2007-09-24 patchlevel 111) [i686-darwin8.11.1] and I get 1 and 0 for filing and succeeding stories respectively.

  • Ben Mabey

    Ben Mabey February 21st, 2008 @ 07:06 PM

    Cool! Thanks Aslak! My first patch; it is a big day for me. :)

  • Chris Parsons

    Chris Parsons February 22nd, 2008 @ 10:22 AM

    Aslak: Hmm - perhaps a weird combination of things on my environment. The link to the bug I posted appears to be difficult to reproduce. Will try latest rspec and post more info if it doesn't work.

    cheers

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Behaviour Driven Development for Ruby.

Shared Ticket Bins

People watching this ticket