Skip to content

Commit f99b285

Browse files
authored
Bugfix/cck conformance fix (#1756)
* Pin CCK to passing version * Add new steps * Spike solution for loading files from cck * Remove env.rb - add note about bloat of errors checking being 200+ blank objects * Use path in gem proper for assets * Remove legacy duplicated assets and DRY up path ref * Remove duplicate assets for hooks test * Remove unused retry arguments file * Fix path to hooks assets * Rename of steps files to closer align to ruby conventions * Unrestrict CCK again now fixes are in * Bump CCK to v16 * Remove redundant require call and fix up attachments to be v16 conformant * Bump minimum ruby * Update workflows to ruby 3.0 * Update rubocop to a version to avoid a bug causing execution failure and regenerate TODO * Changelog entries for v10
1 parent d9d6f38 commit f99b285

29 files changed

+73
-127
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
strategy:
2020
matrix:
2121
os: [ubuntu-latest, macos-latest, windows-latest]
22-
ruby: ["2.7", "3.0", "3.1", "3.2"]
22+
ruby: ['3.0', '3.1', '3.2', '3.3']
2323
include:
2424
- os: ubuntu-latest
2525
ruby: jruby-9.4

.github/workflows/rubocop.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ jobs:
1515
- uses: actions/checkout@v4
1616
- uses: ruby/setup-ruby@v1
1717
with:
18-
ruby-version: 2.7
18+
ruby-version: '3.0'
1919
bundler-cache: true
2020
- run: bundle exec rubocop

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
os: [ubuntu-latest, macos-latest, windows-latest]
20-
ruby: ["2.7", "3.0", "3.1", "3.2"]
20+
ruby: ['3.0', '3.1', '3.2', '3.3']
2121
include:
2222
- os: ubuntu-latest
2323
ruby: jruby-9.4

.rubocop.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require:
1313
AllCops:
1414
NewCops: disable
1515
# Keep this inline with the lowest ruby version in the gemspec
16-
TargetRubyVersion: 2.7
16+
TargetRubyVersion: 3.0
1717
# Display cop name / style guide references
1818
DisplayCopNames: true
1919
DisplayStyleGuide: true
@@ -34,13 +34,6 @@ Layout/TrailingWhitespace:
3434
- spec/cucumber/formatter/pretty_spec.rb
3535
- spec/cucumber/formatter/progress_spec.rb
3636

37-
# TODO: [LH] - This needs a re-review. I think we can pretty much delete / phase this out with incremental updates
38-
# We exclude proto_world for documentation (rdoc) purpose
39-
Lint/UselessMethodDefinition:
40-
Enabled: true
41-
Exclude:
42-
- lib/cucumber/glue/proto_world.rb
43-
4437
# Rubocop doesn't like method names in other languages but as Cucumber supports multiple languages, this cop needs to be disabled
4538
Naming/AsciiIdentifiers:
4639
Enabled: false

.rubocop_todo.yml

Lines changed: 33 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,15 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2024-02-01 10:58:34 UTC using RuboCop version 1.56.4.
3+
# on 2024-07-09 14:33:36 UTC using RuboCop version 1.61.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

99
# TODO - [LH] -> Oct '23 - 355 files inspected, 642 offenses detected, 205 offenses autocorrectable
1010
# TODO - [LH] -> Dec '23 - 350 files inspected, 595 offenses detected, 171 offenses autocorrectable
11-
# TODO - [LH] -> Feb '23 - 370 files inspected, 635 offenses detected, 166 offenses autocorrectable
12-
13-
# Offense count: 10
14-
# This cop supports safe autocorrection (--autocorrect).
15-
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
16-
# SupportedHashRocketStyles: key, separator, table
17-
# SupportedColonStyles: key, separator, table
18-
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
19-
Layout/HashAlignment:
20-
Exclude:
21-
- 'lib/cucumber/cli/options.rb'
22-
23-
# Offense count: 19
24-
# This cop supports safe autocorrection (--autocorrect).
25-
# Configuration parameters: AllowInHeredoc.
26-
Layout/TrailingWhitespace:
27-
Exclude:
28-
- 'lib/cucumber/multiline_argument/data_table.rb'
29-
30-
# Offense count: 3
31-
# This cop supports safe autocorrection (--autocorrect).
32-
Lint/AmbiguousOperator:
33-
Exclude:
34-
- 'lib/cucumber/multiline_argument/data_table.rb'
35-
- 'lib/cucumber/running_test_case.rb'
36-
- 'spec/cucumber/formatter/spec_helper.rb'
11+
# TODO - [LH] -> Feb '24 - 370 files inspected, 635 offenses detected, 166 offenses autocorrectable
12+
# TODO - [LH] -> Jul '24 - 370 files inspected, 637 offenses detected, 97 offenses autocorrectable
3713

3814
# Offense count: 4
3915
Lint/RescueException:
@@ -43,6 +19,13 @@ Lint/RescueException:
4319
- 'lib/cucumber/glue/invoke_in_world.rb'
4420
- 'lib/cucumber/glue/proto_world.rb'
4521

22+
# Offense count: 2
23+
# This cop supports unsafe autocorrection (--autocorrect-all).
24+
# Configuration parameters: AutoCorrect.
25+
Lint/UselessMethodDefinition:
26+
Exclude:
27+
- 'lib/cucumber/glue/proto_world.rb'
28+
4629
# Offense count: 60
4730
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
4831
Metrics/AbcSize:
@@ -57,7 +40,7 @@ Metrics/BlockLength:
5740
# Offense count: 13
5841
# Configuration parameters: CountComments, CountAsOne.
5942
Metrics/ClassLength:
60-
Max: 523
43+
Max: 515
6144

6245
# Offense count: 8
6346
# Configuration parameters: AllowedMethods, AllowedPatterns.
@@ -67,9 +50,9 @@ Metrics/CyclomaticComplexity:
6750
# Offense count: 74
6851
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
6952
Metrics/MethodLength:
70-
Max: 72
53+
Max: 64
7154

72-
# Offense count: 17
55+
# Offense count: 16
7356
# Configuration parameters: CountComments, CountAsOne.
7457
Metrics/ModuleLength:
7558
Max: 804
@@ -87,37 +70,14 @@ Naming/FileName:
8770
Exclude:
8871
- 'features/lib/step_definitions/iso-8859-1_steps.rb'
8972

90-
# Offense count: 2
73+
# Offense count: 1
9174
# This cop supports unsafe autocorrection (--autocorrect-all).
9275
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
9376
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
9477
Naming/MemoizedInstanceVariableName:
9578
Exclude:
96-
- 'lib/cucumber/formatter/json.rb'
9779
- 'lib/cucumber/multiline_argument/data_table.rb'
9880

99-
## Offense count: 14
100-
## Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
101-
## AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
102-
#Naming/MethodParameterName:
103-
# Exclude:
104-
# - 'lib/cucumber/cli/options.rb'
105-
# - 'lib/cucumber/formatter/ansicolor.rb'
106-
# - 'lib/cucumber/formatter/console.rb'
107-
# - 'lib/cucumber/gherkin/formatter/ansi_escapes.rb'
108-
# - 'lib/cucumber/multiline_argument/data_table.rb'
109-
110-
# Offense count: 8
111-
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
112-
# SupportedStyles: snake_case, normalcase, non_integer
113-
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
114-
Naming/VariableNumber:
115-
Exclude:
116-
- 'examples/i18n/bg/lib/calculator.rb'
117-
- 'examples/i18n/ru/lib/calculator.rb'
118-
- 'examples/i18n/uk/lib/calculator.rb'
119-
- 'examples/i18n/uz/lib/calculator.rb'
120-
12181
# Offense count: 2
12282
RSpec/AnyInstance:
12383
Exclude:
@@ -130,46 +90,24 @@ RSpec/Capybara/FeatureMethods:
13090
Exclude:
13191
- 'spec/cucumber/filters/activate_steps_spec.rb'
13292

133-
# Offense count: 15
93+
# Offense count: 5
13494
# Configuration parameters: Prefixes, AllowedPatterns.
13595
# Prefixes: when, with, without
13696
RSpec/ContextWording:
13797
Exclude:
138-
- 'spec/cucumber/cli/options_spec.rb'
139-
- 'spec/cucumber/cli/rerun_spec.rb'
140-
- 'spec/cucumber/configuration_spec.rb'
14198
- 'spec/cucumber/filters/tag_limits_spec.rb'
14299
- 'spec/cucumber/formatter/http_io_spec.rb'
143100
- 'spec/cucumber/formatter/junit_spec.rb'
144101
- 'spec/cucumber/formatter/publish_banner_printer_spec.rb'
145-
- 'spec/cucumber/glue/step_definition_spec.rb'
146102
- 'spec/support/shared_context/http_server.rb'
147103

148-
# Offense count: 8
149-
# This cop supports unsafe autocorrection (--autocorrect-all).
150-
# Configuration parameters: SkipBlocks, EnforcedStyle.
151-
# SupportedStyles: described_class, explicit
152-
RSpec/DescribedClass:
153-
Exclude:
154-
- 'spec/cucumber/cli/profile_loader_spec.rb'
155-
- 'spec/cucumber/formatter/json_spec.rb'
156-
- 'spec/cucumber/multiline_argument/data_table_spec.rb'
157-
158104
# Offense count: 2
159105
# This cop supports unsafe autocorrection (--autocorrect-all).
160106
RSpec/EmptyExampleGroup:
161107
Exclude:
162108
- 'spec/cucumber/filters/activate_steps_spec.rb'
163109
- 'spec/cucumber/running_test_case_spec.rb'
164110

165-
# Offense count: 4
166-
# This cop supports safe autocorrection (--autocorrect).
167-
RSpec/EmptyLineAfterFinalLet:
168-
Exclude:
169-
- 'spec/cucumber/cli/main_spec.rb'
170-
- 'spec/cucumber/configuration_spec.rb'
171-
- 'spec/cucumber/hooks_spec.rb'
172-
173111
# Offense count: 82
174112
# Configuration parameters: CountAsOne.
175113
RSpec/ExampleLength:
@@ -201,7 +139,7 @@ RSpec/ExpectOutput:
201139
Exclude:
202140
- 'spec/cucumber/formatter/interceptor_spec.rb'
203141

204-
# Offense count: 62
142+
# Offense count: 61
205143
# This cop supports safe autocorrection (--autocorrect).
206144
# Configuration parameters: EnforcedStyle.
207145
# SupportedStyles: implicit, each, example
@@ -276,23 +214,6 @@ RSpec/RepeatedExampleGroupDescription:
276214
Exclude:
277215
- 'spec/cucumber/glue/proto_world_spec.rb'
278216

279-
# Offense count: 31
280-
# This cop supports safe autocorrection (--autocorrect).
281-
# Configuration parameters: EnforcedStyle.
282-
# SupportedStyles: and_return, block
283-
RSpec/ReturnFromStub:
284-
Exclude:
285-
- 'spec/cucumber/cli/configuration_spec.rb'
286-
- 'spec/cucumber/cli/main_spec.rb'
287-
- 'spec/cucumber/cli/options_spec.rb'
288-
- 'spec/cucumber/cli/profile_loader_spec.rb'
289-
- 'spec/cucumber/cli/rerun_spec.rb'
290-
- 'spec/cucumber/configuration_spec.rb'
291-
- 'spec/cucumber/filters/tag_limits/verifier_spec.rb'
292-
- 'spec/cucumber/formatter/interceptor_spec.rb'
293-
- 'spec/cucumber/formatter/junit_spec.rb'
294-
- 'spec/cucumber/glue/registry_and_more_spec.rb'
295-
296217
# Offense count: 3
297218
# This cop supports safe autocorrection (--autocorrect).
298219
RSpec/ScatteredLet:
@@ -352,6 +273,23 @@ Style/GlobalVars:
352273
- 'features/lib/support/env.rb'
353274
- 'spec/cucumber/cli/options_spec.rb'
354275

276+
# Offense count: 1
277+
# This cop supports unsafe autocorrection (--autocorrect-all).
278+
# Configuration parameters: EnforcedStyle.
279+
# SupportedStyles: literals, strict
280+
Style/MutableConstant:
281+
Exclude:
282+
- 'lib/cucumber/formatter/unicode.rb'
283+
284+
# Offense count: 5
285+
# This cop supports safe autocorrection (--autocorrect).
286+
Style/RedundantFreeze:
287+
Exclude:
288+
- 'lib/cucumber/cli/options.rb'
289+
- 'lib/cucumber/file_specs.rb'
290+
- 'lib/cucumber/runtime.rb'
291+
- 'lib/cucumber/term/ansicolor.rb'
292+
355293
# Offense count: 6
356294
# This cop supports safe autocorrection (--autocorrect).
357295
Style/StderrPuts:

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
99
Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) for more info on how to contribute to Cucumber.
1010

