Skip to content

Commit d8ca398

Browse files
nmburganclaude
andcommitted
Consolidate bundled module spec_helpers via shared helper
Replace 13 near-identical module spec_helper.rb files with three-line wrappers that delegate to bolt-modules/shared_spec_helper.rb. The shared helper configures rspec-puppet's module_path to point at bolt-modules/ and modules/ directly, avoiding fixture symlinks. Canary and aggregate retain their BoltSpec::BoltContext#modulepath override since Bolt's task loader does not split a colon-separated RSpec.configuration.module_path string into individual entries. Adopt voxpupuli-test in the Gemfile to bundle rspec-puppet and friends via a single convention-aligned gem. Drop rspec-puppet and puppet_fixtures as standalone direct deps. Delete the stale .fixtures.yml files in canary and aggregate. Their old symlink-based fixture setup is no longer needed now that the shared helper puts bolt-modules/ on the modulepath directly, and the stale spec/fixtures/modules/boltlib symlinks were in fact causing rspec's default spec discovery to descend into them and re-run boltlib's specs from the wrong module's context. Apply the corresponding rubocop autocorrections to spec files under bolt-modules that rubocop-rspec 3.9 (pulled in transitively by voxpupuli-test) now flags. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: nmburgan <13688219+nmburgan@users.noreply.github.com>
1 parent afd4daa commit d8ca398

47 files changed

Lines changed: 462 additions & 650 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.rubocop_todo.yml

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ Layout/ClosingHeredocIndentation:
2929
- 'spec/unit/pal_spec.rb'
3030
- 'spec/unit/util/format_spec.rb'
3131

32+
# Offense count: 1
33+
# This cop supports safe autocorrection (--autocorrect).
34+
Layout/EmptyLineAfterGuardClause:
35+
Exclude:
36+
- 'rakelib/tests.rake'
37+
3238
# Offense count: 660
3339
# This cop supports safe autocorrection (--autocorrect).
3440
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
@@ -43,7 +49,7 @@ Layout/HashAlignment:
4349
Layout/HeredocIndentation:
4450
Enabled: false
4551

46-
# Offense count: 25
52+
# Offense count: 29
4753
# This cop supports safe autocorrection (--autocorrect).
4854
# Configuration parameters: EnforcedStyle, IndentationWidth.
4955
# SupportedStyles: aligned, indented
@@ -132,16 +138,6 @@ Lint/UselessOr:
132138
Exclude:
133139
- 'spec/integration/transport/winrm_spec.rb'
134140

135-
# Offense count: 6
136-
# This cop supports safe autocorrection (--autocorrect).
137-
# Configuration parameters: EnforcedStyle, BlockForwardingName.
138-
# SupportedStyles: anonymous, explicit
139-
Naming/BlockForwarding:
140-
Exclude:
141-
- 'lib/bolt/executor.rb'
142-
- 'lib/bolt/pal.rb'
143-
- 'lib/bolt_spec/bolt_context.rb'
144-
145141
# Offense count: 16
146142
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
147143
# AllowedMethods: call
@@ -371,13 +367,13 @@ RSpec/ClassCheck:
371367
RSpec/ContextMethod:
372368
Enabled: false
373369

374-
# Offense count: 332
370+
# Offense count: 339
375371
# Configuration parameters: Prefixes, AllowedPatterns.
376372
# Prefixes: when, with, without
377373
RSpec/ContextWording:
378374
Enabled: false
379375

380-
# Offense count: 110
376+
# Offense count: 113
381377
# Configuration parameters: IgnoredMetadata.
382378
RSpec/DescribeClass:
383379
Enabled: false
@@ -394,14 +390,14 @@ RSpec/DescribeSymbol:
394390
- 'spec/unit/plugin/module_spec.rb'
395391
- 'spec/unit/result_spec.rb'
396392

