Sha256: b2212959024675d9fffc1e7a02bee5193ff3e3968408c9bbe3f0c0d2137466eb

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

<% test.classes.each do |cls| -%>
describe "<%= cls.name %>" do

<% if @mock_functions -%>
<% @mock_functions.each do |function,params| -%>
<% if params['type'] == 'statement' -%>
MockFunction.new('<%= function %>', {:type => :statement})
<% else -%>
let!(:<%= function %>) { MockFunction.new('<%= function %>') { |f|
    f.stubbed.returns(<%= params['returns'] %>)
  }
}
<% end -%>

<% end -%>
<% end -%>
<% test.nodes.each do |node| -%>
  context "using fact set <%= node.name %>" do
    node_facts = <%= node.fact_set %>
    let(:facts) { node_facts }
<% if @before_conditions -%>
    before :each do
<% @before_conditions.each do |function| -%>
      <%= function %>
<% end -%>
    end
<% end -%>
<% if @after_conditions -%>
    after :each do
<% @after_conditions.each do |function| -%>
      <%= function %>
<% end -%>
    end
<% end -%>
<% if pre_condition -%>
    let(:pre_condition) {
      pp = <%= '<<' %>-END
$onceover_class = '<%= cls.name %>'
$onceover_node = '<%= node.name %>'
<%= pre_condition.chomp %>
END
    }
<% end -%>
    it { should compile }
  end
<% end -%>
end

<% end -%>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
onceover-3.5.0 templates/test_spec.rb.erb
onceover-3.4.0 templates/test_spec.rb.erb