Skip to content

Commit

Permalink
Add the --fail-fast command line option
Browse files Browse the repository at this point in the history
- Closes #219.
  • Loading branch information
Jeff Kreeftmeijer authored and dchelimsky committed Nov 7, 2010
1 parent 5ed55e4 commit e2ec71f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/rspec/core/option_parser.rb
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions spec/rspec/core/configuration_options_spec.rb
Expand Up @@ -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 }

Expand Down

0 comments on commit e2ec71f

Please sign in to comment.