On Feb 9, 2012, at 1:42 PM, Bryan Baugher wrote:
> Hi,
>
> I was trying to use the autorun feature of rspec but noticed that when I
run the command to kick off the ruby scripts it picks up the options that I give
to the command.
>
> ''myRubyBin -j optionValue''
>
> This then fails with this error,
>
> /usr/lib/ruby/1.8/optparse.rb:1448:in `complete''
> :
> invalid option: -j
> (
> OptionParser::InvalidOption
> )
> from /usr/lib/ruby/1.8/optparse.rb:1446:in `catch''
> from /usr/lib/ruby/1.8/optparse.rb:1446:in `complete''
> from /usr/lib/ruby/1.8/optparse.rb:1285:in `parse_in_order''
> from /usr/lib/ruby/1.8/optparse.rb:1252:in `catch''
> from /usr/lib/ruby/1.8/optparse.rb:1252:in `parse_in_order''
> from /usr/lib/ruby/1.8/optparse.rb:1246:in `order!''
> from /usr/lib/ruby/1.8/optparse.rb:1337:in `permute!''
> from /usr/lib/ruby/1.8/optparse.rb:1358:in `parse!''
> ... 6 levels...
> from
/usr/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/configuration_options.rb:26:in
`parse_options''
> from
/usr/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:59:in
`run''
> from
/usr/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in
`autorun''
>
> Is there a way for rspec/autorun to ignore all options?
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
"autorun" is designed to be a drop-in solution to run specs without
the "rspec" binary. I think you have two options here:
1.) autorun accepts ARGV as its runner arguments. You could massage ARGV before
requiring autorun.
2.) Use the RSpec runner explicitly: RSpec::Core::Runner.run(args)