Skip to content

Commit

Permalink
Support fact stringyfication
Browse files Browse the repository at this point in the history
FacterDB/rspec-puppet-facts have an option switch the symbolized
first-level keys in a factset to strings (all following/nested keys are
always strings). This PR makes this configuration opt-in so we can
switch over modules from symbols to strings in their spec files.
  • Loading branch information
bastelfreak committed Jun 15, 2024
1 parent 399dea6 commit 870fcd3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions config_defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml:
delete: true
spec/spec_helper.rb:
add_mocked_facts: true
facterdb_string_keys: false
mock_with: false
spec/spec_helper_acceptance.rb:
unmanaged: true
Expand Down
3 changes: 2 additions & 1 deletion moduleroot/spec/spec_helper.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__))

require 'voxpupuli/test/spec_helper'
<%- if @configs['hiera_config'] || @configs['mock_with'] -%>
<%- if @configs['hiera_config'] || @configs['mock_with'] || @configs['facterdb_string_keys'] -%>

RSpec.configure do |c|
<%- if @configs['hiera_config'] -%>
Expand All @@ -17,6 +17,7 @@ RSpec.configure do |c|
<%- if @configs['mock_with'] -%>
c.mock_with <%= @configs['mock_with'] %>
<%- end -%>
c.facterdb_string_keys = <%= @configs['facterdb_string_keys'] %>
end
<%- end -%>
<%- if @configs['add_mocked_facts'] -%>
Expand Down

0 comments on commit 870fcd3

Please sign in to comment.