Using rspec to check creation of template

Posted by Brian on Server Fault See other posts from Server Fault or by Brian
Published on 2014-06-04T20:39:54Z Indexed on 2014/06/04 21:27 UTC
Read the original article Hit count: 188

Filed under:

I am trying to use rspec with puppet to check the generation of a configuration file from an .erb file. However, I get the error

1) customizations should generate valid logstash.conf
     Failure/Error: content = catalogue.resource('file', 'logstash.conf').send(:parameters)[:content]
     ArgumentError:
       wrong number of arguments (0 for 1)
     # ./spec/classes/logstash_spec.rb:29:in `catalogue'
     # ./spec/classes/logstash_spec.rb:29

And the logstash_spec.rb:

describe "customizations" do
    let(:params) { {:template => "profiles/logstash/output_broker.erb", :options => {'opt_a' => 'value_a' } } }
    it 'should generate valid logstash.conf' do
      content = catalogue.resource('file', 'logstash.conf').send(:parameters)[:content]
      content.should match('logstash')
    end
end

© Server Fault or respective owner

Related posts about puppet