Skip to content

Commit 31d65f3

Browse files
committed
Troubleshooting
1 parent b465285 commit 31d65f3

File tree

3 files changed

+93
-2
lines changed

3 files changed

+93
-2
lines changed

spec/functions/has_interface_with_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
'network' => '127.0.0.0'
2323
},
2424
],
25-
"bindings6": [
25+
'bindings6' => [
2626
{
2727
'address' => '::1',
2828
'netmask' => 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',

spec/unit/puppet/parser/functions/enclose_ipv6_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
require 'spec_helper'
44

55
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 }
78

89
it 'exists' do
910
expect(Puppet::Parser::Functions.function('enclose_ipv6')).to eq('function_enclose_ipv6')
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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

0 commit comments

Comments
 (0)