Sha256: 85b8a1903b9deaeae16400601fd6a4bb648ee036d9d449ccd5a9a03f8d2f6ba8
Contents?: true
Size: 1.59 KB
Versions: 4
Compression:
Stored size: 1.59 KB
Contents
require 'spec_helper' require 'shared_contexts' describe '<%= @type.name -%>' do # by default the hiera integration uses hiera data from the shared_contexts.rb file # but basically to mock hiera you first need to add a key/value pair # to the specific context in the spec/shared_contexts.rb file # Note: you can only use a single hiera context per describe/context block # rspec-puppet does not allow you to swap out hiera data on a per test block #include_context :hiera <%- if @type.type == :definition -%> let(:title) { 'XXreplace_meXX' } <%- end -%> # below is the facts hash that gives you the ability to mock # facts on a per describe/context block. If you use a fact in your # manifest you should mock the facts below. let(:facts) do {} end # below is a list of the resource parameters that you can override. # By default all non-required parameters are commented out, # while all required parameters will require you to add a value let(:params) do { <%- @parameters.each do |k,v| -%> <%- if v.nil? -%> <%= ":#{k} => 'place_value_here'," %> <%- else -%> <%= "#:#{k} => #{variable_value(v)}," %> <%- end -%> <%- end -%> } end # add these two lines in a single test block to enable puppet and hiera debug mode # Puppet::Util::Log.level = :debug # Puppet::Util::Log.newdestination(:console) <%- @resources.each do |res| -%> it do is_expected.to contain_<%= res.type.gsub('::', '__')%>('<%= res.title %>'). with(<%= res.parameters.to_s.gsub(/\",/, "\",\n ") %>) end <%- end -%> end
Version data entries
4 entries across 4 versions & 1 rubygems