From 9edbce6e2c081115644a7fea6662d45b39a7a6fb Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 24 Jun 2024 14:16:36 +0200 Subject: [PATCH] facterdb_string_keys: switch to strings --- .sync.yml | 2 ++ spec/classes/autofs_spec.rb | 10 +++++----- spec/defines/map_spec.rb | 2 +- spec/defines/mount_spec.rb | 4 ++-- spec/spec_helper.rb | 4 ++++ 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.sync.yml b/.sync.yml index 9562df8..cbc1154 100644 --- a/.sync.yml +++ b/.sync.yml @@ -9,3 +9,5 @@ spec/spec_helper_acceptance.rb: enabled_lint_checks: - parameter_documentation - parameter_types +spec/spec_helper.rb: + facterdb_string_keys: true diff --git a/spec/classes/autofs_spec.rb b/spec/classes/autofs_spec.rb index 4cdd3a3..d1b0b00 100644 --- a/spec/classes/autofs_spec.rb +++ b/spec/classes/autofs_spec.rb @@ -10,18 +10,18 @@ context "on #{os}" do let(:facts) { os_facts } let(:service) do - case facts[:os]['family'] + case facts['os']['family'] when 'AIX' then 'automountd' when 'FreeBSD' then 'automount' else 'autofs' end end let(:package) do - case facts[:os]['family'] + case facts['os']['family'] when 'AIX' 'bos.net.nfs.client' when 'Solaris' - if facts[:os]['release']['major'].to_s == '11' + if facts['os']['release']['major'].to_s == '11' 'system/file-system/autofs' else 'SUNWatfsu' # and SUNWatfsr, but close enough @@ -38,7 +38,7 @@ it { is_expected.to contain_class('autofs::service') } # Check Package and service - if os_facts[:os]['family'] == 'FreeBSD' + if os_facts['os']['family'] == 'FreeBSD' it { is_expected.to contain_service('automountd').with_ensure('running') } it { is_expected.to contain_service('autounmountd').with_ensure('running') } else @@ -58,7 +58,7 @@ } end - it { is_expected.to contain_package(package).with_ensure('absent') } if os_facts[:os]['family'] != 'FreeBSD' + it { is_expected.to contain_package(package).with_ensure('absent') } if os_facts['os']['family'] != 'FreeBSD' end context 'should declare mount points' do diff --git a/spec/defines/map_spec.rb b/spec/defines/map_spec.rb index 8aa01d5..d77c7bd 100644 --- a/spec/defines/map_spec.rb +++ b/spec/defines/map_spec.rb @@ -8,7 +8,7 @@ let(:title) { 'data' } let(:pre_condition) { 'include autofs' } let(:group) do - case facts[:os]['family'] + case facts['os']['family'] when 'AIX' then 'system' when 'FreeBSD' then 'wheel' else 'root' diff --git a/spec/defines/mount_spec.rb b/spec/defines/mount_spec.rb index 6c01bb7..00bafae 100644 --- a/spec/defines/mount_spec.rb +++ b/spec/defines/mount_spec.rb @@ -7,13 +7,13 @@ let(:title) { 'auto.home' } let(:pre_condition) { 'include autofs' } let(:group) do - case facts[:os]['family'] + case facts['os']['family'] when 'AIX' then 'system' when 'FreeBSD' then 'wheel' else 'root' end end - let(:master_map_file) { %w[AIX FreeBSD Solaris].include?(facts[:os]['family']) ? '/etc/auto_master' : '/etc/auto.master' } + let(:master_map_file) { %w[AIX FreeBSD Solaris].include?(facts['os']['family']) ? '/etc/auto_master' : '/etc/auto.master' } let(:facts) { os_facts } # rubocop:disable RSpec/MultipleMemoizedHelpers diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9efb4ae..d9a3f29 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,6 +9,10 @@ require 'voxpupuli/test/spec_helper' +RSpec.configure do |c| + c.facterdb_string_keys = true +end + add_mocked_facts! if File.exist?(File.join(__dir__, 'default_module_facts.yml'))