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