Skip to content

Commit 4b35ac6

Browse files
authored
Merge pull request #216 from OpenVoxProject/module_tests
Migrate bundled module specs from mocha to rspec-mocks/voxpupuli-test
2 parents 329311d + 4399343 commit 4b35ac6

68 files changed

Lines changed: 1201 additions & 1205 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: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Layout/HashAlignment:
4343
Layout/HeredocIndentation:
4444
Enabled: false
4545

46-
# Offense count: 25
46+
# Offense count: 29
4747
# This cop supports safe autocorrection (--autocorrect).
4848
# Configuration parameters: EnforcedStyle, IndentationWidth.
4949
# SupportedStyles: aligned, indented
@@ -132,16 +132,6 @@ Lint/UselessOr:
132132
Exclude:
133133
- 'spec/integration/transport/winrm_spec.rb'
134134

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-
145135
# Offense count: 16
146136
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
147137
# AllowedMethods: call
@@ -371,13 +361,13 @@ RSpec/ClassCheck:
371361
RSpec/ContextMethod:
372362
Enabled: false
373363

374-
# Offense count: 332
364+
# Offense count: 339
375365
# Configuration parameters: Prefixes, AllowedPatterns.
376366
# Prefixes: when, with, without
377367
RSpec/ContextWording:
378368
Enabled: false
379369

380-
# Offense count: 110
370+
# Offense count: 113
381371
# Configuration parameters: IgnoredMetadata.
382372
RSpec/DescribeClass:
383373
Enabled: false
@@ -394,14 +384,14 @@ RSpec/DescribeSymbol:
394384
- 'spec/unit/plugin/module_spec.rb'
395385
- 'spec/unit/result_spec.rb'
396386

397-
# Offense count: 266
387+
# Offense count: 267
398388
# This cop supports unsafe autocorrection (--autocorrect-all).
399389
# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
400390
# SupportedStyles: described_class, explicit
401391
RSpec/DescribedClass:
402392
Enabled: false
403393

404-
# Offense count: 653
394+
# Offense count: 759
405395
# Configuration parameters: CountAsOne.
406396
RSpec/ExampleLength:
407397
Max: 42
@@ -413,15 +403,18 @@ RSpec/ExampleLength:
413403
RSpec/ExampleWording:
414404
Enabled: false
415405

416-
# Offense count: 31
406+
# Offense count: 35
417407
RSpec/ExpectInHook:
418408
Exclude:
409+
- 'bolt-modules/boltlib/spec/functions/apply_prep_spec.rb'
410+
- 'bolt-modules/boltlib/spec/functions/background_spec.rb'
411+
- 'bolt-modules/boltlib/spec/functions/parallelize_spec.rb'
419412
- 'spec/bolt_spec/run_spec.rb'
420413
- 'spec/integration/logging_spec.rb'
421414
- 'spec/integration/modules/write_file_spec.rb'
422415
- 'spec/unit/cli_spec.rb'
423416

424-
# Offense count: 276
417+
# Offense count: 354
425418
# This cop supports safe autocorrection (--autocorrect).
426419
# Configuration parameters: EnforcedStyle.
427420
# SupportedStyles: implicit, each, example
@@ -433,14 +426,14 @@ RSpec/IdenticalEqualityAssertion:
433426
Exclude:
434427
- 'spec/unit/application_spec.rb'
435428

436-
# Offense count: 371
429+
# Offense count: 369
437430
# This cop supports safe autocorrection (--autocorrect).
438431
# Configuration parameters: EnforcedStyle.
439432
# SupportedStyles: single_line_only, single_statement_only, disallow, require_implicit
440433
RSpec/ImplicitSubject:
441434
Enabled: false
442435

443-
# Offense count: 71
436+
# Offense count: 75
444437
# This cop supports unsafe autocorrection (--autocorrect-all).
445438
RSpec/IncludeExamples:
446439
Enabled: false
@@ -456,7 +449,7 @@ RSpec/IndexedLet:
456449
- 'spec/unit/result_set_spec.rb'
457450
- 'spec/unit/util/format_spec.rb'
458451

459-
# Offense count: 259
452+
# Offense count: 265
460453
# Configuration parameters: AssignmentOnly.
461454
RSpec/InstanceVariable:
462455
Enabled: false
@@ -489,7 +482,7 @@ RSpec/MatchArray:
489482
- 'spec/unit/target_spec.rb'
490483
- 'spec/unit/transport/ssh/connection_spec.rb'
491484

492-
# Offense count: 332
485+
# Offense count: 709
493486
# Configuration parameters: .
494487
# SupportedStyles: have_received, receive
495488
RSpec/MessageSpies:
@@ -510,7 +503,7 @@ RSpec/MultipleDescribes:
510503
- 'spec/unit/analytics_spec.rb'
511504
- 'spec/unit/config/options_spec.rb'
512505

