Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/rspec/core/option_parser.rb
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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