397-
# Offense count: 266
393+
# Offense count: 267
398394
# This cop supports unsafe autocorrection (--autocorrect-all).
399395
# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
400396
# SupportedStyles: described_class, explicit
401397
RSpec/DescribedClass:
402398
Enabled: false
403399

404-
# Offense count: 653
400+
# Offense count: 759
405401
# Configuration parameters: CountAsOne.
406402
RSpec/ExampleLength:
407403
Max: 42
@@ -413,15 +409,18 @@ RSpec/ExampleLength:
413409
RSpec/ExampleWording:
414410
Enabled: false
415411

416-
# Offense count: 31
412+
# Offense count: 35
417413
RSpec/ExpectInHook:
418414
Exclude:
415+
- 'bolt-modules/boltlib/spec/functions/apply_prep_spec.rb'
416+
- 'bolt-modules/boltlib/spec/functions/background_spec.rb'
417+
- 'bolt-modules/boltlib/spec/functions/parallelize_spec.rb'
419418
- 'spec/bolt_spec/run_spec.rb'
420419
- 'spec/integration/logging_spec.rb'
421420
- 'spec/integration/modules/write_file_spec.rb'
422421
- 'spec/unit/cli_spec.rb'
423422

424-
# Offense count: 276
423+
# Offense count: 354
425424
# This cop supports safe autocorrection (--autocorrect).
426425
# Configuration parameters: EnforcedStyle.
427426
# SupportedStyles: implicit, each, example
@@ -433,14 +432,14 @@ RSpec/IdenticalEqualityAssertion:
433432
Exclude:
434433
- 'spec/unit/application_spec.rb'
435434

436-
# Offense count: 371
435+
# Offense count: 369
437436
# This cop supports safe autocorrection (--autocorrect).
438437
# Configuration parameters: EnforcedStyle.
439438
# SupportedStyles: single_line_only, single_statement_only, disallow, require_implicit
440439
RSpec/ImplicitSubject:
441440
Enabled: false
442441

443-
# Offense count: 71
442+
# Offense count: 75
444443
# This cop supports unsafe autocorrection (--autocorrect-all).
445444
RSpec/IncludeExamples:
446445
Enabled: false
@@ -456,7 +455,7 @@ RSpec/IndexedLet:
456455
- 'spec/unit/result_set_spec.rb'
457456
- 'spec/unit/util/format_spec.rb'
458457

459-
# Offense count: 259
458+
# Offense count: 265
460459
# Configuration parameters: AssignmentOnly.
461460
RSpec/InstanceVariable:
462461
Enabled: false
@@ -489,7 +488,7 @@ RSpec/MatchArray:
489488
- 'spec/unit/target_spec.rb'
490489
- 'spec/unit/transport/ssh/connection_spec.rb'
491490

492-
# Offense count: 332
491+
# Offense count: 709
493492
# Configuration parameters: .
494493
# SupportedStyles: have_received, receive
495494
RSpec/MessageSpies:
@@ -510,7 +509,7 @@ RSpec/MultipleDescribes:
510509
- 'spec/unit/analytics_spec.rb'
511510
- 'spec/unit/config/options_spec.rb'
512511

513-
# Offense count: 649
512+
# Offense count: 648
514513
# Configuration parameters: AllowSubject.
515514
RSpec/MultipleMemoizedHelpers:
516515
Max: 27
@@ -530,7 +529,7 @@ RSpec/NamedSubject:
530529
- 'spec/unit/transport/ssh/connection_spec.rb'
531530
- 'spec/unit/transport/ssh/exec_connection_spec.rb'
532531

533-
# Offense count: 93
532+
# Offense count: 95
534533
# Configuration parameters: AllowedGroups.
535534
RSpec/NestedGroups:
536535
Max: 5
@@ -635,7 +634,7 @@ RSpec/SortMetadata:
635634
- 'spec/integration/apply_error_spec.rb'
636635
- 'spec/integration/inventory_spec.rb'
637636

