Skip to content

Commit f676778

Browse files
committed
add a rudimentary spec test for deferrable_epp
1 parent c1127f2 commit f676778

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
require 'spec_helper'
2+
3+
describe 'stdlib::deferrable_epp' do
4+
context 'call epp on non-deferred input' do
5+
let(:pre_condition) do
6+
'function epp($str, $data) { return "rendered"}'
7+
end
8+
it {
9+
is_expected.to run.with_params('mymod/template.epp', {'foo' => 'bar'}).and_return('rendered')
10+
}
11+
end
12+
13+
context 'defers rendering with deferred input' do
14+
let(:pre_condition) do (<<~END)
15+
function epp($str, $data) { fail("should not have invoked epp()") }
16+
function find_template($str) { return "path" }
17+
function file($path) { return "foo: <%= foo %>" }
18+
END
19+
end
20+
it {
21+
foo = Puppet::Pops::Types::TypeFactory.deferred.create('join', [1,2,3])
22+
is_expected.to run.with_params('mymod/template.epp', {'foo' => foo }) #.and_return(a_kind_of Puppet::Pops::Evaluator::DeferredValue)
23+
}
24+
end
25+
end

0 commit comments

Comments
 (0)