Browse files

Add the --fail-fast command line option

  • Loading branch information...
1 parent 5ed55e4 commit 8bfaf23fd7c7a1659cb2f33ec96037cb9e63eb27 @jeffkreeftmeijer committed Nov 7, 2010
Showing with 13 additions and 3 deletions.
  1. +7 −3 lib/rspec/core/option_parser.rb
  2. +6 −0 spec/rspec/core/configuration_options_spec.rb
View
10 lib/rspec/core/option_parser.rb
@@ -99,16 +99,20 @@ def parser(options)
parser.on('--autotest') do |o|
options[:autotest] = true
end
-
+
+ parser.on('--fail-fast', 'Use the fail_fast option to tell RSpec to abort the run on first failure.') do |o|
+ options[:fail_fast] = true
+ end
+
parser.on('-t', '--tag TAG[:VALUE]', 'Run examples with the specified tag',
'To exclude examples, add ~ before the tag (e.g. ~slow)',
'(TAG is always converted to a symbol)') do |tag|
filter_type = tag.start_with?('~') ? :exclusion_filter : :filter
-
+
name,value = tag.gsub(/^(~@|~|@)/, '').split(':')
name = name.to_sym
value = true if value.nil?
-
+
options[filter_type] ||= {}
options[filter_type][name] = value
end
View
6 spec/rspec/core/configuration_options_spec.rb
@@ -215,6 +215,12 @@ def options_from_args(*args)
end
end
+ describe "--fail-fast" do
+ it "sets fail_fast on config" do
+ options_from_args("--fail-fast").should include(:fail_fast => true)
+ end
+ end
+
describe "options file (override)" do
let(:config) { OpenStruct.new }

0 comments on commit 8bfaf23

Please sign in to comment.