File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper_acceptance'
4
+
5
+ describe 'stdlib::deferable_epp function' do
6
+ let ( :testfile ) { ( os [ :family ] == 'windows' ) ? 'C:\\test.epp' : '/tmp/test.epp' }
7
+
8
+ before ( :all ) do
9
+ apply_manifest ( <<-MANIFEST )
10
+ $_epp = << @(EPP)
11
+ port=<%= $port %>
12
+ password=<%= $password %>
13
+ |EPP
14
+ file{ "#{ testfile } "
15
+ ensure => file,
16
+ content => $_epp,
17
+ }
18
+ MANIFEST
19
+ end
20
+
21
+ before ( :each ) do
22
+ rm_testfile = <<-MANIFEST
23
+ file { "#{ testfile } .rendered":
24
+ ensure => absent,
25
+ }
26
+ MANIFEST
27
+ apply_manifest ( rm_testfile )
28
+ end
29
+
30
+ context 'with no deferred values' do
31
+ let ( :pp ) do
32
+ <<-MANIFEST
33
+ file{ "#{ testfile } .rendered":
34
+ ensure => file,
35
+ content => stdlib::deferred_epp(
36
+ $_test_file,
37
+ {'port' => 1234, 'password' => 'top_secret'}
38
+ ),
39
+ }
40
+ MANIFEST
41
+ end
42
+
43
+ it 'applies manifest, generates file' do
44
+ idempotent_apply ( pp )
45
+ expect ( file ( "#{ testfile } .rendered" ) ) . to be_file
46
+ expect ( file ( "#{ testfile } .rendered" ) . content ) . to match ( %r{port=1234} )
47
+ expect ( file ( "#{ testfile } .rendered" ) . content ) . to match ( %r{password=top_secret} )
48
+ end
49
+ end
50
+ end
You can’t perform that action at this time.
0 commit comments