diff --git a/spec/defines/virtualhost_spec.rb b/spec/defines/virtualhost_spec.rb index 0676495..29b0b7f 100644 --- a/spec/defines/virtualhost_spec.rb +++ b/spec/defines/virtualhost_spec.rb @@ -109,6 +109,18 @@ } end + context 'with deeply nested component options' do + let(:params) { { components: { 'comp1' => { 'type' => 'muc', 'options' => { 'bo' => true, 'arr' => %w[one two], 'str' => 'string' } } } } } + + it { + is_expected.to contain_file(path_avail). \ + with_content(%r{^Component "comp1" "muc"$}). \ + with_content(%r{^ bo = true;$}). \ + with_content(%r{^ arr = { "one"; "two" };$}).\ + with_content(%r{^ str = "string";$}) + } + end + context 'with disco items' do let(:params) { { disco_items: %w[foo bar] } } diff --git a/templates/virtualhost.cfg.erb b/templates/virtualhost.cfg.erb index 8cd4fc2..1c637f1 100644 --- a/templates/virtualhost.cfg.erb +++ b/templates/virtualhost.cfg.erb @@ -49,7 +49,7 @@ Component "<%= name %>" <% if component.include?('type') then %>"<%= component[' <%- end -%> <%- if component.include?('options') -%> <%- component['options'].sort.each do |k, v| -%> - <%= k %> = <%= v %>; + <%= k %> = <%= print_recursive(v) %>; <%- end -%> <%- end -%> <% end -%>