diff --git a/spec/classes/settings_header_spec.rb b/spec/classes/settings_header_spec.rb new file mode 100644 index 00000000..9a074c36 --- /dev/null +++ b/spec/classes/settings_header_spec.rb @@ -0,0 +1,68 @@ +require 'spec_helper' + +describe 'pulpcore' do + on_supported_os.each do |os, os_facts| + context "on #{os}" do + let(:facts) { os_facts } + + context 'default params' do + it { is_expected.to compile.with_all_deps } + + it 'adds default header to settings.py' do + is_expected.to contain_concat__fragment('base') + .with_content( + Regexp.new(<<~HEADER.chomp), + ################################################################################ + # !!! WARNING: DO NOT EDIT THIS FILE !!! # + ################################################################################ + # File managed by Puppet. # + # Module: pulpcore # + ################################################################################ + # Not only are your edits likely to be overwritten, there is also a strong # + # possibility of breaking your system if you change configuration here without # + # making required changes elsewhere. Refer to the documentation you used to # + # install Pulpcore to determine the safe and persistent way to modify the # + # configuration. # + ################################################################################ + + CONTENT_HOST = + HEADER + ) + end + end + + context 'with custom config header strings' do + let :manifest do + <<~PUPPET + class { pulpcore::header_strings: + custom_installer_name => 'my_pulpcore_installer', + custom_settings_explanation => "Don't even think about it." + } + + include pulpcore + PUPPET + end + + it { is_expected.to compile.with_all_deps } + + it 'adds customized header to settings.py' do + is_expected.to contain_concat__fragment('base') + .with_content( + Regexp.new(<<~HEADER.chomp), + ################################################################################ + # !!! WARNING: DO NOT EDIT THIS FILE !!! # + ################################################################################ + # File managed by my_pulpcore_installer. # + # Module: pulpcore # + ################################################################################ + # Don't even think about it. # + ################################################################################ + + CONTENT_HOST = + HEADER + ) + end + end + end + end +end