638-
# Offense count: 78
637+
# Offense count: 83
639638
# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
640639
# SupportedInflectors: default, active_support
641640
RSpec/SpecFilePathFormat:
@@ -648,7 +647,7 @@ RSpec/SpecFilePathSuffix:
648647
- 'bolt-modules/boltlib/spec/functions/puppetdb_query.rb'
649648
- 'spec/integration/task_param.rb'
650649

651-
# Offense count: 103
650+
# Offense count: 364
652651
RSpec/StubbedMock:
653652
Enabled: false
654653

@@ -680,7 +679,7 @@ RSpec/VerifiedDoubleReference:
680679
- 'spec/unit/applicator_spec.rb'
681680
- 'spec/unit/inventory/group_spec.rb'
682681

683-
# Offense count: 108
682+
# Offense count: 139
684683
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
685684
RSpec/VerifiedDoubles:
686685
Enabled: false
@@ -697,7 +696,7 @@ RSpec/Yield:
697696
- 'spec/unit/application_spec.rb'
698697
- 'spec/unit/cli_spec.rb'
699698

700-
# Offense count: 51
699+
# Offense count: 52
701700
# This cop supports unsafe autocorrection (--autocorrect-all).
702701
# Configuration parameters: EnforcedStyle, AllowModifiersOnSymbols, AllowModifiersOnAttrs, AllowModifiersOnAliasMethod.
703702
# SupportedStyles: inline, group
@@ -727,7 +726,7 @@ Style/ArrayIntersect:
727726
Exclude:
728727
- 'bolt-modules/boltlib/lib/puppet/functions/download_file.rb'
729728

730-
# Offense count: 238
729+
# Offense count: 263
731730
# This cop supports safe autocorrection (--autocorrect).
732731
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
733732
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
@@ -745,7 +744,7 @@ Style/ConcatArrayLiterals:
745744
- 'spec/integration/cli/cli_spec.rb'
746745
- 'spec/unit/module_installer_spec.rb'
747746

748-
# Offense count: 183
747+
# Offense count: 190
749748
# Configuration parameters: AllowedConstants.
750749
Style/Documentation:
751750
Enabled: false
@@ -817,7 +816,7 @@ Style/FrozenStringLiteralComment:
817816
- '**/*.arb'
818817
- 'scripts/check_dependencies.rb'
819818

820-
# Offense count: 95
819+
# Offense count: 96
821820
# This cop supports safe autocorrection (--autocorrect).
822821
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
823822
Style/GuardClause:
@@ -863,7 +862,7 @@ Style/HashExcept:
863862
- 'lib/bolt/plugin/cache.rb'
864863
- 'lib/bolt/result.rb'
865864

866-
# Offense count: 213
865+
# Offense count: 216
867866
# This cop supports safe autocorrection (--autocorrect).
868867
Style/IfUnlessModifier:
869868
Enabled: false
@@ -894,7 +893,7 @@ Style/MutableConstant:
894893
Exclude:
895894
- 'lib/bolt/bolt_option_parser.rb'
896895

897-
# Offense count: 27
896+
# Offense count: 28
898897
# This cop supports safe autocorrection (--autocorrect).
899898
# Configuration parameters: Strict, AllowedNumbers, AllowedPatterns.
900899
Style/NumericLiterals:
@@ -930,6 +929,14 @@ Style/OneClassPerFile:
930929
Style/OptionalBooleanParameter:
931930
Enabled: false
932931

932+
# Offense count: 5
933+
# This cop supports unsafe autocorrection (--autocorrect-all).
934+
Style/PartitionInsteadOfDoubleSelect:
935+
Exclude:
936+
- 'spec/unit/transport/choria/bolt_tasks_spec.rb'
937+
- 'spec/unit/transport/choria/shell_spec.rb'
938+
- 'spec/unit/transport/choria_spec.rb'
939+
933940
# Offense count: 1
934941
# This cop supports safe autocorrection (--autocorrect).
935942
# Configuration parameters: EnforcedStyle.
@@ -938,7 +945,7 @@ Style/QuotedSymbols:
938945
Exclude:
939946
- 'spec/integration/transport/winrm_spec.rb'
940947

