[rspec-users] Passing options into Story Runner (like --format)

Matt Patterson matt-lists at reprocessed.org
Wed Feb 27 09:13:47 EST 2008


I've been trying to hook in the HTML formatter for story output, with  
zero success - passing the --format option to me stories/all.rb  
script was doing nothing. So, I slapped in some puts statements and  
figured out that ARGV was getting cleared before  
Spec::Story::Runner.run_options was ever being called... I broke out  
the debugger and discovered that this is happening because when spec/ 
rails/story_adapter is required, the extension of  
Test::Unit::TestCase with Spec::Example::ExampleGroupMethods in spec/ 
interop/test/unit/testcase.rb means that the  
Spec::Rails::Example::RailsExampleGroup inheritance of  
Test::Unit::TestCase causes   
Spec::Example::ExampleGroupMethods.inherited to fire, which winds up  
calling Spec::Example::ExampleGroupMethods#inherited, which calls  
rspec_options, which consumes ARGV and clears it out.

Given that you then end up with a globally accessible  
Spec::Runner::Options instance, is there any reason for  
Spec::Story::Runner.run_options, since it tries to do exactly the  
same thing?

I'm only asking in case I'm missing something obvious, behaviour- 
wise. Otherwise I'll look into fixing it and post a patch to Lighthouse


   Matt Patterson | Design & Code
   <matt at reprocessed org> | http://www.reprocessed.org/

More information about the rspec-users mailing list