blob: 89312081a71ce6e2f855929bffebd2fd865da750 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
require 'spec_helper'
describe :is_absolute_path do
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
let(:function_args) do
[]
end
let(:function) do
scope.function_is_absolute_path(function_args)
end
describe 'validate arity' do
let(:function_args) do
[1,2]
end
it "should raise a ParseError if there is more than 1 arguments" do
lambda { function }.should( raise_error(ArgumentError))
end
end
it "should exist" do
Puppet::Parser::Functions.function(subject).should == "function_#{subject}"
end
# help enforce good function defination
it 'should contain arity' do
end
it "should raise a ParseError if there is less than 1 arguments" do
lambda { function }.should( raise_error(ArgumentError))
end
describe 'should retrun true' do
let(:return_value) do
true
end
describe 'windows' do
let(:function_args) do
['c:\temp\test.txt']
end
it 'should return data' do
function.should eq(return_value)
end
end
describe 'non-windows' do
let(:function_args) do
['/temp/test.txt']
end
it 'should return data' do
function.should eq(return_value)
end
end
end
describe 'should return false' do
let(:return_value) do
false
end
describe 'windows' do
let(:function_args) do
['..\temp\test.txt']
end
it 'should return data' do
function.should eq(return_value)
end
end
describe 'non-windows' do
let(:function_args) do
['../var/lib/puppet']
end
it 'should return data' do
function.should eq(return_value)
end
end
end
end
|