diff --git a/spec/defines/group_spec.rb b/spec/defines/group_spec.rb index 18e8084..e2c9639 100644 --- a/spec/defines/group_spec.rb +++ b/spec/defines/group_spec.rb @@ -28,6 +28,28 @@ end end + context 'with template' do + let(:title) { 'rspec/%u' } + + content = <<-END.gsub(/^\s+\|/, '') + |# This file is being maintained by Puppet. + |# DO NOT EDIT + | + |template rspec/%u { + | + |} + END + + it do + should contain_file('/etc/cgconfig.d/rspec-%u.conf').with({ + 'ensure' => 'file', + 'notify' => 'Service[cgconfig]', + 'content' => content, + }) + end + end + + context 'with all parameters set to valid values' do let(:params) do { diff --git a/templates/group.conf.erb b/templates/group.conf.erb index b3842f6..382dd6b 100644 --- a/templates/group.conf.erb +++ b/templates/group.conf.erb @@ -1,7 +1,11 @@ # This file is being maintained by Puppet. # DO NOT EDIT +<% unless @name.include? "%" -%> group <%= @name %> { +<% else -%> +template <%= @name %> { +<% end -%> <% unless @permissions.empty? -%> perm {