diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 4a22c2fea..7098446da 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --no-auto-gen-timestamp` -# using RuboCop version 1.81.1. +# using RuboCop version 1.85.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -8,7 +8,7 @@ # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyleAlignWith, Severity. +# Configuration parameters: EnforcedStyleAlignWith. # SupportedStylesAlignWith: start_of_line, begin Layout/BeginEndAlignment: Exclude: @@ -29,7 +29,7 @@ Layout/ClosingHeredocIndentation: - 'spec/unit/pal_spec.rb' - 'spec/unit/util/format_spec.rb' -# Offense count: 656 +# Offense count: 660 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. # SupportedHashRocketStyles: key, separator, table @@ -38,18 +38,42 @@ Layout/ClosingHeredocIndentation: Layout/HashAlignment: Enabled: false -# Offense count: 53 +# Offense count: 52 # This cop supports safe autocorrection (--autocorrect). Layout/HeredocIndentation: Enabled: false -# Offense count: 24 +# Offense count: 25 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: aligned, indented Layout/LineEndStringConcatenationIndentation: Enabled: false +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideBlockBraces: + Exclude: + - 'rakelib/tests.rake' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: final_newline, final_blank_line +Layout/TrailingEmptyLines: + Exclude: + - 'bolt-modules/boltlib/spec/spec_helper.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowInHeredoc. +Layout/TrailingWhitespace: + Exclude: + - 'bolt-modules/shared_spec_helper.rb' + # Offense count: 11 # This cop supports safe autocorrection (--autocorrect). Lint/AmbiguousOperatorPrecedence: @@ -121,12 +145,19 @@ Lint/SuppressedException: Exclude: - 'lib/bolt/shell/bash.rb' +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Lint/UselessAssignment: + Exclude: + - 'rakelib/tests.rake' + # Offense count: 1 Lint/UselessConstantScoping: Exclude: - 'lib/bolt/transport/winrm/connection.rb' # Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). Lint/UselessOr: Exclude: - 'spec/integration/transport/winrm_spec.rb' @@ -144,7 +175,7 @@ Naming/BlockForwarding: # Offense count: 16 # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates. # AllowedMethods: call -# WaywardPredicates: nonzero? +# WaywardPredicates: infinite?, nonzero? Naming/PredicateMethod: Exclude: - 'bolt-modules/file/lib/puppet/functions/file/exists.rb' @@ -256,7 +287,7 @@ Performance/RedundantStringChars: Exclude: - 'lib/bolt/config/transport/base.rb' -# Offense count: 36 +# Offense count: 40 # This cop supports safe autocorrection (--autocorrect). Performance/RegexpMatch: Enabled: false @@ -267,7 +298,7 @@ Performance/Size: Exclude: - 'lib/bolt/validator.rb' -# Offense count: 20 +# Offense count: 22 # This cop supports unsafe autocorrection (--autocorrect-all). Performance/StringInclude: Enabled: false @@ -285,11 +316,10 @@ Performance/Sum: Exclude: - 'lib/bolt/executor.rb' -# Offense count: 13 +# Offense count: 12 # This cop supports unsafe autocorrection (--autocorrect-all). Performance/UnfreezeString: Exclude: - - 'lib/bolt/cli.rb' - 'lib/bolt/module_installer/specs.rb' - 'lib/bolt/outputter/rainbow.rb' - 'lib/bolt/pal/yaml_plan/parameter.rb' @@ -320,7 +350,7 @@ RSpec/BeEmpty: Exclude: - 'spec/unit/project_manager/module_migrator_spec.rb' -# Offense count: 93 +# Offense count: 92 # This cop supports unsafe autocorrection (--autocorrect-all). RSpec/BeEq: Enabled: false @@ -367,18 +397,18 @@ RSpec/ClassCheck: Exclude: - 'spec/integration/puppetdb/puppetdb_spec.rb' -# Offense count: 70 +# Offense count: 71 # This cop supports safe autocorrection (--autocorrect). RSpec/ContextMethod: Enabled: false -# Offense count: 331 +# Offense count: 330 # Configuration parameters: Prefixes, AllowedPatterns. # Prefixes: when, with, without RSpec/ContextWording: Enabled: false -# Offense count: 109 +# Offense count: 110 # Configuration parameters: IgnoredMetadata. RSpec/DescribeClass: Enabled: false @@ -395,26 +425,26 @@ RSpec/DescribeSymbol: - 'spec/unit/plugin/module_spec.rb' - 'spec/unit/result_spec.rb' -# Offense count: 268 +# Offense count: 266 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants. # SupportedStyles: described_class, explicit RSpec/DescribedClass: Enabled: false -# Offense count: 656 +# Offense count: 650 # Configuration parameters: CountAsOne. RSpec/ExampleLength: Max: 42 -# Offense count: 177 +# Offense count: 180 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples. # DisallowedExamples: works RSpec/ExampleWording: Enabled: false -# Offense count: 32 +# Offense count: 31 RSpec/ExpectInHook: Exclude: - 'spec/bolt_spec/run_spec.rb' @@ -422,7 +452,7 @@ RSpec/ExpectInHook: - 'spec/integration/modules/write_file_spec.rb' - 'spec/unit/cli_spec.rb' -# Offense count: 276 +# Offense count: 275 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: implicit, each, example @@ -434,7 +464,7 @@ RSpec/IdenticalEqualityAssertion: Exclude: - 'spec/unit/application_spec.rb' -# Offense count: 371 +# Offense count: 368 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: single_line_only, single_statement_only, disallow, require_implicit @@ -457,7 +487,7 @@ RSpec/IndexedLet: - 'spec/unit/result_set_spec.rb' - 'spec/unit/util/format_spec.rb' -# Offense count: 255 +# Offense count: 259 # Configuration parameters: AssignmentOnly. RSpec/InstanceVariable: Enabled: false @@ -490,7 +520,7 @@ RSpec/MatchArray: - 'spec/unit/target_spec.rb' - 'spec/unit/transport/ssh/connection_spec.rb' -# Offense count: 336 +# Offense count: 332 # Configuration parameters: . # SupportedStyles: have_received, receive RSpec/MessageSpies: @@ -511,12 +541,12 @@ RSpec/MultipleDescribes: - 'spec/unit/analytics_spec.rb' - 'spec/unit/config/options_spec.rb' -# Offense count: 649 +# Offense count: 646 # Configuration parameters: AllowSubject. RSpec/MultipleMemoizedHelpers: Max: 27 -# Offense count: 143 +# Offense count: 137 # Configuration parameters: EnforcedStyle, IgnoreSharedExamples. # SupportedStyles: always, named_only RSpec/NamedSubject: @@ -556,6 +586,14 @@ RSpec/NotToNot: - 'spec/unit/applicator_spec.rb' - 'spec/unit/plugin/puppet_library_spec.rb' +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +RSpec/Output: + Exclude: + - 'bolt-modules/boltlib/spec/fixtures/modules/test/tasks/references.rb' + - 'bolt-modules/boltlib/spec/functions/catch_errors_spec.rb' + - 'spec/integration/apply_spec.rb' + # Offense count: 29 # This cop supports unsafe autocorrection (--autocorrect-all). RSpec/ReceiveMessages: @@ -629,7 +667,8 @@ RSpec/SortMetadata: - 'spec/integration/inventory_spec.rb' # Offense count: 78 -# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata. +# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector. +# SupportedInflectors: default, active_support RSpec/SpecFilePathFormat: Enabled: false @@ -640,11 +679,11 @@ RSpec/SpecFilePathSuffix: - 'bolt-modules/boltlib/spec/functions/puppetdb_query.rb' - 'spec/integration/task_param.rb' -# Offense count: 104 +# Offense count: 103 RSpec/StubbedMock: Enabled: false -# Offense count: 3 +# Offense count: 2 RSpec/SubjectDeclaration: Exclude: - 'spec/unit/transport/ssh/connection_spec.rb' @@ -672,7 +711,7 @@ RSpec/VerifiedDoubleReference: - 'spec/unit/applicator_spec.rb' - 'spec/unit/inventory/group_spec.rb' -# Offense count: 109 +# Offense count: 108 # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames. RSpec/VerifiedDoubles: Enabled: false @@ -719,7 +758,7 @@ Style/ArrayIntersect: Exclude: - 'bolt-modules/boltlib/lib/puppet/functions/download_file.rb' -# Offense count: 242 +# Offense count: 238 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods. # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces @@ -768,24 +807,6 @@ Style/ExplicitBlockArgument: - 'lib/bolt/result_set.rb' - 'spec/lib/bolt_spec/errors.rb' -# Offense count: 16 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowedVars, DefaultToNil. -Style/FetchEnvVar: - Exclude: - - 'acceptance/Rakefile' - - 'acceptance/setup/package/pre-suite/020_install.rb' - - 'bolt-modules/system/lib/puppet/functions/system/env.rb' - - 'bolt-modules/system/spec/functions/system/env_spec.rb' - - 'developer-docs/examples/bolt_spec_example/tasks/init.rb' - - 'lib/bolt/applicator.rb' - - 'lib/bolt/config.rb' - - 'lib/bolt/plugin/env_var.rb' - - 'lib/bolt/puppetdb/config.rb' - - 'scripts/generate_changelog.rb' - - 'spec/integration/local_spec.rb' - - 'spec/lib/bolt_spec/env_var.rb' - # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). Style/FileEmpty: @@ -798,6 +819,11 @@ Style/FileNull: Exclude: - 'lib/bolt/puppetdb/config.rb' +# Offense count: 2 +Style/FileOpen: + Exclude: + - 'dev-resources/bump_mods.rb' + # Offense count: 4 # This cop supports safe autocorrection (--autocorrect). Style/FileRead: @@ -822,13 +848,13 @@ Style/FrozenStringLiteralComment: - '**/*.arb' - 'scripts/check_dependencies.rb' -# Offense count: 97 +# Offense count: 95 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. Style/GuardClause: Enabled: false -# Offense count: 8 +# Offense count: 9 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: braces, no_braces @@ -839,6 +865,7 @@ Style/HashAsLastArrayItem: - 'lib/bolt/project.rb' - 'spec/unit/applicator_spec.rb' - 'spec/unit/pal/yaml_plan/evaluator_spec.rb' + - 'spec/unit/pal/yaml_plan_spec.rb' # Offense count: 3 # This cop supports unsafe autocorrection (--autocorrect-all). @@ -868,13 +895,7 @@ Style/HashExcept: - 'lib/bolt/plugin/cache.rb' - 'lib/bolt/result.rb' -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -Style/HashTransformValues: - Exclude: - - 'scripts/check_dependencies.rb' - -# Offense count: 160 +# Offense count: 214 # This cop supports safe autocorrection (--autocorrect). Style/IfUnlessModifier: Enabled: false @@ -890,6 +911,13 @@ Style/MapToHash: - 'lib/bolt/project.rb' - 'spec/lib/bolt_spec/env_var.rb' +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowedMethods. +Style/ModuleMemberExistenceCheck: + Exclude: + - 'lib/bolt/result_set.rb' + # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowMethodComparison, ComparisonsThreshold. @@ -929,6 +957,12 @@ Style/NumericPredicate: - 'lib/bolt_spec/plans/action_stubs.rb' - 'libexec/apply_catalog.rb' +# Offense count: 1 +# Configuration parameters: AllowedClasses. +Style/OneClassPerFile: + Exclude: + - 'scripts/check_dependencies.rb' + # Offense count: 19 # Configuration parameters: AllowedMethods. # AllowedMethods: respond_to_missing? @@ -943,6 +977,20 @@ Style/QuotedSymbols: Exclude: - 'spec/integration/transport/winrm_spec.rb' +# Offense count: 13 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/ReduceToHash: + Exclude: + - 'bolt-modules/boltlib/lib/puppet/functions/run_plan.rb' + - 'lib/bolt/apply_result.rb' + - 'lib/bolt/executor.rb' + - 'lib/bolt/pal.rb' + - 'lib/bolt/puppetdb/client.rb' + - 'lib/bolt/result_set.rb' + - 'lib/bolt/task.rb' + - 'rakelib/schemas.rake' + - 'spec/unit/executor_spec.rb' + # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Style/RedundantConstantBase: @@ -962,12 +1010,14 @@ Style/RedundantFreeze: - 'lib/bolt/pal/yaml_plan.rb' - 'libexec/query_resources.rb' -# Offense count: 5 +# Offense count: 7 # This cop supports safe autocorrection (--autocorrect). Style/RedundantInterpolationUnfreeze: Exclude: - 'lib/bolt/inventory/group.rb' - 'lib/bolt/outputter/human.rb' + - 'lib/bolt/pal/yaml_plan/transpiler.rb' + - 'lib/bolt/plugin/puppetdb.rb' - 'rakelib/pwsh.rake' # Offense count: 3 @@ -1020,6 +1070,15 @@ Style/SafeNavigation: - 'lib/bolt_spec/plans/mock_executor.rb' - 'rakelib/pwsh.rake' +# Offense count: 4 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/SelectByKind: + Exclude: + - 'bolt-modules/boltlib/lib/puppet/functions/run_command.rb' + - 'bolt-modules/boltlib/lib/puppet/functions/run_container.rb' + - 'bolt-modules/boltlib/lib/puppet/functions/run_script.rb' + - 'lib/bolt/catalog.rb' + # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). Style/SelectByRegexp: @@ -1074,13 +1133,13 @@ Style/StderrPuts: - 'lib/bolt_spec/plans/action_stubs.rb' - 'libexec/apply_catalog.rb' -# Offense count: 157 +# Offense count: 154 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Mode. Style/StringConcatenation: Enabled: false -# Offense count: 3277 +# Offense count: 3354 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. # SupportedStyles: single_quotes, double_quotes @@ -1096,29 +1155,21 @@ Style/SuperArguments: - 'lib/bolt/error.rb' - 'lib/bolt_spec/plans/action_stubs/plan_stub.rb' -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments. -# AllowedMethods: define_method -Style/SymbolProc: - Exclude: - - 'scripts/check_dependencies.rb' - -# Offense count: 29 +# Offense count: 31 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, AllowSafeAssignment. # SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex Style/TernaryParentheses: Enabled: false -# Offense count: 522 +# Offense count: 521 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyleForMultiline. # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma Style/TrailingCommaInArguments: Enabled: false -# Offense count: 225 +# Offense count: 227 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyleForMultiline. # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma @@ -1137,10 +1188,3 @@ Style/TrailingCommaInHashLiteral: Style/YAMLFileRead: Exclude: - 'spec/unit/module_installer_spec.rb' - -# Offense count: 3 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings. -# URISchemes: http, https -Layout/LineLength: - Max: 121 diff --git a/bolt-modules/boltlib/Rakefile b/bolt-modules/boltlib/Rakefile new file mode 100644 index 000000000..894155e15 --- /dev/null +++ b/bolt-modules/boltlib/Rakefile @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require 'voxpupuli/test/rake' diff --git a/bolt-modules/boltlib/spec/functions/add_facts_spec.rb b/bolt-modules/boltlib/spec/functions/add_facts_spec.rb index 365b761b6..6ed189296 100644 --- a/bolt-modules/boltlib/spec/functions/add_facts_spec.rb +++ b/bolt-modules/boltlib/spec/functions/add_facts_spec.rb @@ -5,8 +5,6 @@ require 'bolt/inventory' describe 'add_facts' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:inventory) { Bolt::Inventory.empty } let(:target) { inventory.get_target('example') } diff --git a/bolt-modules/boltlib/spec/functions/add_to_group_spec.rb b/bolt-modules/boltlib/spec/functions/add_to_group_spec.rb index 6503da3ca..8e4322cb1 100644 --- a/bolt-modules/boltlib/spec/functions/add_to_group_spec.rb +++ b/bolt-modules/boltlib/spec/functions/add_to_group_spec.rb @@ -4,8 +4,6 @@ require 'bolt/inventory' describe 'add_to_group' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:inventory) { Bolt::Inventory.empty } let(:target) { inventory.get_target('example') } diff --git a/bolt-modules/boltlib/spec/functions/apply_prep_spec.rb b/bolt-modules/boltlib/spec/functions/apply_prep_spec.rb index 4134eba22..2034df06c 100644 --- a/bolt-modules/boltlib/spec/functions/apply_prep_spec.rb +++ b/bolt-modules/boltlib/spec/functions/apply_prep_spec.rb @@ -11,8 +11,6 @@ require 'bolt/task' describe 'apply_prep' do - include PuppetlabsSpec::Fixtures - let(:applicator) { mock('Bolt::Applicator') } let(:config) { Bolt::Config.default } let(:executor) { Bolt::Executor.new } @@ -32,9 +30,8 @@ end context 'with targets' do - let(:hostnames) { %w[a.b.com winrm://x.y.com pcp://foo] } + let(:hostnames) { %w[a.b.com winrm://x.y.com remote://foo] } let(:targets) { hostnames.map { |h| inventory.get_target(h) } } - let(:unknown_targets) { targets.reject { |target| target.protocol == 'pcp' } } let(:fact) { { 'osfamily' => 'none' } } let(:custom_facts_task) { Bolt::Task.new('custom_facts_task') } let(:version_task) { Bolt::Task.new('openvox_bootstrap::check') } @@ -74,7 +71,7 @@ is_expected.to run.with_params(hostnames.join(',')) targets.each do |target| - expect(inventory.features(target)).to include('puppet-agent') unless target.transport == 'pcp' + expect(inventory.features(target)).to include('puppet-agent') unless target.transport == 'remote' expect(inventory.facts(target)).to eq(fact) end end @@ -92,7 +89,7 @@ is_expected.to run.with_params(hostnames, '_run_as' => 'root') targets.each do |target| - expect(inventory.features(target)).to include('puppet-agent') unless target.transport == 'pcp' + expect(inventory.features(target)).to include('puppet-agent') unless target.transport == 'remote' expect(inventory.facts(target)).to eq(fact) end end @@ -110,7 +107,7 @@ is_expected.to run.with_params(hostnames, '_noop' => true) targets.each do |target| - expect(inventory.features(target)).to include('puppet-agent') unless target.transport == 'pcp' + expect(inventory.features(target)).to include('puppet-agent') unless target.transport == 'remote' expect(inventory.facts(target)).to eq(fact) end end @@ -199,31 +196,6 @@ end end - context 'with only pcp targets' do - let(:hostnames) { %w[pcp://foo pcp://bar] } - let(:targets) { hostnames.map { |h| inventory.get_target(h) } } - let(:fact) { { 'osfamily' => 'none' } } - let(:custom_facts_task) { Bolt::Task.new('custom_facts_task') } - - before(:each) do - applicator.stubs(:build_plugin_tarball).returns(:tarball) - applicator.stubs(:custom_facts_task).returns(custom_facts_task) - end - - it 'sets feature and gathers facts' do - facts = Bolt::ResultSet.new(targets.map { |t| Bolt::Result.new(t, value: fact) }) - executor.expects(:run_task) - .with(targets, custom_facts_task, includes('plugins'), {}) - .returns(facts) - - is_expected.to run.with_params(hostnames.join(',')) - targets.each do |target| - expect(inventory.features(target)).to include('puppet-agent') unless target.transport == 'pcp' - expect(inventory.facts(target)).to eq(fact) - end - end - end - context 'with targets assigned the puppet-agent feature' do let(:hostnames) { %w[foo bar] } let(:targets) { hostnames.map { |h| inventory.get_target(h) } } diff --git a/bolt-modules/boltlib/spec/functions/background_spec.rb b/bolt-modules/boltlib/spec/functions/background_spec.rb index 0c1960be2..6ae5b4814 100644 --- a/bolt-modules/boltlib/spec/functions/background_spec.rb +++ b/bolt-modules/boltlib/spec/functions/background_spec.rb @@ -6,8 +6,6 @@ require 'bolt/plan_future' describe 'background' do - include PuppetlabsSpec::Fixtures - let(:name) { "Pluralize" } let(:object) { "noodle" } let(:future) { Bolt::PlanFuture.new('foo', name, plan_id: 1234) } diff --git a/bolt-modules/boltlib/spec/functions/download_file_spec.rb b/bolt-modules/boltlib/spec/functions/download_file_spec.rb index 69dde67c3..d6d74e1b3 100644 --- a/bolt-modules/boltlib/spec/functions/download_file_spec.rb +++ b/bolt-modules/boltlib/spec/functions/download_file_spec.rb @@ -8,8 +8,6 @@ require 'bolt/project' describe 'download_file' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:inventory) { mock('inventory') } let(:project) { Bolt::Project.default_project } diff --git a/bolt-modules/boltlib/spec/functions/facts_spec.rb b/bolt-modules/boltlib/spec/functions/facts_spec.rb index 002eccaa9..9b794c329 100644 --- a/bolt-modules/boltlib/spec/functions/facts_spec.rb +++ b/bolt-modules/boltlib/spec/functions/facts_spec.rb @@ -5,8 +5,6 @@ require 'bolt/inventory' describe 'facts' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:inventory) { Bolt::Inventory.empty } let(:hostname) { 'example' } diff --git a/bolt-modules/boltlib/spec/functions/fail_plan_spec.rb b/bolt-modules/boltlib/spec/functions/fail_plan_spec.rb index 6cee94ec2..a0820b127 100644 --- a/bolt-modules/boltlib/spec/functions/fail_plan_spec.rb +++ b/bolt-modules/boltlib/spec/functions/fail_plan_spec.rb @@ -5,8 +5,6 @@ require 'bolt/error' describe 'fail_plan' do - include PuppetlabsSpec::Fixtures - let(:tasks_enabled) { true } let(:executor) { Bolt::Executor.new } diff --git a/bolt-modules/boltlib/spec/functions/get_resources_spec.rb b/bolt-modules/boltlib/spec/functions/get_resources_spec.rb index e4f4fc539..1ff724f83 100644 --- a/bolt-modules/boltlib/spec/functions/get_resources_spec.rb +++ b/bolt-modules/boltlib/spec/functions/get_resources_spec.rb @@ -9,8 +9,6 @@ require 'bolt/task' describe 'get_resources' do - include PuppetlabsSpec::Fixtures - let(:applicator) { mock('Bolt::Applicator') } let(:executor) { Bolt::Executor.new } let(:inventory) { Bolt::Inventory.empty } @@ -26,7 +24,7 @@ end context 'with targets' do - let(:hostnames) { %w[a.b.com winrm://x.y.com pcp://foo] } + let(:hostnames) { %w[a.b.com winrm://x.y.com] } let(:targets) { hostnames.map { |h| inventory.get_target(h) } } let(:query_resources_task) { Bolt::Task.new('query_resources_task') } diff --git a/bolt-modules/boltlib/spec/functions/get_target_spec.rb b/bolt-modules/boltlib/spec/functions/get_target_spec.rb index a17cb5709..82bc2e866 100644 --- a/bolt-modules/boltlib/spec/functions/get_target_spec.rb +++ b/bolt-modules/boltlib/spec/functions/get_target_spec.rb @@ -5,8 +5,6 @@ require 'bolt/inventory' describe 'get_target' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:inventory) { Bolt::Inventory.empty } let(:tasks_enabled) { true } diff --git a/bolt-modules/boltlib/spec/functions/parallelize_spec.rb b/bolt-modules/boltlib/spec/functions/parallelize_spec.rb index 9d8b97304..393995306 100644 --- a/bolt-modules/boltlib/spec/functions/parallelize_spec.rb +++ b/bolt-modules/boltlib/spec/functions/parallelize_spec.rb @@ -7,8 +7,6 @@ require 'bolt/plan_result' describe 'parallelize' do - include PuppetlabsSpec::Fixtures - let(:array) { %w[a b c d a b a] } let(:future) { Bolt::PlanFuture.new(nil, 1, name: 'name', plan_id: 1234) } let(:executor) { Bolt::Executor.new } diff --git a/bolt-modules/boltlib/spec/functions/puppetdb_command_spec.rb b/bolt-modules/boltlib/spec/functions/puppetdb_command_spec.rb index b6dfa048a..2b689e657 100644 --- a/bolt-modules/boltlib/spec/functions/puppetdb_command_spec.rb +++ b/bolt-modules/boltlib/spec/functions/puppetdb_command_spec.rb @@ -4,8 +4,6 @@ require 'bolt/executor' describe 'puppetdb_command' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:pdb_client) { mock('pdb_client') } let(:tasks) { true } diff --git a/bolt-modules/boltlib/spec/functions/puppetdb_fact.rb b/bolt-modules/boltlib/spec/functions/puppetdb_fact.rb index 73aeafc30..9618c5d91 100644 --- a/bolt-modules/boltlib/spec/functions/puppetdb_fact.rb +++ b/bolt-modules/boltlib/spec/functions/puppetdb_fact.rb @@ -3,8 +3,6 @@ require 'spec_helper' describe 'puppetdb_fact' do - include PuppetlabsSpec::Fixtures - let(:pdb_client) { mock('pdb_client') } around(:each) do |example| diff --git a/bolt-modules/boltlib/spec/functions/puppetdb_query.rb b/bolt-modules/boltlib/spec/functions/puppetdb_query.rb index c32038967..18fc4af8c 100644 --- a/bolt-modules/boltlib/spec/functions/puppetdb_query.rb +++ b/bolt-modules/boltlib/spec/functions/puppetdb_query.rb @@ -3,8 +3,6 @@ require 'spec_helper' describe 'puppetdb_query' do - include PuppetlabsSpec::Fixtures - let(:pdb_client) { mock('pdb_client') } around(:each) do |example| diff --git a/bolt-modules/boltlib/spec/functions/remove_from_group_spec.rb b/bolt-modules/boltlib/spec/functions/remove_from_group_spec.rb index 230c49e36..7f8820dc7 100644 --- a/bolt-modules/boltlib/spec/functions/remove_from_group_spec.rb +++ b/bolt-modules/boltlib/spec/functions/remove_from_group_spec.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true describe 'remove_from_group' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:config) { Bolt::Config.default } let(:pal) { nil } diff --git a/bolt-modules/boltlib/spec/functions/resolve_references_spec.rb b/bolt-modules/boltlib/spec/functions/resolve_references_spec.rb index f17a6a6cd..c51421170 100644 --- a/bolt-modules/boltlib/spec/functions/resolve_references_spec.rb +++ b/bolt-modules/boltlib/spec/functions/resolve_references_spec.rb @@ -4,8 +4,6 @@ require 'bolt/plugin' describe 'resolve_references' do - include PuppetlabsSpec::Fixtures - let(:project) { Bolt::Project.create_project('./spec/fixtures') } let(:config) { Bolt::Config.new(project, {}) } let(:pal) { diff --git a/bolt-modules/boltlib/spec/functions/run_plan_spec.rb b/bolt-modules/boltlib/spec/functions/run_plan_spec.rb index 033c70ffe..1eab274bb 100644 --- a/bolt-modules/boltlib/spec/functions/run_plan_spec.rb +++ b/bolt-modules/boltlib/spec/functions/run_plan_spec.rb @@ -7,8 +7,6 @@ require 'puppet/pops/types/p_sensitive_type' describe 'run_plan' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:tasks_enabled) { true } let(:inventory) { Bolt::Inventory.empty } diff --git a/bolt-modules/boltlib/spec/functions/run_script_spec.rb b/bolt-modules/boltlib/spec/functions/run_script_spec.rb index 1093cd704..bfc1ab8aa 100644 --- a/bolt-modules/boltlib/spec/functions/run_script_spec.rb +++ b/bolt-modules/boltlib/spec/functions/run_script_spec.rb @@ -7,8 +7,6 @@ require 'bolt/result_set' describe 'run_script' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:inventory) { mock('inventory') } let(:tasks_enabled) { true } diff --git a/bolt-modules/boltlib/spec/functions/run_task_spec.rb b/bolt-modules/boltlib/spec/functions/run_task_spec.rb index a53146216..320852a64 100644 --- a/bolt-modules/boltlib/spec/functions/run_task_spec.rb +++ b/bolt-modules/boltlib/spec/functions/run_task_spec.rb @@ -23,8 +23,6 @@ def matches?(available_parameters) end describe 'run_task' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:inventory) { Bolt::Inventory.empty } let(:tasks_enabled) { true } @@ -399,24 +397,6 @@ def mock_task(executable, input_method) .and_return(result_set) end end - - context 'using the pcp transport' do - let(:task_name) { 'Test::Noop' } - let(:hostname) { 'pcp://a.b.com' } - let(:task_params) { { '_noop' => true } } - - it 'sets the noop metaparameter when running in noop mode' do - executor.expects(:run_task).with([target], - anything, - { '_noop' => true }, - { noop: true }, - []) - .returns(result_set) - - is_expected.to run - .with_params(task_name, hostname, task_params) - end - end end context 'running in parallel' do diff --git a/bolt-modules/boltlib/spec/functions/run_task_with_spec.rb b/bolt-modules/boltlib/spec/functions/run_task_with_spec.rb index 80cb1c0c9..433aa47c2 100644 --- a/bolt-modules/boltlib/spec/functions/run_task_with_spec.rb +++ b/bolt-modules/boltlib/spec/functions/run_task_with_spec.rb @@ -21,8 +21,6 @@ def matches?(available_parameters) end describe 'run_task_with' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:inventory) { Bolt::Inventory.empty } let(:tasks_enabled) { true } @@ -395,25 +393,6 @@ def mock_task(executable, input_method) .and_return(result_set) end end - - context 'using the pcp transport' do - let(:task_name) { 'Test::Noop' } - let(:hostname) { 'pcp://a.b.com' } - let(:hostname2) { 'pcp://x.y.com' } - let(:task_params) { { '_noop' => true } } - - it 'sets the noop metaparameter when running in noop mode' do - executor.expects(:run_task_with) - .with(target_mapping, anything, { noop: true }, []) - .returns(result_set) - inventory.expects(:get_targets).with(hosts).returns(targets) - - is_expected.to run - .with_params('Test::Noop', hosts, '_noop' => true) - .with_lambda { |_| {} } - .and_return(result_set) - end - end end context 'it validates the task parameters' do diff --git a/bolt-modules/boltlib/spec/functions/set_config_spec.rb b/bolt-modules/boltlib/spec/functions/set_config_spec.rb index b3b0972df..f0c66d00c 100644 --- a/bolt-modules/boltlib/spec/functions/set_config_spec.rb +++ b/bolt-modules/boltlib/spec/functions/set_config_spec.rb @@ -5,8 +5,6 @@ require 'bolt/inventory' describe 'set_config' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:inventory) { Bolt::Inventory.empty } let(:target) { inventory.get_target('example') } diff --git a/bolt-modules/boltlib/spec/functions/set_feature_spec.rb b/bolt-modules/boltlib/spec/functions/set_feature_spec.rb index ad9715563..1dbfff493 100644 --- a/bolt-modules/boltlib/spec/functions/set_feature_spec.rb +++ b/bolt-modules/boltlib/spec/functions/set_feature_spec.rb @@ -5,8 +5,6 @@ require 'bolt/inventory' describe 'set_feature' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:inventory) { Bolt::Inventory.empty } let(:target) { inventory.get_target('example') } diff --git a/bolt-modules/boltlib/spec/functions/set_var_spec.rb b/bolt-modules/boltlib/spec/functions/set_var_spec.rb index 34a41be57..c91bd59f2 100644 --- a/bolt-modules/boltlib/spec/functions/set_var_spec.rb +++ b/bolt-modules/boltlib/spec/functions/set_var_spec.rb @@ -5,8 +5,6 @@ require 'bolt/inventory' describe 'set_var' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:inventory) { Bolt::Inventory.empty } let(:target) { inventory.get_target('example') } diff --git a/bolt-modules/boltlib/spec/functions/upload_file_spec.rb b/bolt-modules/boltlib/spec/functions/upload_file_spec.rb index 4a924b875..ea78dea67 100644 --- a/bolt-modules/boltlib/spec/functions/upload_file_spec.rb +++ b/bolt-modules/boltlib/spec/functions/upload_file_spec.rb @@ -7,8 +7,6 @@ require 'bolt/target' describe 'upload_file' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:inventory) { mock('inventory') } let(:tasks_enabled) { true } diff --git a/bolt-modules/boltlib/spec/functions/vars_spec.rb b/bolt-modules/boltlib/spec/functions/vars_spec.rb index 2d4ed09d0..7cd7938ab 100644 --- a/bolt-modules/boltlib/spec/functions/vars_spec.rb +++ b/bolt-modules/boltlib/spec/functions/vars_spec.rb @@ -5,8 +5,6 @@ require 'bolt/inventory' describe 'vars' do - include PuppetlabsSpec::Fixtures - let(:executor) { Bolt::Executor.new } let(:inventory) { Bolt::Inventory.empty } let(:hostname) { 'example' } diff --git a/bolt-modules/boltlib/spec/functions/wait_spec.rb b/bolt-modules/boltlib/spec/functions/wait_spec.rb index 6fea89baa..4c7198e67 100644 --- a/bolt-modules/boltlib/spec/functions/wait_spec.rb +++ b/bolt-modules/boltlib/spec/functions/wait_spec.rb @@ -6,8 +6,6 @@ require 'bolt/plan_future' describe 'wait' do - include PuppetlabsSpec::Fixtures - let(:name) { "Pluralize" } let(:future) { Bolt::PlanFuture.new('foo', name, plan_id: 1234) } let(:executor) { Bolt::Executor.new } diff --git a/bolt-modules/boltlib/spec/spec_helper.rb b/bolt-modules/boltlib/spec/spec_helper.rb index 072e43d3e..b8172c804 100644 --- a/bolt-modules/boltlib/spec/spec_helper.rb +++ b/bolt-modules/boltlib/spec/spec_helper.rb @@ -1,12 +1,5 @@ # frozen_string_literal: true -require 'puppet_pal' -require 'bolt/pal' +require_relative '../../shared_spec_helper' -# Ensure tasks are enabled when rspec-puppet sets up an environment -# so we get task loaders. -Puppet[:tasks] = true -Bolt::PAL.load_puppet -RSpec.configure do |c| - c.mock_with :mocha -end +configure_rspec_for_this_module!(with_bolt_pal: true) \ No newline at end of file diff --git a/bolt-modules/ctrl/Rakefile b/bolt-modules/ctrl/Rakefile new file mode 100644 index 000000000..894155e15 --- /dev/null +++ b/bolt-modules/ctrl/Rakefile @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require 'voxpupuli/test/rake' diff --git a/bolt-modules/ctrl/spec/spec_helper.rb b/bolt-modules/ctrl/spec/spec_helper.rb index 14377d7b4..739f44a4b 100644 --- a/bolt-modules/ctrl/spec/spec_helper.rb +++ b/bolt-modules/ctrl/spec/spec_helper.rb @@ -1,10 +1,5 @@ # frozen_string_literal: true -require 'puppet_pal' +require_relative '../../shared_spec_helper' -# Ensure tasks are enabled when rspec-puppet sets up an environment -# so we get task loaders. -Puppet[:tasks] = true -RSpec.configure do |c| - c.mock_with :mocha -end +configure_rspec_for_this_module! diff --git a/bolt-modules/dir/Rakefile b/bolt-modules/dir/Rakefile new file mode 100644 index 000000000..894155e15 --- /dev/null +++ b/bolt-modules/dir/Rakefile @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require 'voxpupuli/test/rake' diff --git a/bolt-modules/dir/spec/functions/dir/children_spec.rb b/bolt-modules/dir/spec/functions/dir/children_spec.rb index 57761919b..58dd80e16 100644 --- a/bolt-modules/dir/spec/functions/dir/children_spec.rb +++ b/bolt-modules/dir/spec/functions/dir/children_spec.rb @@ -4,8 +4,6 @@ require 'fileutils' describe 'dir::children' do - include PuppetlabsSpec::Fixtures - let(:path) { fixtures('modules', 'test') } around(:each) do |example| diff --git a/bolt-modules/dir/spec/spec_helper.rb b/bolt-modules/dir/spec/spec_helper.rb index 14377d7b4..739f44a4b 100644 --- a/bolt-modules/dir/spec/spec_helper.rb +++ b/bolt-modules/dir/spec/spec_helper.rb @@ -1,10 +1,5 @@ # frozen_string_literal: true -require 'puppet_pal' +require_relative '../../shared_spec_helper' -# Ensure tasks are enabled when rspec-puppet sets up an environment -# so we get task loaders. -Puppet[:tasks] = true -RSpec.configure do |c| - c.mock_with :mocha -end +configure_rspec_for_this_module! diff --git a/bolt-modules/file/Rakefile b/bolt-modules/file/Rakefile new file mode 100644 index 000000000..894155e15 --- /dev/null +++ b/bolt-modules/file/Rakefile @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require 'voxpupuli/test/rake' diff --git a/bolt-modules/file/spec/spec_helper.rb b/bolt-modules/file/spec/spec_helper.rb index 14377d7b4..739f44a4b 100644 --- a/bolt-modules/file/spec/spec_helper.rb +++ b/bolt-modules/file/spec/spec_helper.rb @@ -1,10 +1,5 @@ # frozen_string_literal: true -require 'puppet_pal' +require_relative '../../shared_spec_helper' -# Ensure tasks are enabled when rspec-puppet sets up an environment -# so we get task loaders. -Puppet[:tasks] = true -RSpec.configure do |c| - c.mock_with :mocha -end +configure_rspec_for_this_module! diff --git a/bolt-modules/log/Rakefile b/bolt-modules/log/Rakefile new file mode 100644 index 000000000..894155e15 --- /dev/null +++ b/bolt-modules/log/Rakefile @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require 'voxpupuli/test/rake' diff --git a/bolt-modules/log/spec/spec_helper.rb b/bolt-modules/log/spec/spec_helper.rb index 072e43d3e..5f9a98433 100644 --- a/bolt-modules/log/spec/spec_helper.rb +++ b/bolt-modules/log/spec/spec_helper.rb @@ -1,12 +1,5 @@ # frozen_string_literal: true -require 'puppet_pal' -require 'bolt/pal' +require_relative '../../shared_spec_helper' -# Ensure tasks are enabled when rspec-puppet sets up an environment -# so we get task loaders. -Puppet[:tasks] = true -Bolt::PAL.load_puppet -RSpec.configure do |c| - c.mock_with :mocha -end +configure_rspec_for_this_module!(with_bolt_pal: true) diff --git a/bolt-modules/out/Rakefile b/bolt-modules/out/Rakefile new file mode 100644 index 000000000..894155e15 --- /dev/null +++ b/bolt-modules/out/Rakefile @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require 'voxpupuli/test/rake' diff --git a/bolt-modules/out/spec/spec_helper.rb b/bolt-modules/out/spec/spec_helper.rb index 072e43d3e..5f9a98433 100644 --- a/bolt-modules/out/spec/spec_helper.rb +++ b/bolt-modules/out/spec/spec_helper.rb @@ -1,12 +1,5 @@ # frozen_string_literal: true -require 'puppet_pal' -require 'bolt/pal' +require_relative '../../shared_spec_helper' -# Ensure tasks are enabled when rspec-puppet sets up an environment -# so we get task loaders. -Puppet[:tasks] = true -Bolt::PAL.load_puppet -RSpec.configure do |c| - c.mock_with :mocha -end +configure_rspec_for_this_module!(with_bolt_pal: true) diff --git a/bolt-modules/prompt/Rakefile b/bolt-modules/prompt/Rakefile new file mode 100644 index 000000000..894155e15 --- /dev/null +++ b/bolt-modules/prompt/Rakefile @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require 'voxpupuli/test/rake' diff --git a/bolt-modules/prompt/spec/spec_helper.rb b/bolt-modules/prompt/spec/spec_helper.rb index 072e43d3e..5f9a98433 100644 --- a/bolt-modules/prompt/spec/spec_helper.rb +++ b/bolt-modules/prompt/spec/spec_helper.rb @@ -1,12 +1,5 @@ # frozen_string_literal: true -require 'puppet_pal' -require 'bolt/pal' +require_relative '../../shared_spec_helper' -# Ensure tasks are enabled when rspec-puppet sets up an environment -# so we get task loaders. -Puppet[:tasks] = true -Bolt::PAL.load_puppet -RSpec.configure do |c| - c.mock_with :mocha -end +configure_rspec_for_this_module!(with_bolt_pal: true) diff --git a/bolt-modules/shared_spec_helper.rb b/bolt-modules/shared_spec_helper.rb new file mode 100644 index 000000000..a1d367a2f --- /dev/null +++ b/bolt-modules/shared_spec_helper.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +require 'voxpupuli/test/spec_helper' + +def fixtures(*subdirs) + File.join('spec', 'fixtures', *subdirs) +end + +def make_module_symlink(module_name = File.basename(Dir.pwd)) + target = File.join('spec', 'fixtures', 'modules', module_name) + RSpec::Puppet::Setup.safe_make_link('.', target, false) +end + +def configure_rspec_for_this_module!(module_name = File.basename(Dir.pwd), with_bolt_pal: false) + # Ensure tasks are enabled when rspec-puppet sets up an environment so we get task loaders. + Puppet[:tasks] = true + + if with_bolt_pal + require 'bolt/pal' + Bolt::PAL.load_puppet + end + + RSpec.configure do |c| + c.mock_with :mocha + # Create the module symlink before the suite + c.before(:all) do + target = File.join('spec', 'fixtures', 'modules', module_name) + RSpec::Puppet::Setup.safe_make_link('.', target, false) + end + # Delete the module symlink after the suite + c.after(:all) do + RSpec::Puppet::Setup.safe_teardown_links(module_name) + end + end +end diff --git a/bolt-modules/system/Rakefile b/bolt-modules/system/Rakefile new file mode 100644 index 000000000..894155e15 --- /dev/null +++ b/bolt-modules/system/Rakefile @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require 'voxpupuli/test/rake' diff --git a/bolt-modules/system/spec/spec_helper.rb b/bolt-modules/system/spec/spec_helper.rb index 14377d7b4..739f44a4b 100644 --- a/bolt-modules/system/spec/spec_helper.rb +++ b/bolt-modules/system/spec/spec_helper.rb @@ -1,10 +1,5 @@ # frozen_string_literal: true -require 'puppet_pal' +require_relative '../../shared_spec_helper' -# Ensure tasks are enabled when rspec-puppet sets up an environment -# so we get task loaders. -Puppet[:tasks] = true -RSpec.configure do |c| - c.mock_with :mocha -end +configure_rspec_for_this_module! diff --git a/openbolt.gemspec b/openbolt.gemspec index 88b820c97..edd1ca5a8 100644 --- a/openbolt.gemspec +++ b/openbolt.gemspec @@ -70,5 +70,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency "octokit", ">= 4.0", "< 9" spec.add_development_dependency "rake", ">= 12.0", "< 14" spec.add_development_dependency "rspec", ">= 3.0", "< 4" - spec.add_development_dependency 'voxpupuli-rubocop', '~> 5.0.0' + spec.add_development_dependency 'voxpupuli-rubocop', "~> 5.2.0" + spec.add_development_dependency 'voxpupuli-test', "~> 14.0.0" end diff --git a/rakelib/tests.rake b/rakelib/tests.rake index 2254585fa..ea7c0b895 100644 --- a/rakelib/tests.rake +++ b/rakelib/tests.rake @@ -140,13 +140,14 @@ begin desc "Run RSpec tests for Bolt's bundled content" task :modules do + require 'parallel' + success = true # Test core modules - Pathname.new("#{__dir__}/../bolt-modules").each_child do |mod| - Dir.chdir(mod) do - sh 'rake spec' do |ok, _| - success = false unless ok - end + module_dirs = Pathname.new("bolt-modules").each_child.filter {|f| File.directory?(f)} + success = Parallel.all?(module_dirs) do |dir| + sh "rake -C '#{dir}' spec" do |ok, _| + ok end end # Test modules