1111
## [Unreleased]
12+
### Changed
13+
- Updated `cucumber-compatibility-kit` to v16 ([luke-hill](https://github.com/luke-hill))
14+
- Changed compatibility testing to fully lean on external assets instead of duplicating them ([luke-hill](https://github.com/luke-hill))
15+
16+
### Fixed
17+
- Fixed an issue where a change to one example in compatibility testing wasn't fully adhered to ([luke-hill](https://github.com/luke-hill))
18+
19+
### Removed
20+
- Removed support for Ruby 2.7 ([luke-hill](https://github.com/luke-hill))
1221

1322
## [9.2.0] - 2024-03-19
1423
### Changed

compatibility/cck_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require_relative 'support/shared_examples'
44
require_relative 'support/cck/examples'
55

6-
require 'cucumber-compatibility-kit'
6+
require 'cck/examples'
77

88
describe 'Cucumber Compatibility Kit', type: :feature, cck: true do
99
let(:cucumber_command) { 'bundle exec cucumber --publish-quiet --profile none --format message' }

compatibility/features/attachments/attachments.feature.rb renamed to compatibility/features/attachments/attachments_steps.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# frozen_string_literal: true
22

3-
# This blank hook has been re-added in. See https://github.com/cucumber/compatibility-kit/issues/83 for more details
4-
Before { nil }
3+
def cck_asset_path
4+
"#{Gem.loaded_specs['cucumber-compatibility-kit'].full_gem_path}/features/attachments"
5+
end
56

67
When('the string {string} is attached as {string}') do |text, media_type|
78
attach(text, media_type)
@@ -25,13 +26,13 @@
2526
end
2627

2728
When('a JPEG image is attached') do
28-
attach(File.open("#{__dir__}/cucumber.jpeg"), 'image/jpeg')
29+
attach(File.open("#{cck_asset_path}/cucumber.jpeg"), 'image/jpeg')
2930
end
3031

3132
When('a PNG image is attached') do
32-
attach(File.open("#{__dir__}/cucumber.png"), 'image/png')
33+
attach(File.open("#{cck_asset_path}/cucumber.png"), 'image/png')
3334
end
3435

3536
When('a PDF document is attached and renamed') do
36-
attach(File.open("#{__dir__}/document.pdf"), 'document/pdf', 'renamed.pdf')
37+
attach(File.open("#{cck_asset_path}/document.pdf"), 'document/pdf', 'renamed.pdf')
3738
end
-1.41 KB
Binary file not shown.
-1.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)