diff --git a/object_templates/fact.erb b/object_templates/fact.erb new file mode 100644 index 0000000000000000000000000000000000000000..23b9290f5a0efc48ffd1622e2d36200b7900a81e --- /dev/null +++ b/object_templates/fact.erb @@ -0,0 +1,6 @@ +Facter.add(:<%= name %>) do + # https://puppet.com/docs/puppet/6.19/fact_overview.html + setcode do + 'hello facter' + end +end diff --git a/object_templates/fact_spec.erb b/object_templates/fact_spec.erb new file mode 100644 index 0000000000000000000000000000000000000000..7fad22f082e0d96c28dffeb6f597dcbfe021d76b --- /dev/null +++ b/object_templates/fact_spec.erb @@ -0,0 +1,20 @@ +require 'spec_helper' +require 'facter' +require 'facter/<%= name %>' + +describe :'<%= name %>', type: :fact do + subject(:fact) { Facter.fact(:'<%= name %>') } + + before :all do + # perform any action that should be run for the entire test suite + end + + before :each do + # perform any action that should be run before every test + Facter.clear + end + + it 'should return a value' do + expect(fact.value).to eq('hello facter') + end +end