Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 2d6180c

Browse files
authored
Merge pull request #2434 from ianks/master
Add -n short option for --next-failure
2 parents edc7ce2 + bbdc984 commit 2d6180c

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

lib/rspec/core/configuration.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def deprecation_stream=(value)
161161

162162
# @macro define_reader
163163
# The file path to use for persisting example statuses. Necessary for the
164-
# `--only-failures` and `--next-failures` CLI options.
164+
# `--only-failures` and `--next-failure` CLI options.
165165
#
166166
# @overload example_status_persistence_file_path
167167
# @return [String] the file path
@@ -170,7 +170,7 @@ def deprecation_stream=(value)
170170
define_reader :example_status_persistence_file_path
171171

172172
# Sets the file path to use for persisting example statuses. Necessary for the
173-
# `--only-failures` and `--next-failures` CLI options.
173+
# `--only-failures` and `--next-failure` CLI options.
174174
def example_status_persistence_file_path=(value)
175175
@example_status_persistence_file_path = value
176176
clear_values_derived_from_example_status_persistence_file_path

lib/rspec/core/option_parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def parser(options)
201201
configure_only_failures(options)
202202
end
203203

204-
parser.on("--next-failure", "Apply `--only-failures` and abort after one failure.",
204+
parser.on("-n", "--next-failure", "Apply `--only-failures` and abort after one failure.",
205205
" (Equivalent to `--only-failures --fail-fast --order defined`)") do
206206
configure_only_failures(options)
207207
set_fail_fast(options, 1)

spec/rspec/core/configuration_options_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
end
192192
end
193193

194-
%w[ --only-failures --next-failure ].each do |option|
194+
%w[ --only-failures --next-failure -n].each do |option|
195195
describe option do
196196
it "changes `config.only_failures?` to true" do
197197
opts = config_options_object(option)

spec/rspec/core/option_parser_spec.rb

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,22 +185,24 @@ module RSpec::Core
185185
end
186186
end
187187

188-
describe "--next-failure" do
189-
it 'is equivalent to `--tag last_run_status:failed --fail-fast --order defined`' do
190-
long_form = Parser.parse(%w[ --tag last_run_status:failed --fail-fast --order defined ])
191-
next_failure = Parser.parse(%w[ --next-failure ])
188+
%w[--next-failure -n].each do |option|
189+
describe option do
190+
it 'is equivalent to `--tag last_run_status:failed --fail-fast --order defined`' do
191+
long_form = Parser.parse(%w[ --tag last_run_status:failed --fail-fast --order defined ])
192+
next_failure = Parser.parse([option])
192193

193-
expect(next_failure).to include(long_form)
194-
end
194+
expect(next_failure).to include(long_form)
195+
end
195196

196-
it 'does not force `--order defined` over a specified `--seed 1234` option that comes before it' do
197-
options = Parser.parse(%w[ --seed 1234 --next-failure ])
198-
expect(options).to include(:order => "rand:1234")
199-
end
197+
it 'does not force `--order defined` over a specified `--seed 1234` option that comes before it' do
198+
options = Parser.parse(['--seed', '1234', option])
199+
expect(options).to include(:order => "rand:1234")
200+
end
200201

201-
it 'does not force `--order defined` over a specified `--seed 1234` option that comes after it' do
202-
options = Parser.parse(%w[ --next-failure --seed 1234 ])
203-
expect(options).to include(:order => "rand:1234")
202+
it 'does not force `--order defined` over a specified `--seed 1234` option that comes after it' do
203+
options = Parser.parse([option, '--seed', '1234'])
204+
expect(options).to include(:order => "rand:1234")
205+
end
204206
end
205207
end
206208

0 commit comments

Comments
 (0)