Skip to content

Commit

Permalink
Handle the --retry option in profiles, fixes #1050.
Browse files Browse the repository at this point in the history
  • Loading branch information
brasmusson committed Oct 2, 2017
1 parent b65317c commit 74c5e44
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo

### Fixed

* N/A
* Handle the `--retry` option in profiles ([#1050](https://github.com/cucumber/cucumber-ruby/issues/1050) [@brasmusson](https://github.com/brasmusson))

### Improved

Expand Down
2 changes: 2 additions & 0 deletions lib/cucumber/cli/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,8 @@ def reverse_merge(other_options)
@options[:formats] = stdout_formats[0..0] + non_stdout_formats
end

@options[:retry] = other_options[:retry] if @options[:retry] == 0

self
end

Expand Down
20 changes: 20 additions & 0 deletions spec/cucumber/cli/options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,26 @@ def after_parsing(args)

expect(options[:duration]).to be false
end

context '--retry ATTEMPTS' do
context '--retry option not defined on the command line' do
it 'uses the --retry option from the profile' do
given_cucumber_yml_defined_as('foo' => '--retry 2')
options.parse!(%w[-p foo])

expect(options[:retry]).to be 2
end
end

context '--retry option defined on the command line' do
it 'ignores the --retry option from the profile' do
given_cucumber_yml_defined_as('foo' => '--retry 2')
options.parse!(%w[--retry 1 -p foo])

expect(options[:retry]).to be 1
end
end
end
end

context '-P or --no-profile' do
Expand Down

0 comments on commit 74c5e44

Please sign in to comment.