diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9361dd3be..307ae7212 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,11 +18,8 @@ jobs: fail-fast: false matrix: ruby_version: - - "2.7" - "3.2" include: - - ruby-version: '2.7' - puppet_gem_version: '~> 7.0' - ruby_version: '3.2' puppet_gem_version: '~> 8.0' runs_on: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 7d9446e1a..fb1e4e50a 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -11,11 +11,8 @@ jobs: fail-fast: false matrix: ruby_version: - - "2.7" - "3.2" include: - - ruby-version: '2.7' - puppet_gem_version: '~> 7.0' - ruby_version: '3.2' puppet_gem_version: '~> 8.0' runs_on: diff --git a/.rubocop.yml b/.rubocop.yml index c73c846aa..04c51f1ab 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,6 +4,9 @@ inherit_from: .rubocop_todo.yml inherit_gem: voxpupuli-rubocop: rubocop.yml +AllCops: + TargetRubyVersion: '3.1' + # Disabled Style/ClassAndModuleChildren: Enabled: false diff --git a/lib/rspec-puppet/matchers/create_generic.rb b/lib/rspec-puppet/matchers/create_generic.rb index d43e3952a..02a4936b6 100644 --- a/lib/rspec-puppet/matchers/create_generic.rb +++ b/lib/rspec-puppet/matchers/create_generic.rb @@ -30,10 +30,10 @@ def with(*args) self end - def only_with(*args, &block) + def only_with(*args, &) params = args.shift @expected_params_count = (@expected_params_count || 0) + params.compact.size - with(params, &block) + with(params, &) end def without(*args) @@ -62,7 +62,7 @@ def that_comes_before(resource) self end - def method_missing(method, *args, &block) + def method_missing(method, *args, &) case method.to_s when /^with_/ param = method.to_s.gsub(/^with_/, '') @@ -320,7 +320,7 @@ def precedes?(first, second) before_refs = relationship_refs(u, :before) + relationship_refs(u, :notify) require_refs = relationship_refs(v, :require) + relationship_refs(u, :subscribe) - return true if before_refs.include?(v.to_ref) || require_refs.include?(u.to_ref) || (before_refs & require_refs).any? + return true if before_refs.include?(v.to_ref) || require_refs.include?(u.to_ref) || before_refs.intersect?(require_refs) end end diff --git a/lib/rspec-puppet/matchers/dynamic_matchers.rb b/lib/rspec-puppet/matchers/dynamic_matchers.rb index 200d99be6..7553d9d8b 100644 --- a/lib/rspec-puppet/matchers/dynamic_matchers.rb +++ b/lib/rspec-puppet/matchers/dynamic_matchers.rb @@ -2,10 +2,10 @@ module RSpec::Puppet module ManifestMatchers - def method_missing(method, *args, &block) + def method_missing(method, *args, &) if /^(create|contain)_/.match?(method.to_s) return RSpec::Puppet::ManifestMatchers::CreateGeneric.new(method, *args, - &block) + &) end if /^have_.+_count$/.match?(method.to_s) return RSpec::Puppet::ManifestMatchers::CountGeneric.new(nil, args[0], @@ -18,7 +18,7 @@ def method_missing(method, *args, &block) end module FunctionMatchers - def method_missing(method, *args, &block) + def method_missing(method, *args, &) return RSpec::Puppet::FunctionMatchers::Run.new if method == :run super @@ -26,8 +26,8 @@ def method_missing(method, *args, &block) end module TypeMatchers - def method_missing(method, *args, &block) - return RSpec::Puppet::TypeMatchers::CreateGeneric.new(method, *args, &block) if method == :be_valid_type + def method_missing(method, ...) + return RSpec::Puppet::TypeMatchers::CreateGeneric.new(method, ...) if method == :be_valid_type super end diff --git a/lib/rspec-puppet/matchers/raise_error.rb b/lib/rspec-puppet/matchers/raise_error.rb index d87acce6d..ab92b2700 100644 --- a/lib/rspec-puppet/matchers/raise_error.rb +++ b/lib/rspec-puppet/matchers/raise_error.rb @@ -19,9 +19,9 @@ def supports_value_expectations? end def raise_error( - error = defined?(RSpec::Matchers::BuiltIn::RaiseError::UndefinedValue) ? RSpec::Matchers::BuiltIn::RaiseError::UndefinedValue : nil, message = nil, &block + error = defined?(RSpec::Matchers::BuiltIn::RaiseError::UndefinedValue) ? RSpec::Matchers::BuiltIn::RaiseError::UndefinedValue : nil, message = nil, & ) - RaiseError.new(error, message, &block) + RaiseError.new(error, message, &) end end end diff --git a/lib/rspec-puppet/matchers/run.rb b/lib/rspec-puppet/matchers/run.rb index 82053bf1f..a0cfdace7 100644 --- a/lib/rspec-puppet/matchers/run.rb +++ b/lib/rspec-puppet/matchers/run.rb @@ -143,7 +143,7 @@ def failure_message_actual(type) def failure_message_generic(type, _func_obj) # message is mutable - message = +"expected #{func_name}(#{func_params}) to " + message = "expected #{func_name}(#{func_params}) to " message << 'not ' if type == :should_not if @has_expected_return diff --git a/lib/rspec-puppet/support.rb b/lib/rspec-puppet/support.rb index 46efbb6fc..a597dc512 100644 --- a/lib/rspec-puppet/support.rb +++ b/lib/rspec-puppet/support.rb @@ -128,7 +128,7 @@ def site_pp_str File.read(path) elsif File.directory?(path) # Read and concatenate all .pp files. - Dir[File.join(path, '*.pp')].sort.map do |f| + Dir[File.join(path, '*.pp')].map do |f| File.read(f) end.join("\n") else diff --git a/rspec-puppet.gemspec b/rspec-puppet.gemspec index 56206936f..db07d1cb6 100644 --- a/rspec-puppet.gemspec +++ b/rspec-puppet.gemspec @@ -24,5 +24,5 @@ Gem::Specification.new do |s| s.authors = ['Tim Sharpe', 'Puppet, Inc.', 'Community Contributors'] s.email = ['tim@sharpe.id.au', 'modules-team@puppet.com'] - s.required_ruby_version = Gem::Requirement.new('>= 2.7.0') + s.required_ruby_version = Gem::Requirement.new('>= 3.1.0') end