Skip to content

Commit 42f325f

Browse files
Deprecate AfterConfiguration hook (#1570)
* Deprecate usage of AfterConfiguration hook * Upgrade UPGRADING.md accordingly * Update feature tests to use InstallPlugin rather than AfterConfiguration * Update some rdocs * Add a notice in post_configuration_hook.feature * Add entry in CHANGELOG.md * Add an InstallPlugin feature based on AfterConfiguration one
1 parent 1ecac46 commit 42f325f

18 files changed

+101
-20
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
5050

5151
### Deprecated
5252

53+
- `AfterConfiguration` is deprecated. Please use `InstallPlugin` or `BeforeAll` instead.
54+
See the [UPGRADING.md](./UPGRADING.md#upgrading-to-710) to update your code accordingly.
55+
([1570](https://github.com/cucumber/cucumber-ruby/pull/1570))
56+
5357
- The built-in Wire protocol
5458

5559
The Wire protocol is still officially supported, but as an optional plugin rather

UPGRADING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,13 @@ require 'cucumber/wire'
4444
```
4545

4646
The wire protocol will be installed, and no deprecation message will be shown anymore.
47+
48+
## AfterConfiguration hook
49+
50+
Usage of `AfterConfiguration` hook will be deprecated in 7.1.0.
51+
52+
Use the new `InstallPlugin` hook if you need the `configuration` parameter.
53+
54+
Use the new `BeforeAll` hook if you don't need the `configuration` parameter.
55+
56+
More information about hooks can be found in [features/docs/writing_support_code/hooks/README.md](./features/docs/writing_support_code/hooks/README.md).

features/docs/api/listen_for_events.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Feature: Listen for events
1717
"""
1818
And a file named "features/support/my_listener.rb" with:
1919
"""
20-
AfterConfiguration do |config|
20+
InstallPlugin do |config|
2121
io = config.out_stream
2222
config.on_event :step_activated do |event|
2323
io.puts "Success!"
@@ -44,7 +44,7 @@ Feature: Listen for events
4444
And the standard step definitions
4545
And a file named "features/support/my_listener.rb" with:
4646
"""
47-
AfterConfiguration do |config|
47+
InstallPlugin do |config|
4848
io = config.out_stream
4949
config.on_event :test_step_finished do |event|
5050
io.puts event.result.passed?

features/docs/events/gherkin_source_read_event.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Feature: Gherkin Source Read Event
2020
"""
2121
And a file named "features/support/events.rb" with:
2222
"""
23-
AfterConfiguration do |config|
23+
InstallPlugin do |config|
2424
config.on_event :gherkin_source_read do |event|
2525
config.out_stream.puts "path: #{event.path}"
2626
config.out_stream.puts "body:\n#{event.body}"

features/docs/events/step_activated_event.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Feature: Step Activated Event
2020
"""
2121
And a file named "features/support/events.rb" with:
2222
"""
23-
AfterConfiguration do |config|
23+
InstallPlugin do |config|
2424
config.on_event :step_activated do |event|
2525
config.out_stream.puts "The step: #{event.test_step.location}"
2626
config.out_stream.puts "The step definition: #{event.step_match.location}"

features/docs/events/step_definition_registered_event.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Feature: Step definition registered
1515
"""
1616
And a file named "features/support/events.rb" with:
1717
"""
18-
AfterConfiguration do |config|
18+
InstallPlugin do |config|
1919
config.on_event :step_definition_registered do |event|
2020
config.out_stream.puts "The step definition: #{event.step_definition.location}"
2121
end

features/docs/events/test_case_finished_event.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Feature: Test Case Finished Event
22

3-
This event is fired after each scenario or examples table row (generally named a
4-
Test Case) has finished executing. You can use the event to learn about the
3+
This event is fired after each scenario or examples table row (generally named a
4+
Test Case) has finished executing. You can use the event to learn about the
55
result of the test case.
66

77
See [the API documentation](http://www.rubydoc.info/github/cucumber/cucumber-ruby/Cucumber/Events/TestCaseFinished) for more information about the data available on this event.
@@ -16,7 +16,7 @@ Feature: Test Case Finished Event
1616
"""
1717
And a file named "features/support/events.rb" with:
1818
"""
19-
AfterConfiguration do |config|
19+
InstallPlugin do |config|
2020
config.on_event :test_case_finished do |event|
2121
config.out_stream.puts "Results"
2222
config.out_stream.puts "-------"

features/docs/events/test_case_started_event.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Feature: Test Case Started Event
1919
And a file named "features/support/events.rb" with:
2020
"""
2121
stdout = nil
22-
AfterConfiguration do |config|
22+
InstallPlugin do |config|
2323
stdout = config.out_stream # make sure all the `puts` calls can write to the same output
2424
config.on_event :test_case_started do |event|
2525
stdout.puts "before"
@@ -30,7 +30,7 @@ Feature: Test Case Started Event
3030
end
3131
end
3232
33-
Given(/this is a step/) do
33+
Given(/this is a step/) do
3434
end
3535
3636
"""
@@ -44,7 +44,7 @@ Feature: Test Case Started Event
4444
@scenario
4545
@feature
4646
Feature: A feature
47-
47+
4848
@scenario
4949
Scenario: A passing scenario
5050
Given this is a step

features/docs/events/test_run_started_event.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Feature: Test Run Started Event
2121
"""
2222
And a file named "features/support/events.rb" with:
2323
"""
24-
AfterConfiguration do |config|
24+
InstallPlugin do |config|
2525
config.on_event :test_run_started do |event|
2626
config.out_stream.puts "test run started"
2727
config.out_stream.puts event.test_cases.map(&:location)

features/docs/events/test_step_finished_event.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Feature: Test Step Finished Event
22

3-
This event is fired after each step in a scenario or scenario outline example
4-
(generally named a Test Step) has finished executing. You can use the event to learn about the
3+
This event is fired after each step in a scenario or scenario outline example
4+
(generally named a Test Step) has finished executing. You can use the event to learn about the
55
result of the test step.
66

77
See [the API documentation](http://www.rubydoc.info/github/cucumber/cucumber-ruby/Cucumber/Events/TestStepFinished) for more information about the data available on this event and the result object.
@@ -22,7 +22,7 @@ Feature: Test Step Finished Event
2222
"""
2323
And a file named "features/support/events.rb" with:
2424
"""
25-
AfterConfiguration do |config|
25+
InstallPlugin do |config|
2626
config.on_event :test_step_finished do |event|
2727
config.out_stream.puts "Test step: #{event.test_step}"
2828
config.out_stream.puts "The result is: #{event.result}"

0 commit comments

Comments
 (0)