Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use the OptionParser type option

  • Loading branch information...
commit 91feb97d9523c99ec997d7718d3dc360168147d9 1 parent 721140d
Sasha authored
View
4 lib/rspec/core/option_parser.rb
@@ -61,8 +61,8 @@ def parser(options)
options[:fail_fast] = true
end
- parser.on('--failure-exit-code CODE', 'Override the exit code used when there are failing specs') do |o|
- options[:failure_exit_code] = o.to_i
+ parser.on('--failure-exit-code CODE', Integer, 'Override the exit code used when there are failing specs') do |code|
+ options[:failure_exit_code] = code
end
parser.on('-X', '--[no-]drb', 'Run examples via DRb') do |o|
View
8 spec/rspec/core/configuration_options_spec.rb
@@ -202,13 +202,13 @@
describe "--failure-exit-code" do
it "sets :failure_exit_code" do
- parse_options('--failure-exit-code', '0').should include(:failure_exit_code => 0)
- parse_options('--failure-exit-code', '1').should include(:failure_exit_code => 1)
- parse_options('--failure-exit-code', '2').should include(:failure_exit_code => 2)
+ (0..2).each do |code|
+ parse_options('--failure-exit-code', code.to_s)[:failure_exit_code].should == code
+ end
end
it "overrides previous :failure_exit_code" do
- parse_options('--failure-exit-code', '2', '--failure-exit-code', '3').should include(:failure_exit_code => 3)
+ parse_options('--failure-exit-code', '2', '--failure-exit-code', '3')[:failure_exit_code].should == 3
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.