513-
# Offense count: 649
506+
# Offense count: 648
514507
# Configuration parameters: AllowSubject.
515508
RSpec/MultipleMemoizedHelpers:
516509
Max: 27
@@ -530,7 +523,7 @@ RSpec/NamedSubject:
530523
- 'spec/unit/transport/ssh/connection_spec.rb'
531524
- 'spec/unit/transport/ssh/exec_connection_spec.rb'
532525

533-
# Offense count: 93
526+
# Offense count: 95
534527
# Configuration parameters: AllowedGroups.
535528
RSpec/NestedGroups:
536529
Max: 5
@@ -635,7 +628,7 @@ RSpec/SortMetadata:
635628
- 'spec/integration/apply_error_spec.rb'
636629
- 'spec/integration/inventory_spec.rb'
637630

638-
# Offense count: 78
631+
# Offense count: 83
639632
# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
640633
# SupportedInflectors: default, active_support
641634
RSpec/SpecFilePathFormat:
@@ -648,7 +641,7 @@ RSpec/SpecFilePathSuffix:
648641
- 'bolt-modules/boltlib/spec/functions/puppetdb_query.rb'
649642
- 'spec/integration/task_param.rb'
650643

651-
# Offense count: 103
644+
# Offense count: 364
652645
RSpec/StubbedMock:
653646
Enabled: false
654647

@@ -680,7 +673,7 @@ RSpec/VerifiedDoubleReference:
680673
- 'spec/unit/applicator_spec.rb'
681674
- 'spec/unit/inventory/group_spec.rb'
682675

683-
# Offense count: 108
676+
# Offense count: 139
684677
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
685678
RSpec/VerifiedDoubles:
686679
Enabled: false
@@ -697,7 +690,7 @@ RSpec/Yield:
697690
- 'spec/unit/application_spec.rb'
698691
- 'spec/unit/cli_spec.rb'
699692

700-
# Offense count: 51
693+
# Offense count: 52
701694
# This cop supports unsafe autocorrection (--autocorrect-all).
702695
# Configuration parameters: EnforcedStyle, AllowModifiersOnSymbols, AllowModifiersOnAttrs, AllowModifiersOnAliasMethod.
703696
# SupportedStyles: inline, group
@@ -727,7 +720,7 @@ Style/ArrayIntersect:
727720
Exclude:
728721
- 'bolt-modules/boltlib/lib/puppet/functions/download_file.rb'
729722

730-
# Offense count: 238
723+
# Offense count: 263
731724
# This cop supports safe autocorrection (--autocorrect).
732725
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
733726
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
@@ -745,7 +738,7 @@ Style/ConcatArrayLiterals:
745738
- 'spec/integration/cli/cli_spec.rb'
746739
- 'spec/unit/module_installer_spec.rb'
747740

748-
# Offense count: 183
741+
# Offense count: 190
749742
# Configuration parameters: AllowedConstants.
750743
Style/Documentation:
751744
Enabled: false
@@ -817,7 +810,7 @@ Style/FrozenStringLiteralComment:
817810
- '**/*.arb'
818811
- 'scripts/check_dependencies.rb'
819812

820-
# Offense count: 95
813+
# Offense count: 96
821814
# This cop supports safe autocorrection (--autocorrect).
822815
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
823816
Style/GuardClause:
@@ -863,7 +856,7 @@ Style/HashExcept:
863856
- 'lib/bolt/plugin/cache.rb'
864857
- 'lib/bolt/result.rb'
865858

866-
# Offense count: 213
859+
# Offense count: 216
867860
# This cop supports safe autocorrection (--autocorrect).
868861
Style/IfUnlessModifier:
869862
Enabled: false
@@ -894,7 +887,7 @@ Style/MutableConstant:
894887
Exclude:
895888
- 'lib/bolt/bolt_option_parser.rb'
896889

897-
# Offense count: 27
890+
# Offense count: 28
898891
# This cop supports safe autocorrection (--autocorrect).
899892
# Configuration parameters: Strict, AllowedNumbers, AllowedPatterns.
900893
Style/NumericLiterals:
@@ -930,6 +923,14 @@ Style/OneClassPerFile:
930923
Style/OptionalBooleanParameter:
931924
Enabled: false
932925

926+
# Offense count: 5
927+
# This cop supports unsafe autocorrection (--autocorrect-all).
928+
Style/PartitionInsteadOfDoubleSelect:
929+
Exclude:
930+
- 'spec/unit/transport/choria/bolt_tasks_spec.rb'
931+
- 'spec/unit/transport/choria/shell_spec.rb'
932+
- 'spec/unit/transport/choria_spec.rb'
933+
933934
# Offense count: 1
934935
# This cop supports safe autocorrection (--autocorrect).
935936
# Configuration parameters: EnforcedStyle.
@@ -938,7 +939,7 @@ Style/QuotedSymbols:
938939
Exclude:
939940
- 'spec/integration/transport/winrm_spec.rb'
940941