941-
# Offense count: 13
948+
# Offense count: 15
942949
# This cop supports unsafe autocorrection (--autocorrect-all).
943950
Style/ReduceToHash:
944951
Exclude:
@@ -949,6 +956,8 @@ Style/ReduceToHash:
949956
- 'lib/bolt/puppetdb/client.rb'
950957
- 'lib/bolt/result_set.rb'
951958
- 'lib/bolt/task.rb'
959+
- 'lib/bolt/transport/choria/bolt_tasks.rb'
960+
- 'lib/bolt/transport/choria/client.rb'
952961
- 'rakelib/schemas.rake'
953962
- 'spec/unit/executor_spec.rb'
954963

@@ -1098,7 +1107,7 @@ Style/StderrPuts:
10981107
Style/StringConcatenation:
10991108
Enabled: false
11001109

1101-
# Offense count: 3351
1110+
# Offense count: 3408
11021111
# This cop supports safe autocorrection (--autocorrect).
11031112
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
11041113
# SupportedStyles: single_quotes, double_quotes
@@ -1114,28 +1123,28 @@ Style/SuperArguments:
11141123
- 'lib/bolt/error.rb'
11151124
- 'lib/bolt_spec/plans/action_stubs/plan_stub.rb'
11161125

1117-
# Offense count: 31
1126+
# Offense count: 32
11181127
# This cop supports safe autocorrection (--autocorrect).
11191128
# Configuration parameters: EnforcedStyle, AllowSafeAssignment.
11201129
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
11211130
Style/TernaryParentheses:
11221131
Enabled: false
11231132

1124-
# Offense count: 521
1133+
# Offense count: 575
11251134
# This cop supports safe autocorrection (--autocorrect).
11261135
# Configuration parameters: EnforcedStyleForMultiline.
11271136
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
11281137
Style/TrailingCommaInArguments:
11291138
Enabled: false
11301139

1131-
# Offense count: 227
1140+
# Offense count: 268
11321141
# This cop supports safe autocorrection (--autocorrect).
11331142
# Configuration parameters: EnforcedStyleForMultiline.
11341143
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
11351144
Style/TrailingCommaInArrayLiteral:
11361145
Enabled: false
11371146

1138-
# Offense count: 1510
1147+
# Offense count: 1558
11391148
# This cop supports safe autocorrection (--autocorrect).
11401149
# Configuration parameters: EnforcedStyleForMultiline.
11411150
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma

Gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ group(:test) do
3333
gem "beaker-hostgenerator"
3434
gem "rack-test", '>= 1', '< 3'
3535
gem 'rspec-github', require: false
36-
gem 'rspec-puppet', '>= 5', require: false
37-
gem 'puppet_fixtures', '>= 0.1', '< 3', require: false
36+
gem 'voxpupuli-test', '~> 14.0', require: false
3837
end
3938

4039
group(:release, optional: true) do

bolt-modules/boltlib/spec/functions/add_facts_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
require 'bolt/inventory'
66

77
describe 'add_facts' do
8-
include SpecFixtures
9-
108
let(:executor) { Bolt::Executor.new }
119
let(:inventory) { Bolt::Inventory.empty }
1210
let(:target) { inventory.get_target('example') }

bolt-modules/boltlib/spec/functions/add_to_group_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
require 'bolt/inventory'
55

66
describe 'add_to_group' do
7-
include SpecFixtures
8-
97
let(:executor) { Bolt::Executor.new }
108
let(:inventory) { Bolt::Inventory.empty }
119
let(:target) { inventory.get_target('example') }

0 commit comments

Comments
 (0)