cucumber-core 11.1.0 → 13.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77d6adff3297c714ad2fb6540ab3543055573e60384202a70397cd2107199f70
4
- data.tar.gz: 8bc40c9d9ce7a710648f18de73b00f4c97d82c66e5736cecf82264a4c2377a46
3
+ metadata.gz: 8be25fb56be8e8108a968aaf270b1e296df496b660a5d8536bb1c7cfe3e74359
4
+ data.tar.gz: e08583f1d1cfabd07ed42fb58ec6c0b4f3361d7b0c90286f29d26dbfd8bfb918
5
5
  SHA512:
6
- metadata.gz: 0677a26978ed5a6a8688fe06e63cf8f3a5ca5aa71067332331f4682afd6349fd8acdf7b8525b815d276e7113029e10d11f08aa3725b49bd0081828f99a4b0a8f
7
- data.tar.gz: 0516ef912bd9a1562c8d399aa1b68574a88cbae054b9a83c8bc357e03735f431e4e1bf9e37cc7acf1c31361e356ebb9611c0e98f07b59f5631e719d79ddc6af7
6
+ metadata.gz: 1ad8d22710c9bff29cc1a4ab1a3d5cc41a4a10325aa25accdcde0a833489d4a0a6a98d9415452868551e312bc7672063ba89bf5f3929bc1448384c253a69768b
7
+ data.tar.gz: 14437bb84b31edf7bbad45cf1575770e90b907ccff5d284b89cb7b42aa9f3f5197f812a02dd762b3e121044dab6bc0a6fc4ecf322548267e56c8c7298b35e7c8
data/CHANGELOG.md CHANGED
@@ -1,278 +1,55 @@
1
1
  # Changelog
2
2
 