941-
# Offense count: 13
942+
# Offense count: 15
942943
# This cop supports unsafe autocorrection (--autocorrect-all).
943944
Style/ReduceToHash:
944945
Exclude:
@@ -949,6 +950,8 @@ Style/ReduceToHash:
949950
- 'lib/bolt/puppetdb/client.rb'
950951
- 'lib/bolt/result_set.rb'
951952
- 'lib/bolt/task.rb'
953+
- 'lib/bolt/transport/choria/bolt_tasks.rb'
954+
- 'lib/bolt/transport/choria/client.rb'
952955
- 'rakelib/schemas.rake'
953956
- 'spec/unit/executor_spec.rb'
954957

@@ -1098,7 +1101,7 @@ Style/StderrPuts:
10981101
Style/StringConcatenation:
10991102
Enabled: false
11001103

1101-
# Offense count: 3351
1104+
# Offense count: 3408
11021105
# This cop supports safe autocorrection (--autocorrect).
11031106
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
11041107
# SupportedStyles: single_quotes, double_quotes
@@ -1114,28 +1117,28 @@ Style/SuperArguments:
11141117
- 'lib/bolt/error.rb'
11151118
- 'lib/bolt_spec/plans/action_stubs/plan_stub.rb'
11161119

1117-
# Offense count: 31
1120+
# Offense count: 32
11181121
# This cop supports safe autocorrection (--autocorrect).
11191122
# Configuration parameters: EnforcedStyle, AllowSafeAssignment.
11201123
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
11211124
Style/TernaryParentheses:
11221125
Enabled: false
11231126

1124-
# Offense count: 521
1127+
# Offense count: 575
11251128
# This cop supports safe autocorrection (--autocorrect).
11261129
# Configuration parameters: EnforcedStyleForMultiline.
11271130
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
11281131
Style/TrailingCommaInArguments:
11291132
Enabled: false
11301133

1131-
# Offense count: 227
1134+
# Offense count: 268
11321135
# This cop supports safe autocorrection (--autocorrect).
11331136
# Configuration parameters: EnforcedStyleForMultiline.
11341137
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
11351138
Style/TrailingCommaInArrayLiteral:
11361139
Enabled: false
11371140

1138-
# Offense count: 1510
1141+
# Offense count: 1558
11391142
# This cop supports safe autocorrection (--autocorrect).
11401143
# Configuration parameters: EnforcedStyleForMultiline.
11411144
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ gem "paint", "~> 2.2"
3131

3232
group(:test) do
3333
gem "beaker-hostgenerator"
34-
gem "mocha", '>= 1.4.0', '< 4'
3534
gem "rack-test", '>= 1', '< 3'
3635
gem 'rspec-github', require: false
36+
gem 'voxpupuli-test', '~> 14.0', require: false
3737
end
3838

3939
group(:release, optional: true) do

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
require 'bolt/inventory'
66

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

15-
around(:each) do |example|
13+
before(:each) do
1614
Puppet[:tasks] = tasks_enabled
17-
Puppet.override(bolt_executor: executor, bolt_inventory: inventory) do
18-
example.run
19-
end
15+
Puppet.push_context(bolt_executor: executor, bolt_inventory: inventory)
16+
end
17+
18+
after(:each) do
19+
Puppet.pop_context
2020
end
2121

2222
it 'should set a fact on a target' do
@@ -32,7 +32,7 @@
3232
end
3333

3434
it 'reports the call to analytics' do
35-
executor.expects(:report_function_call).with('add_facts')
35+
expect(executor).to receive(:report_function_call).with('add_facts')
3636
is_expected.to run.with_params(target, {})
3737
end
3838

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
require 'bolt/inventory'
55

66
describe 'add_to_group' do
7-
include PuppetlabsSpec::Fixtures
8-
97
let(:executor) { Bolt::Executor.new }
108
let(:inventory) { Bolt::Inventory.empty }
119
let(:target) { inventory.get_target('example') }
1210
let(:group) { 'all' }
1311
let(:tasks_enabled) { true }
1412

15-
around(:each) do |example|
13+
before(:each) do
1614
Puppet[:tasks] = tasks_enabled
17-
Puppet.override(bolt_executor: executor, bolt_inventory: inventory) do
18-
example.run
19-
end
15+
Puppet.push_context(bolt_executor: executor, bolt_inventory: inventory)
16+
end
17+
18+
after(:each) do
19+
Puppet.pop_context
2020
end
2121

2222
it 'should add a target to group' do
@@ -31,7 +31,7 @@
3131
end
3232

3333
it 'reports the call to analytics' do
34-
executor.expects(:report_function_call).with('add_to_group')
34+
expect(executor).to receive(:report_function_call).with('add_to_group')
3535
is_expected.to run.with_params(target, group)
3636
end
3737

0 commit comments

Comments
 (0)