[rspec-users] getting storyrunner success/failure status in rake task

Ben Mabey ben at benmabey.com
Wed Apr 16 01:53:11 EDT 2008

Korny Sietsma wrote:
> Hi folks - I'm trying to build a rake task to run our plain-text
> stories, both from a normal build and from our continuous integration
> server.
> However, I'm having a problem - running all.rb doesn't return any sort
> of success/failure - so a broken story doesn't indicate to Cruise
> Control that the build is broken.
> Currently the rake task is:
>   desc "Run all stories"
>   task :stories do
>         output = "#{ARTIFACT_DIR}/doc/rspec/story_results.txt"
>         ruby "#{RAILS_ROOT}/stories/all.rb"
>   end
> and all.rb calls story files which do the standard sort of thing:
> ----
> require File.dirname(__FILE__) + "/helper"
> with_steps_for(:stuff, :morestuff) do
>   run_local_story "my_first_story", :type => RailsStory
> end
> ----
> I'm going to try switching to Kyle Hargrave's story runner stuff - but
> it's unclear to me if this has any sort of success/fail indicator
> either...
> Any suggestions on how to get the above to return a failure code, or
> throw an exception?  I've seen stuff in the code relating to
> Spec::Story::World.errors() - but I can't seem to work out how to
> access this.
> (Oh, and I'm very new to rspec stories, and somewhat new to rake
> tasks, so forgive me if I'm missing something obvious)
> - Korny

The exit code for the story runner does not work in the current (1.1.3) 
version.  I made a patch to add that functionality so our CI would be 
happy and it is already in rspec edge and will be in 1.1.4.  You can 
either grab my patch or switch to edge rspec.  My patch is here:


More information about the rspec-users mailing list