File tree 2 files changed +11
-7
lines changed
lib/puppet/parser/functions
2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
- require_relative '../../../PuppetX /binford2k/node_encrypt'
3
+ require_relative '../../../puppet_x /binford2k/node_encrypt'
4
4
5
5
Puppet ::Parser ::Functions . newfunction ( :node_encrypt ,
6
6
type : :rvalue ,
Original file line number Diff line number Diff line change 6
6
describe 'node_encrypt' do
7
7
let ( :node ) { 'testhost.example.com' }
8
8
9
- it {
9
+ it 'exists' do
10
+ expect ( Puppet ::Parser ::Functions . function ( 'node_encrypt' ) ) . to eq ( 'function_node_encrypt' )
11
+ end
12
+
13
+ it 'receives foobar and returns encrypted' do
10
14
expect ( PuppetX ::Binford2k ::NodeEncrypt ) . to receive ( :encrypt ) . with ( 'foobar' , 'testhost.example.com' ) . and_return ( 'encrypted' )
11
- expect ( subject ) . to run . with_params ( 'foobar' ) . and_return ( 'encrypted' )
12
- }
15
+ expect ( scope . function_node_encrypt ( [ 'foobar' ] ) ) . to eq ( 'encrypted' )
16
+ end
13
17
14
18
if defined? ( Puppet ::Pops ::Types ::PSensitiveType ::Sensitive )
15
- it {
19
+ it 'receives sensitive value and returns encrypted' do
16
20
expect ( PuppetX ::Binford2k ::NodeEncrypt ) . to receive ( :encrypt ) . with ( 'foobar' , 'testhost.example.com' ) . and_return ( 'encrypted' )
17
- expect ( subject ) . to run . with_params ( Puppet ::Pops ::Types ::PSensitiveType ::Sensitive . new ( 'foobar' ) ) . and_return ( 'encrypted' )
18
- }
21
+ expect ( scope . function_node_encrypt ( [ Puppet ::Pops ::Types ::PSensitiveType ::Sensitive . new ( 'foobar' ) ] ) ) . to eq ( 'encrypted' )
22
+ end
19
23
end
20
24
end
You can’t perform that action at this time.
0 commit comments