Matt Patterson
2008-Feb-27 14:13 UTC
[rspec-users] Passing options into Story Runner (like --format)
Hey, 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 -- Matt Patterson | Design & Code <matt at reprocessed org> | http://www.reprocessed.org/