3
- ## [Unreleased]
4
-
5
- ## [11.1.0] - 2022-12-22
6
- ### Changed
7
- - Update gherkin and messsages dependencies
8
-
9
- ### Fixed
10
- - Restore support for matching a scenario by tag and step line numbers. ([#237](https://github.com/cucumber/cucumber-ruby-core/pull/237), [#238](https://github.com/cucumber/cucumber-ruby-core/pull/238), [#239](https://github.com/cucumber/cucumber-ruby-core/pull/239))
11
-
12
- ## [11.0.0]
13
- ### Changed
14
- - Updated `cucumber-gherkin` and `cucumber-messages`
3
+ All notable changes to this project will be documented in this file.
15
4
 
16
- ## [10.1.1]
17
- ### Changed
18
- - Patched `cucumber-tag-expressions`
5
+ This project adheres to [Semantic Versioning](http://semver.org).
19
6
 
20
- ## [10.1.0]
21
- ### Changed
22
- - Patched `cucumber-gherkin`, `cucumber-messages` and `cucumber-tag-expressions`
7
+ This document is formatted according to the principles of [Keep A CHANGELOG](http://keepachangelog.com).
23
8
 
24
- ## [10.0.1]
25
- ### Changed
26
- - Patched `cucumber-gherkin` and `cucumber-messages`
27
-
28
- ## [10.0.0]
29
- ### Changed
30
- - Upgraded to gherkin v20 and messages v17.
9
+ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) for more info on how to contribute to Cucumber.
31
10
 
32
- ## [9.0.1]
33
- ### Fixed
34
- - Skipped scenarios do not affect anymore status of flaky scenarios on retry
35
- ([#218](https://github.com/cucumber/cucumber-ruby-core/pull/218) @eduardrudko)
11
+ ## [Unreleased]
36
12
 
37
- ## [9.0.0]
13
+ ## [13.0.0] - 2023-12-05
38
14
  ### Changed
39
- - Upgraded to gherkin v18 and messages v15
40
- - Updated other dependencies (look at the diff for details)
15
+ - Now using a 2-tiered changelog to avoid any bugs when using polyglot-release
16
+ - More refactoring of the repo by fixing up a bunch of manual rubocop offenses (See PR's for details)
17
+ ([#259](https://github.com/cucumber/cucumber-ruby-core/pull/259) [#262](https://github.com/cucumber/cucumber-ruby-core/pull/262) [#268](https://github.com/cucumber/cucumber-ruby-core/pull/268) [#274](https://github.com/cucumber/cucumber-ruby-core/pull/274))
18
+ - In all `Summary` and `Result` classes, changed the `strict` argument into a keyword argument
19
+ See upgrading notes for [13.0.0.md](upgrading_notes/13.0.0.md#upgrading-to-1300)
20
+ ([#261](https://github.com/cucumber/cucumber-ruby-core/pull/261))
21
+ - Permit usage of gherkin v27
41
22
 
42
- ## [8.0.1]
43
23
  ### Fixed
44
- - Make releases from docker using secrets from keybase
45
-
46
- ## [8.0.0]
47
- ### Changed
48
- - Updated dependencies (look at the diff for details)
49
-
50
- ## [7.1.0]
51
- ### Changed
52
- - Updated gems:
53
- - `cucumber-gherkin` ~> 14.0.1
54
- - `cucumber-messages` ~> 12.2.0
55
-
56
- ## [7.0.0]
57
- ### Changed
58
- - Updated monorepo libraries:
59
- - cucumber-gherkin ~> 13
60
- - cucumber-messages ~> 12
61
-
62
- ## [6.0.0]
63
- ### Added
64
- - Add `envelope` event, which are used when emitting `Cucumber::Messages`
65
- - Add `TestCaseCreated` and `TestStepCreated` events, emitted when compiling a `Pickle`
66
- - Add `Id` field to `TestCase` and `TestStep`
67
- - Added rubocop (with todo file), and removed backports gems
68
- ([#186](https://github.com/cucumber/cucumber-ruby-core/pull/186),
69
- [#182](https://github.com/cucumber/cucumber-ruby-core/issues/182)
70
- [tas50](https://github.com/tas50),
71
- [luke-hill](https://github.com/luke-hill))
72
-
73
- ### Changed
74
- - Update to Gherkin 10
24
+ - Restore support for matching a scenario by its Feature, Background, and Rule line numbers ([#247](https://github.com/cucumber/cucumber-ruby-core/pull/247))
75
25
 
76
26
  ### Removed
77
- - Remove location for MultiLine arguments
27
+ - Remove legacy `unindent` gem (Now no longer required since Ruby 2.3 and Squiggly heredocs) ([#278](https://github.com/cucumber/cucumber-ruby-core/pull/278))
78
28
 
79
- ## [5.0.2]
29
+ ## [12.0.0] - 2023-09-06
80
30
  ### Changed
81
- - Update to use Gherkin v8
31
+ - Update gherkin and messages minimum dependencies
32
+ - Added in new rubocop sub-gems for testing, pinning versions where appropriate
33
+ - Removed all redundant / incorrect rubocop config overrides (Placed in TODO file)
34
+ - Began to refactor the repo by initially fixing up a bunch of rubocop auto-fix offenses (See PRs for details)
35
+ ([#257](https://github.com/cucumber/cucumber-ruby-core/pull/257) [#258](https://github.com/cucumber/cucumber-ruby-core/pull/258))
82
36
 
83
- ## [5.0.1]
84
37
  ### Removed
85
- - Remove support for ruby 2.2 and below. 2.3 or higher is required now.
86
-
87
- ## [5.0.0]
88
- ### Changed
89
- - Update to use Gherkin v7
38
+ - Remove support for ruby 2.4 and below. 2.5 or higher is required now
90
39
 
91
- ## [4.0.0]
40
+ ## [11.1.0] - 2022-12-22
92
41
  ### Changed
93
- - Update to use Gherkin v6 ([#158](https://github.com/cucumber/cucumber-ruby-core/pull/158) @brasmusson)
94
- - Let Scenarios with no Steps get the result status Undefined ([#157](https://github.com/cucumber/cucumber-ruby-core/pull/157) @brasmusson)
95
- - Convert to use the Gherkin compiler and Pickles ([#156](https://github.com/cucumber/cucumber-ruby-core/pull/156) @brasmusson)
42
+ - Update gherkin and messages dependencies
96
43
 
97
- ### Removed
98
- - Remove the support for old style tag expressions ([#159](https://github.com/cucumber/cucumber-ruby-core/pull/159) @brasmusson)
99
-
100
- ## [3.2.1]
101
44
  ### Fixed
102
- - Switched `gherkin` in Gemspec to use _pessimistic_ versioning. (These two commits aren't merged into `master`, as they already exist in newer commits. This is a 'backported' patch to resolve [#160](https://github.com/cucumber/cucumber-ruby-core/issues/160)).
103
-
104
- ## [3.2.0]
105
- ### Added
106
- - Add the GherkinSourceParsedEvent ([#155](https://github.com/cucumber/cucumber-ruby-core/pull/155) @brasmusson)
107
- - Add #original_location to Cucumber::Core::Ast::Step and Cucumber::Core::Test::Step ([#150](https://github.com/cucumber/cucumber-ruby-core/pull/150), [#149](https://github.com/cucumber/cucumber-ruby-core/issues/149) @brasmusson)
108
-
109
- ### Fixed
110
- - Set message and backtrace for undefined result also when skipping (@brasmusson)
111
-
112
- ## [3.1.0]
113
- ### Changed
114
- - Upgraded to `cucumber-tag_expressions` 1.1.0
115
- - Upgraded to `gherkin` 5.0.0
116
-
117
- ## [3.0.0]
118
- ### Added
119
- - Do not create test cases for scenarios with no steps ([#144](https://github.com/cucumber/cucumber-ruby-core/pull/144) @brasmusson)
120
- - Handle selective strict settings ([#143](https://github.com/cucumber/cucumber-ruby-core/pull/143) @brasmusson)
45
+ - Restore support for matching a scenario by tag and step line numbers. ([#237](https://github.com/cucumber/cucumber-ruby-core/pull/237), [#238](https://github.com/cucumber/cucumber-ruby-core/pull/238), [#239](https://github.com/cucumber/cucumber-ruby-core/pull/239))
121
46
 
47
+ ## [11.0.0] - 2022-05-18
122
48
  ### Changed
123
- - Step#name renamed to #text ([#137](https://github.com/cucumber/cucumber-ruby-core/pull/137) [@olleolleolle](https://github.com/olleolleolle))
124
- - Use past tense in event names (`xStarting` -> `xStarted`) (see [cucumber/cucumber-ruby#1166](https://github.com/cucumber/cucumber-ruby/issues/1166) @brasmusson).
125
-
126
- ### Fixed
127
- - Fix DataTable's Location to be aware of all of its lines ([#142](https://github.com/cucumber/cucumber-ruby-core/pull/142) @botandrose)
128
- - As per [#251](https://github.com/cucumber/cucumber/issues/251): renamed History.md to CHANGELOG.md, added contributing message at beginning, and misc formatting. ([#145](https://github.com/cucumber/cucumber-ruby-core/pull/145) [jaysonesmith](https://github.com/jaysonesmith))
129
-
130
- ## [3.0.0.pre.2]
131
- ### Added
132
- - Add a flaky result type to be used for flaky scenarios ([#141](https://github.com/cucumber/cucumber-ruby-core/pull/141), [cucumber/cucumber-ruby#1044](https://github.com/cucumber/cucumber-ruby/issues/1044) @brasmusson)
133
- - Make the Summary report able to say if the total result is ok ([#140](https://github.com/cucumber/cucumber-ruby-core/pull/140) @brasmusson)
134
- - Replay previous events to new subscribers ([#136](https://github.com/cucumber/cucumber-ruby-core/pull/136) @mattwynne)
135
- - Ruby 2.4.0 compatibility ([#120](https://github.com/cucumber/cucumber-ruby-core/pull/120) @junaruga)
136
- - Use tag expressions ([#116](https://github.com/cucumber/cucumber-ruby-core/pull/116) @brasmusson)
137
- - Access example table row data by param name ([#118](https://github.com/cucumber/cucumber-ruby-core/pull/118) @enkessler)
138
-
139
- ### Fixed
140
- - Travis: jruby-9.1.10.0 ([#130](https://github.com/cucumber/cucumber-ruby-core/pull/130) @olleolleolle)
141
- - Travis: jruby-9.1.12.0 ([#133](https://github.com/cucumber/cucumber-ruby-core/pull/132) @olleolleolle)
142
-
143
- ## [2.0.0]
144
- ### Added
145
- - Implement equality for test cases ([#111](https://github.com/cucumber/cucumber-ruby-core/pull/111) @mattwynne)
146
- - Implement an event bus (moved from Cucumber-Ruby) ([#106](https://github.com/cucumber/cucumber-ruby-core/pull/106) @mattwynne)
147
- - Use frozen string literals ([#105](https://github.com/cucumber/cucumber-ruby-core/pull/105) @twalpole)
148
-
149
- ### Fixed
150
- - Handle incomplete examples to scenario outlines. ([109](https://github.com/cucumber/cucumber-ruby-core/pull/109) @brasmusson)
151
- - Add with_filtered_backtrace method to unknown result ([107](https://github.com/cucumber/cucumber-ruby-core/pull/107) @danascheider)
152
-
153
- ### Removed
154
- - Remove support for Ruby v1.9.3. ([112](https://github.com/cucumber/cucumber-ruby-core/pull/112) @brasmusson)
155
-
156
- ## [1.5.0]
157
- ### Added
158
- - Update to Gherkin v4.0 (@brasmusson)
159
-
160
- ### Fixed
161
- - Use monotonic time ([#103](https://github.com/cucumber/cucumber-ruby-core/pull/103) @mikz)
162
-
163
- ## [1.4.0]
164
- ### Added
165
- - Update to Gherkin v3.2.0 (@brasmusson)
166
-
167
- ### Fixed
168
-
169
- ## [1.3.1]
170
- ### Added
171
-
172
- ### Fixed
173
- - Speed up location filtering ([#99](https://github.com/cucumber/cucumber-ruby-core/issues/99) @mattwynne @akostadinov @brasmusson)
174
-
175
- ## [1.3.0]
176
- ### Added
177
- - Add factory method to Cucumber::Core::Ast::Location that uses the output from Proc#source_location (@brasmusson)
178
- - Integrate Gherkin3 parser (@brasmusson)
179
-
180
- ### Fixed
181
- - Make sure that `after_test_step` is sent also when a test step is interrupted by (a timeout in) an around hook ([cucumber/cucumber-ruby#909](https://github.com/cucumber/cucumber-ruby/issues/909) @brasmusson)
182
- - Improve the check that a test_step quacks like a Cucumber::Core::Test::Step ([95](https://github.com/cucumber/cucumber-ruby-core/issues/95) @brasmusson)
183
-
184
- ## [1.2.0]
185
- ### Added
186
- - Enable the location of actions to be the step or hook location (@brasmusson)
187
- - Add the comments to the Steps, Examples tables and Examples table rows Ast classes (@brasmusson)
188
- - Expose name, description and examples_rows attributes of `Ast::ExamplesTable` (@mattwynne)
189
- - Add #to_sym to Cucumber::Core::Test::Result classes ([#89](https://github.com/cucumber/cucumber-ruby-core/pull/89) @pdswan)
190
- - Add #ok? to Cucumber::Core::Test::Result classes ([#92](https://github.com/cucumber/cucumber-ruby-core/pull/92) @brasmusson)
191
-
192
- ### Fixed
193
-
194
- ## [1.1.3]
195
- ### Added
196
- - Added custom `inspect` methods for AST Nodes (@tooky)
197
-
198
- ## [1.1.2]
199
- ### Added
200
- - Make Test Case names for Scenario Outlines language neutral [83](https://github.com/cucumber/cucumber-ruby-core/pull/83) (@brasmusson)
201
- - Add predicate methods for Multline arguments (@mattwynne)
202
- - Expose `Test::Case#feature` (@mattwynne)
203
- - Fail test case if around hook fails (@mattwynne, @tooky)
204
- - Expose `Test::Case#around_hooks` (@tooky)
205
-
206
- ## [1.1.1]
207
- ### Added
208
- - Calculate actual keyword for snippets (@brasmusson)
209
-
210
- ### Fixed
211
- - Remove keyword from `Test::Case#name` [82](https://github.com/cucumber/cucumber-ruby-core/pull/82) (@richarda)
212
-
213
- ## [1.1.0]
214
- ### Added
215
- - LocationsFilter now sorts test cases as well as filtering them (@mattwynne)
216
-
217
- ## [1.0.0]
218
- ### Added
219
- - Added dynamic filter class constructor (@mattwynne)
220
-
221
- ## [1.0.0.beta.4]
222
- ### Added
223
- - Introduce a Duration object (#[71](https://github.com/cucumber/cucumber-ruby-core/pull/71) [@brasmusson](https://github.com/brasmusson))
224
- - BeforeStep hooks (#[70](https://github.com/cucumber/cucumber-ruby-core/pull/70) [@almostwhitehat](https://github.com/almostwhitehat))
225
- - Expose `Test::Case#test_steps` (@mattwynne)
226
-
227
- ### Fixed
228
- - Handle empty feature files (#[77](https://github.com/cucumber/cucumber-ruby-core/pull/77), [cucumber/cucumber-ruby#771](https://github.com/cucumber/cucumber-ruby/issues/771) [@brasmusson](https://github.com/brasmusson))
229
- - Run after hooks in reverse order (#[69](https://github.com/cucumber/cucumber-ruby-core/pull/69) [@erran](https://github.com/erran))
230
-
231
- ## [1.0.0.beta.3]
232
-
233
- ## [1.0.0.beta.2]
234
-
235
- ## [1.0.0.beta.3]
236
-
237
- ## [1.0.0.beta.2]
49
+ - Updated `cucumber-gherkin` and `cucumber-messages`
238
50
 
239
- [Unreleased]: https://github.com/cucumber/cucumber-ruby-core/compare/v10.1.1...main
240
- [11.1.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v10.1.1...main
51
+ [Unreleased]: https://github.com/cucumber/cucumber-ruby-core/compare/v13.0.0...HEAD
52
+ [13.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v12.0.0...v13.0.0
53
+ [12.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v11.1.0...v12.0.0
54
+ [11.1.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v11.0.0...v11.1.0
241
55
  [11.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v10.1.1...v11.0.0
242
- [10.1.1]: https://github.com/cucumber/cucumber-ruby-core/compare/v10.1.0...v10.1.1
243
- [10.1.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v10.0.1...v10.1.0
244
- [10.0.1]: https://github.com/cucumber/cucumber-ruby-core/compare/v10.0.0...v10.0.1
245
- [10.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v9.0.1...v10.0.0
246
- [9.0.1]: https://github.com/cucumber/cucumber-ruby-core/compare/v9.0.0...v9.0.1
247
- [9.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v8.0.1...v9.0.0
248
- [8.0.1]: https://github.com/cucumber/cucumber-ruby-core/compare/v8.0.0...v8.0.1
249
- [8.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v7.1.0...v8.0.0
250
- [7.1.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v7.0.0...v7.1.0
251
- [7.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v6.0.0...v7.0.0
252
- [6.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v5.0.2...v6.0.0
253
- [5.0.2]: https://github.com/cucumber/cucumber-ruby-core/compare/v5.0.1...v5.0.2
254
- [5.0.1]: https://github.com/cucumber/cucumber-ruby-core/compare/v5.0.0...v5.0.1
255
- [5.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v4.0.0...v5.0.0
256
- [4.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v3.2.0...v4.0.0
257
- [3.2.1]: https://github.com/cucumber/cucumber-ruby-core/compare/v3.2.0...v3.2.1
258
- [3.2.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v3.1.0...v3.2.0
259
- [3.1.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v3.0.0...3.1.0
260
- [3.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v3.0.0.pre.2...v3.0.0
261
- [3.0.0.pre.2]: https://github.com/cucumber/cucumber-ruby-core/compare/v2.0.0...3.0.0.pre.2
262
- [2.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.5.0...2.0.0
263
- [1.5.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.4.0...v1.5.0
264
- [1.4.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.3.1...v1.4.0
265
- [1.3.1]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.3.0...v1.3.1
266
- [1.3.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.2.0...v1.3.0
267
- [1.2.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.1.3...v1.2.0
268
- [1.1.3]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.1.2...v1.1.3
269
- [1.1.2]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.1.1...v1.1.2
270
- [1.1.1]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.1.0...v1.1.1
271
- [1.1.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.0.0...v1.1.0
272
- [1.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.0.0.beta.4...v1.0.0
273
- [1.0.0.beta.4]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.0.0.beta.3...v1.0.0.beta.4
274
- [1.0.0.beta.3]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.0.0.beta.2...v1.0.0.beta.3
275
- [1.0.0.beta.2]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.0.0.beta.1...v1.0.0.beta.2
276
- [1.0.0.beta.3]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.0.0.beta.2...v1.0.0.beta.3
277
- [1.0.0.beta.2]: https://github.com/cucumber/cucumber-ruby-core/compare/v1.0.0.beta.1...v1.0.0.beta.2
278
- ore/compare/v10.1.1...main
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  [![OpenCollective](https://opencollective.com/cucumber/sponsors/badge.svg)](https://opencollective.com/cucumber)
9
9
  [![pull requests](https://oselvar.com/api/badge?label=pull%20requests&csvUrl=https%3A%2F%2Fraw.githubusercontent.com%2Fcucumber%2Foselvar-github-metrics%2Fmain%2Fdata%2Fcucumber%2Fcucumber-ruby-core%2FpullRequests.csv)](https://oselvar.com/github/cucumber/oselvar-github-metrics/main/cucumber/cucumber-ruby-core)
10
10
  [![issues](https://oselvar.com/api/badge?label=issues&csvUrl=https%3A%2F%2Fraw.githubusercontent.com%2Fcucumber%2Foselvar-github-metrics%2Fmain%2Fdata%2Fcucumber%2Fcucumber-ruby-core%2Fissues.csv)](https://oselvar.com/github/cucumber/oselvar-github-metrics/main/cucumber/cucumber-ruby-core)
11
- [![Test cucumber-core](https://github.com/cucumber/cucumber-ruby-core/actions/workflows/cucumber-ruby-core.yml/badge.svg)](https://github.com/cucumber/cucumber-ruby-core/actions/workflows/cucumber-ruby-core.yml)
11
+ [![Test cucumber-core](https://github.com/cucumber/cucumber-ruby-core/actions/workflows/test.yml/badge.svg)](https://github.com/cucumber/cucumber-ruby-core/actions/workflows/test.yml)
12
12
  [![Code Climate](https://codeclimate.com/github/cucumber/cucumber-ruby-core.svg)](https://codeclimate.com/github/cucumber/cucumber-ruby-core)
13
13
 
14
14
  Cucumber is a tool for running automated tests written in plain language. Because they're
@@ -50,12 +50,13 @@ or install the gem directly:
50
50
 
51
51
  ### Supported platforms
52
52
 
53
+ - Ruby 3.2
54
+ - Ruby 3.1
53
55
  - Ruby 3.0
54
56
  - Ruby 2.7
55
57
  - Ruby 2.6
56
58
  - Ruby 2.5
57
59
  - Ruby 2.4
58
- - Ruby 2.3
59
60
  - JRuby 9.2 (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/main/docs/jruby-limitations.md))
60
61
 
61
62
  ## Usage
@@ -37,17 +37,18 @@ module Cucumber
37
37
  def create_test_case(pickle)
38
38
  uri = pickle.uri
39
39
  test_steps = pickle.steps.map { |step| create_test_step(step, uri) }
40
- lines = source_lines_for_pickle(pickle).sort.reverse
41
- tags = pickle.tags.map { |tag| Test::Tag.new(Test::Location.new(uri, source_line_for_pickle_tag(tag)), tag.name) }
42
- test_case = Test::Case.new(id_generator.new_id, pickle.name, test_steps, Test::Location.new(uri, lines), tags, pickle.language)
40
+ location = location_from_pickle(pickle)
41
+ parent_locations = parent_locations_from_pickle(pickle)
42
+ tags = tags_from_pickle(pickle, uri)
43
+ test_case = Test::Case.new(id_generator.new_id, pickle.name, test_steps, location, parent_locations, tags, pickle.language)
43
44
  @event_bus&.test_case_created(test_case, pickle)
44
45
  test_case
45
46
  end
46
47
 
47
48
  def create_test_step(pickle_step, uri)
48
- lines = source_lines_for_pickle_step(pickle_step).sort.reverse
49
+ location = location_from_pickle_step(pickle_step, uri)
49
50
  multiline_arg = create_multiline_arg(pickle_step, uri)
50
- step = Test::Step.new(id_generator.new_id, pickle_step.text, Test::Location.new(uri, lines), multiline_arg)
51
+ step = Test::Step.new(id_generator.new_id, pickle_step.text, location, multiline_arg)
51
52
  @event_bus&.test_step_created(step, pickle_step)
52
53
  step
53
54
  end
@@ -55,37 +56,57 @@ module Cucumber
55
56
  def create_multiline_arg(pickle_step, _uri)
56
57
  if pickle_step.argument
57
58
  if pickle_step.argument.doc_string
58
- doc_string = pickle_step.argument.doc_string
59
- Test::DocString.new(
60
- doc_string.content,
61
- doc_string.media_type
62
- )
59
+ doc_string_from_pickle_step(pickle_step)
63
60
  elsif pickle_step.argument.data_table
64
- data_table = pickle_step.argument.data_table
65
- Test::DataTable.new(
66
- data_table.rows.map { |row| row.cells.map { |cell| cell.value } }
67
- )
61
+ data_table_from_pickle_step(pickle_step)
68
62
  end
69
63
  else
70
64
  Test::EmptyMultilineArgument.new
71
65
  end
72
66
  end
73
67
 
74
- def source_lines_for_pickle(pickle)
75
- pickle.ast_node_ids.map { |id| source_line(id) }
68
+ def location_from_pickle(pickle)
69
+ lines = pickle.ast_node_ids.map { |id| source_line(id) }
70
+ Test::Location.new(pickle.uri, lines.sort.reverse)
76
71
  end
77
72
 
78
- def source_lines_for_pickle_step(pickle_step)
79
- pickle_step.ast_node_ids.map { |id| source_line(id) }
73
+ def parent_locations_from_pickle(pickle)
74
+ parent_lines = gherkin_query.scenario_parent_locations(pickle.ast_node_ids[0]).map(&:line)
75
+ Test::Location.new(pickle.uri, parent_lines)
80
76
  end
81
77
 
82
- def source_line_for_pickle_tag(tag)
83
- source_line(tag.ast_node_id)
78
+ def location_from_pickle_step(pickle_step, uri)
79
+ lines = pickle_step.ast_node_ids.map { |id| source_line(id) }
80
+ Test::Location.new(uri, lines.sort.reverse)
81
+ end
82
+
83
+ def tags_from_pickle(pickle, uri)
84
+ pickle.tags.map do |tag|
85
+ location = Test::Location.new(uri, source_line(tag.ast_node_id))
86
+ Test::Tag.new(location, tag.name)
87
+ end
84
88
  end
85
89
 
86
90
  def source_line(id)
87
91
  gherkin_query.location(id).line
88
92
  end
93
+
94
+ def doc_string_from_pickle_step(pickle_step)
95
+ doc_string = pickle_step.argument.doc_string
96
+ Test::DocString.new(
97
+ doc_string.content,
98
+ doc_string.media_type
99
+ )
100
+ end
101
+
102
+ def data_table_from_pickle_step(pickle_step)
103
+ data_table = pickle_step.argument.data_table
104
+ Test::DataTable.new(
105
+ data_table.rows.map do |row|
106
+ row.cells.map(&:value)
107
+ end
108
+ )
109
+ end
89
110
  end
90
111
  end
91
112
  end
@@ -1,61 +1,60 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Cucumber
2
4
  module Core
3
5
  class Event
4
-
5
6
  # Macro to generate new sub-classes of {Event} with
6
7
  # attribute readers.
7
- def self.new(*attributes)
8
+ def self.new(*events)
8
9
  # Use normal constructor for subclasses of Event
9
- return super if self.ancestors.index(Event) > 0
10
+ return super if ancestors.index(Event) > 0
10
11
 
11
12
  Class.new(Event) do
12
- attr_reader(*attributes)
13
-
14
- define_method(:initialize) do |*args|
15
- attributes.zip(args) do |name, value|
16
- instance_variable_set "@#{name}".to_sym, value
13
+ # NB: We need to use metaprogramming here instead of direct variable obtainment
14
+ # because JRuby does not guarantee the order in which variables are defined is equivalent
15
+ # to the order in which they are obtainable
16
+ #
17
+ # See https://github.com/jruby/jruby/issues/7988 for more info
18
+ attr_reader(*events)
19
+
20
+ define_method(:initialize) do |*attributes|
21
+ events.zip(attributes) do |name, value|
22
+ instance_variable_set("@#{name}".to_sym, value)
17
23
  end
18
24
  end
19
25
 
20
26
  define_method(:attributes) do
21
- attributes.map { |attribute| self.send(attribute) }
27
+ events.map { |var| instance_variable_get(:"@#{var}") }
22
28
  end
23
29
 
24
30
  define_method(:to_h) do
25
- attributes.reduce({}) { |result, attribute|
26
- value = self.send(attribute)
27
- result[attribute] = value
28
- result
29
- }
31
+ events.zip(attributes).to_h
30
32
  end
31
33
 
32
- define_method(:event_id) do
34
+ def event_id
33
35
  self.class.event_id
34
36
  end
35
37
  end
36
38
  end
37
39
 
38
-
39
40
  class << self
40
-
41
- # @return [Symbol] the underscored name of the class to be used
42
- #  as the key in an event registry.
41
+ # @return [Symbol] the underscored name of the class to be used as the key in an event registry
43
42
  def event_id
44
- underscore(self.name.split("::").last).to_sym
43
+ underscore(name.split('::').last).to_sym
45
44
  end
46
45
 
47
46
  private
48
47
 
49
48
  def underscore(string)
50
- string.to_s.gsub(/::/, '/').
51
- gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
52
- gsub(/([a-z\d])([A-Z])/, '\1_\2').
53
- tr("-", "_").
54
- downcase
49
+ string
50
+ .to_s
51
+ .gsub('::', '/').
52
+ gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
53
+ gsub(/([a-z\d])([A-Z])/, '\1_\2').
54
+ tr('-', '_').
55
+ downcase
55
56
  end
56
-
57
57
  end
58
-
59
58
  end
60
59
  end
61
60
  end
@@ -1,13 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cucumber/core/events'
2
4
 
3
5
  module Cucumber
4
6
  module Core
5
-
6
7
  # Event Bus
7
8
  #
8
9
  # Implements an in-process pub-sub event broadcaster allowing multiple observers
9
10
  # to subscribe to events that fire as your tests are executed.
10
- #
11
11
  class EventBus
12
12
  attr_reader :event_types
13
13
 
@@ -18,8 +18,7 @@ module Cucumber
18
18
  @event_queue = []
19
19
  end
20
20
 
21
- # Register for an event. The handler proc will be called back with each of the attributes
22
- # of the event.
21
+ # Register for an event. The handler proc will be called back with each of the attributes of the event
23
22
  def on(event_id, handler_object = nil, &handler_proc)
24
23
  handler = handler_proc || handler_object
25
24
  validate_handler_and_event_id!(handler, event_id)
@@ -28,9 +27,8 @@ module Cucumber
28
27
  broadcast_queued_events_to handler, event_class
29
28
  end
30
29
 
31
- # Broadcast an event
32
30
  def broadcast(event)
33
- raise ArgumentError, "Event type #{event.class} is not registered. Try one of these:\n#{event_types.values.join("\n")}" unless is_registered_type?(event.class)
31
+ raise ArgumentError, "Event type #{event.class} is not registered. Try one of these:\n#{event_types.values.join("\n")}" unless registered_type?(event.class)
34
32
  handlers_for(event.class).each { |handler| handler.call(event) }
35
33
  @event_queue << event
36
34
  end
@@ -40,34 +38,33 @@ module Cucumber
40
38
  broadcast event_class.new(*args)
41
39
  end
42
40
 
41
+ def respond_to_missing?(event_id, *args)
42
+ event_types.key?(event_id) || super
43
+ end
44
+
43
45
  private
44
46
 
45
47
  def broadcast_queued_events_to(handler, event_type)
46
- @event_queue.select { |event|
47
- event.instance_of?(event_type)
48
- }.each { |event|
49
- handler.call(event)
50
- }
48
+ @event_queue.select { |event| event.instance_of?(event_type) }.each { |event| handler.call(event) }
51
49
  end
52
50
 
53
51
  def handlers_for(event_class)
54
52
  @handlers[event_class.to_s] ||= []
55
53
  end
56
54
 
57
- def is_registered_id?(event_id)
58
- event_types.keys.include?(event_id)
55
+ def registered_type?(event_type)
56
+ event_types.values.include?(event_type)
59
57
  end
60
58
 
61
- def is_registered_type?(event_type)
62
- event_types.values.include?(event_type)
59
+ def registered_id?(event_id)
60
+ event_types.keys.include?(event_id)
63
61
  end
64
62
 
65
63
  def validate_handler_and_event_id!(handler, event_id)
66
- raise ArgumentError, "Please pass either an object or a handler block" unless handler
67
- raise ArgumentError, "Please use a symbol for the event_id" unless event_id.is_a?(Symbol)
68
- raise ArgumentError, "Event ID #{event_id} is not recognised. Try one of these:\n#{event_types.keys.join("\n")}" unless is_registered_id?(event_id)
64
+ raise ArgumentError, 'Please pass either an object or a handler block' unless handler
65
+ raise ArgumentError, 'Please use a symbol for the event_id' unless event_id.is_a?(Symbol)
66
+ raise ArgumentError, "Event ID #{event_id} is not recognised. Try one of these:\n#{event_types.keys.join("\n")}" unless registered_id?(event_id)
69
67
  end
70
68
  end
71
-
72
69
  end
73
70
  end