Skip to content

Commit

Permalink
Remove unused 3rd arg from Cli::Main (#1588)
Browse files Browse the repository at this point in the history
* Remove unused 3rd arg from Cli::Main

* Update CHANGELOG and UPGRADING
  • Loading branch information
aurelien-reeves authored Dec 2, 2021
1 parent 0ed3faf commit aa50584
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo

### Removed

- Removed former unused `stdin` argument from `Cli::Main`. That may impact your code
if you use cucumber API `Cucumber::Cli::Main`. See [UPGRADING.md](./UPGRADING.md#upgrading-to-800).
([PR#1588](https://github.com/cucumber/cucumber-ruby/pull/1588)
[Issue#1581](https://github.com/cucumber/cucumber-ruby/issues/1581))

### Security fixes

### Deprecated
Expand Down
35 changes: 35 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
# Upgrading to 8.0.0

## `Cucumber::Cli::Main` former `stdin` argument

The second argument of `Cucumber::Cli::Main` - which was formerly named `stdin` -
has been removed.

### Before cucumber 8.0.0

You would have used `Cucumber::Cli::Main` with a dummy parameter:

```ruby
Cucumber::Cli::Main.new(
argument_list,
nil, # <-- this is a former unused `stdin` parameter
@stdout,
@stderr,
@kernel
).execute!
```

### With cucumber 8.0.0

The argument has been removed from the initializer so the dummy parameter is not
required anymore:

```ruby
Cucumber::Cli::Main.new(
argument_list,
@stdout,
@stderr,
@kernel
).execute!
```

# Upgrading to 7.1.0

## The wire protocol
Expand Down
2 changes: 0 additions & 2 deletions features/lib/support/command_line.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def execute(args)

Cucumber::Cli::Main.new(
argument_list,
nil,
@stdout,
@stderr,
@kernel
Expand Down Expand Up @@ -126,7 +125,6 @@ def execute(task)
.and_wrap_original do |_, *args|
Cucumber::Cli::Main.new(
args[0],
nil,
@stdout,
@stderr,
@kernel
Expand Down
7 changes: 1 addition & 6 deletions lib/cucumber/cli/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ def execute(args)
end
end

# The second argument is there for retrocompatibility
# Removing it will require a breaking change
# But it is actually responsible for a rubycop offense: too many optional parameters
# As we don't want to deactivate that cop globally, we disable it just for the
# following.
def initialize(args, _ = nil, out = $stdout, err = $stderr, kernel = Kernel) # rubocop:disable Metrics/ParameterLists
def initialize(args, out = $stdout, err = $stderr, kernel = Kernel)
@args = args
@out = out
@err = err
Expand Down
3 changes: 1 addition & 2 deletions spec/cucumber/cli/main_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ module Cli
end

let(:args) { [] }
let(:stdin) { StringIO.new }
let(:stdout) { StringIO.new }
let(:stderr) { StringIO.new }
let(:kernel) { double(:kernel) }
subject { Main.new(args, stdin, stdout, stderr, kernel) }
subject { Main.new(args, stdout, stderr, kernel) }

describe '#execute!' do
context 'passed an existing runtime' do
Expand Down

0 comments on commit aa50584

Please sign in to comment.