File tree Expand file tree Collapse file tree 3 files changed +93
-2
lines changed
unit/puppet/parser/functions Expand file tree Collapse file tree 3 files changed +93
-2
lines changed Original file line number Diff line number Diff line change 22
22
'network' => '127.0.0.0'
23
23
} ,
24
24
] ,
25
- " bindings6" : [
25
+ ' bindings6' => [
26
26
{
27
27
'address' => '::1' ,
28
28
'netmask' => 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' ,
Original file line number Diff line number Diff line change 3
3
require 'spec_helper'
4
4
5
5
describe 'the enclose_ipv6 function' do
6
- let ( :scope ) { PuppetlabsSpec ::PuppetInternals . scope }
6
+ scope = RSpec ::ExampleGroups ::TheEncloseIpv6Function . scope
7
+ # let(:scope) { RSpec::ExampleGroups::TheEncloseIpv6Function.scope }
7
8
8
9
it 'exists' do
9
10
expect ( Puppet ::Parser ::Functions . function ( 'enclose_ipv6' ) ) . to eq ( 'function_enclose_ipv6' )
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe 'is_absolute_path' do
6
+ scope = RSpec ::ExampleGroups ::TheEncloseIpv6Function . scope
7
+ # let(:scope) { RSpec::ExampleGroups::TheEncloseIpv6Function.scope }
8
+
9
+ let ( :function_args ) do
10
+ [ ]
11
+ end
12
+
13
+ let ( :function ) do
14
+ scope . function_is_absolute_path ( function_args )
15
+ end
16
+
17
+ describe 'validate arity' do
18
+ let ( :function_args ) do
19
+ [ 1 , 2 ]
20
+ end
21
+
22
+ it 'raises a ParseError if there is more than 1 arguments' do
23
+ -> { function } . should ( raise_error ( ArgumentError ) )
24
+ end
25
+ end
26
+
27
+ it 'exists' do
28
+ Puppet ::Parser ::Functions . function ( subject ) . should == "function_#{ subject } "
29
+ end
30
+
31
+ # help enforce good function defination
32
+ it 'contains arity' do
33
+ end
34
+
35
+ it 'raises a ParseError if there is less than 1 arguments' do
36
+ -> { function } . should ( raise_error ( ArgumentError ) )
37
+ end
38
+
39
+ describe 'should retrun true' do
40
+ let ( :return_value ) do
41
+ true
42
+ end
43
+
44
+ describe 'windows' do
45
+ let ( :function_args ) do
46
+ [ 'c:\temp\test.txt' ]
47
+ end
48
+
49
+ it 'returns data' do
50
+ function . should eq ( return_value )
51
+ end
52
+ end
53
+
54
+ describe 'non-windows' do
55
+ let ( :function_args ) do
56
+ [ '/temp/test.txt' ]
57
+ end
58
+
59
+ it 'returns data' do
60
+ function . should eq ( return_value )
61
+ end
62
+ end
63
+ end
64
+
65
+ describe 'should return false' do
66
+ let ( :return_value ) do
67
+ false
68
+ end
69
+
70
+ describe 'windows' do
71
+ let ( :function_args ) do
72
+ [ '..\temp\test.txt' ]
73
+ end
74
+
75
+ it 'returns data' do
76
+ function . should eq ( return_value )
77
+ end
78
+ end
79
+
80
+ describe 'non-windows' do
81
+ let ( :function_args ) do
82
+ [ '../var/lib/puppet' ]
83
+ end
84
+
85
+ it 'returns data' do
86
+ function . should eq ( return_value )
87
+ end
88
+ end
89
+ end
90
+ end
You can’t perform that action at this time.
0 commit comments