diff --git a/package-testing/spec/package/airgapped_usage_spec.rb b/package-testing/spec/package/airgapped_usage_spec.rb index 59e44a557..c46303e71 100644 --- a/package-testing/spec/package/airgapped_usage_spec.rb +++ b/package-testing/spec/package/airgapped_usage_spec.rb @@ -29,6 +29,8 @@ context 'when validating the module' do context "with puppet #{PDK_VERSION[:latest][:major]}" do + let(:ruby_version) { ruby_for_puppet(PDK_VERSION[:latest][:major]) } + describe command("pdk validate --puppet-version=#{PDK_VERSION[:latest][:major]}") do let(:cwd) { module_name } @@ -42,7 +44,7 @@ subject { super().content.gsub(/^DEPENDENCIES.+?\n\n/m, '') } it 'is identical to the vendored lockfile' do - vendored_lockfile = File.join(install_dir, 'share', 'cache', "Gemfile-#{PDK_VERSION[:latest][:ruby]}.lock") + vendored_lockfile = File.join(install_dir, 'share', 'cache', "Gemfile-#{ruby_version}.lock") expect(subject).to eq(file(vendored_lockfile).content.gsub(/^DEPENDENCIES.+?\n\n/m, '')) end diff --git a/package-testing/spec/package/support/spec_utils.rb b/package-testing/spec/package/support/spec_utils.rb index 3a53b43ec..6b211715b 100644 --- a/package-testing/spec/package/support/spec_utils.rb +++ b/package-testing/spec/package/support/spec_utils.rb @@ -48,11 +48,11 @@ def latest_ruby def ruby_for_puppet(pupver) ruby_pattern = case pupver - when /^4\./ then '2.1.*' - when /^5\./ then '2.4.*' - when /^6\./ then '2.5.*' - when /^7\./ then '2.7.*' - when /^8\./ then '3.2.*' + when /^4/ then '2.1.*' + when /^5/ then '2.4.*' + when /^6/ then '2.5.*' + when /^7/ then '2.7.*' + when /^8/ then '3.2.*' end return unless ruby_pattern diff --git a/package-testing/spec/package/validate_a_new_module_spec.rb b/package-testing/spec/package/validate_a_new_module_spec.rb index 3a36e40d4..abd5d449e 100644 --- a/package-testing/spec/package/validate_a_new_module_spec.rb +++ b/package-testing/spec/package/validate_a_new_module_spec.rb @@ -19,6 +19,8 @@ context 'when validating the module' do context "with puppet #{PDK_VERSION[:latest][:major]}" do + let(:ruby_version) { ruby_for_puppet(PDK_VERSION[:latest][:major]) } + describe command("pdk validate --puppet-version=#{PDK_VERSION[:latest][:major]}") do let(:cwd) { module_name } @@ -32,7 +34,7 @@ subject { super().content.gsub(/^DEPENDENCIES.+?\n\n/m, '') } it 'is identical to the vendored lockfile' do - vendored_lockfile = File.join(install_dir, 'share', 'cache', "Gemfile-#{PDK_VERSION[:latest][:ruby]}.lock") + vendored_lockfile = File.join(install_dir, 'share', 'cache', "Gemfile-#{ruby_version}.lock") expect(subject).to eq(file(vendored_lockfile).content.gsub(/^DEPENDENCIES.+?\n\n/m, '')) end