Skip to content

Commit e491902

Browse files
authored
Refactor/remove multiple expects (#1742)
* For pretty spec remove all multiple expectation cop failures for snippet based tests * Linting tidy for pretty spec * Cleanup of file loading tests to ensure that tests only test one thing * Simplify test for multiple worlds * Final tweaks to registry and more spec to resolve all specs only having 1 assertion * Remove all duplicate expectations from meta_message_builder * Remove nearly all duplicate expect situations from options spec * Stylistic tweaks to activate steps spec * Remove double expectation wrappers on essentially allow calls for mocking * Remove all duplicate expectations from activate_steps spec * Remove around 30% of multiple expectation offenses * Partial fix for maximum lets * Fix up all RSpec/NestedGroups offenses * Fix up incorrect rubocop fix * Add in additional note about rubocop fixes
1 parent 491c14e commit e491902

File tree

10 files changed

+361
-289
lines changed

10 files changed

+361
-289
lines changed

.rubocop_todo.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2023-10-02 14:25:13 UTC using RuboCop version 1.56.4.
3+
# on 2023-10-03 13:56:41 UTC using RuboCop version 1.56.4.
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
@@ -69,6 +69,15 @@ Layout/IndentationWidth:
6969
Exclude:
7070
- 'spec/cucumber/formatter/fail_fast_spec.rb'
7171

72+
# Offense count: 4
73+
# This cop supports safe autocorrection (--autocorrect).
74+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
75+
# SupportedStyles: space, no_space, compact
76+
# SupportedStylesForEmptyBraces: space, no_space
77+
Layout/SpaceInsideHashLiteralBraces:
78+
Exclude:
79+
- 'spec/cucumber/cli/options_spec.rb'
80+
7281
# Offense count: 3
7382
# This cop supports safe autocorrection (--autocorrect).
7483
Lint/AmbiguousOperator:
@@ -185,7 +194,7 @@ RSpec/EmptyLineAfterFinalLet:
185194
- 'spec/cucumber/configuration_spec.rb'
186195
- 'spec/cucumber/hooks_spec.rb'
187196

188-
# Offense count: 100
197+
# Offense count: 83
189198
# Configuration parameters: CountAsOne.
190199
RSpec/ExampleLength:
191200
Max: 58
@@ -245,9 +254,9 @@ RSpec/MissingExampleGroupArgument:
245254
- 'spec/cucumber/formatter/fail_fast_spec.rb'
246255
- 'spec/cucumber/formatter/rerun_spec.rb'
247256

248-
# Offense count: 87
257+
# Offense count: 59
249258
RSpec/MultipleExpectations:
250-
Max: 8
259+
Max: 3
251260

252261
# Offense count: 38
253262
# Configuration parameters: AllowSubject.
@@ -325,15 +334,14 @@ RSpec/ScatteredLet:
325334
Exclude:
326335
- 'spec/cucumber/runtime/support_code_spec.rb'
327336

328-
# Offense count: 9
337+
# Offense count: 5
329338
RSpec/StubbedMock:
330339
Exclude:
331340
- 'spec/cucumber/cli/configuration_spec.rb'
332341
- 'spec/cucumber/formatter/interceptor_spec.rb'
333-
- 'spec/cucumber/glue/registry_and_more_spec.rb'
334342
- 'spec/cucumber/runtime/meta_message_builder_spec.rb'
335343

336-
# Offense count: 54
344+
# Offense count: 57
337345
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
338346
RSpec/VerifiedDoubles:
339347
Exclude:
@@ -371,6 +379,12 @@ Style/ClassVars:
371379
Exclude:
372380
- 'spec/cucumber/glue/step_definition_spec.rb'
373381

382+
# Offense count: 4
383+
# Configuration parameters: AllowedVariables.
384+
Style/GlobalVars:
385+
Exclude:
386+
- 'spec/cucumber/cli/options_spec.rb'
387+
374388
# Offense count: 6
375389
# This cop supports safe autocorrection (--autocorrect).
376390
Style/StderrPuts:
@@ -382,10 +396,11 @@ Style/StderrPuts:
382396
- 'lib/cucumber/rake/task.rb'
383397
- 'spec/cucumber/formatter/interceptor_spec.rb'
384398

385-
# Offense count: 1
399+
# Offense count: 2
386400
# This cop supports safe autocorrection (--autocorrect).
387401
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
388402
# SupportedStyles: single_quotes, double_quotes
389403
Style/StringLiterals:
390404
Exclude:
391405
- 'spec/cucumber/cli/options_spec.rb'
406+
- 'spec/cucumber/formatter/pretty_spec.rb'

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
1111
## [Unreleased]
1212
### Changed
1313
- First couple of passes of tidying up approximately 40% of the manual fix cops
14-
([#1739](https://github.com/cucumber/cucumber-ruby/pull/1739) [#1740](https://github.com/cucumber/cucumber-ruby/pull/1740) [#1741](https://github.com/cucumber/cucumber-ruby/pull/1741) [luke-hill](https://github.com/luke-hill))
14+
([#1739](https://github.com/cucumber/cucumber-ruby/pull/1739) [#1740](https://github.com/cucumber/cucumber-ruby/pull/1740) [#1741](https://github.com/cucumber/cucumber-ruby/pull/1741) [#1742](https://github.com/cucumber/cucumber-ruby/pull/1742) [luke-hill](https://github.com/luke-hill))
1515
- Removed a bunch of example files / sample projects from ancient projects no longer viable
1616
[#1740](https://github.com/cucumber/cucumber-ruby/pull/1740) [luke-hill](https://github.com/luke-hill))
1717

lib/cucumber/runtime/meta_message_builder.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
module Cucumber
77
class Runtime
8-
# Builder to instanciate a Cucumber::Messages::Meta message filled-in with
8+
# Builder to instantiate a Cucumber::Messages::Meta message filled-in with
99
# the runtime meta-data:
1010
# - protocol version: the version of the Cucumber::Messages protocol
1111
# - implementation: the name and version of the implementation (e.g. cucumber-ruby 8.0.0)
1212
# - runtime: the name and version of the runtime (e.g. ruby 3.0.1)
1313
# - os: the name and version of the operating system (e.g. linux 3.13.0-45-generic)
1414
# - cpu: the name of the CPU (e.g. x86_64)
15-
# - ci: informtion about the CI environment if any, including:
15+
# - ci: information about the CI environment if any, including:
1616
# - name: the name of the CI environment (e.g. Jenkins)
1717
# - url: the URL of the CI environment (e.g. https://ci.example.com)
1818
# - build_number: the build number of the CI environment (e.g. 123)

0 commit comments

Comments
 (0)