summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorBryan Jen <bryan.jen@gmail.com>2015-12-21 17:41:55 -0700
committerBryan Jen <bryan.jen@gmail.com>2015-12-21 17:41:55 -0700
commit0073c6d8de4fa0a042e82287c8a1e9603601a57b (patch)
tree023157db7ad3212c33637f370bc1f1dfc9e584a2 /spec/unit
parent1c6ae4793f9ab8a3c4a15ec1a01563b42715879b (diff)
parent1da820e61e08e72cf69d8833c37ecb9446fcd142 (diff)
downloadpuppet-stdlib-0073c6d8de4fa0a042e82287c8a1e9603601a57b.tar.gz
puppet-stdlib-0073c6d8de4fa0a042e82287c8a1e9603601a57b.tar.bz2
Merge pull request #553 from logicminds/absolute_path
adds new parser called is_absolute_path
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/puppet/parser/functions/is_absolute_path_spec.rb86
1 files changed, 86 insertions, 0 deletions
diff --git a/spec/unit/puppet/parser/functions/is_absolute_path_spec.rb b/spec/unit/puppet/parser/functions/is_absolute_path_spec.rb
new file mode 100644
index 0000000..8931208
--- /dev/null
+++ b/spec/unit/puppet/parser/functions/is_absolute_path_spec.rb
@@ -0,0 +1,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 \ No newline at end of file