summaryrefslogtreecommitdiff
path: root/spec/unit/puppet/parser/functions/is_absolute_path_spec.rb
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2017-01-13 12:41:58 +0100
committervarac <varacanero@zeromail.org>2017-01-13 12:41:58 +0100
commit066c08f8362d53f0f30897cb8710d11260c726ea (patch)
treea6369eecd88bb731fe413d0bbc8af73d74d1f447 /spec/unit/puppet/parser/functions/is_absolute_path_spec.rb
parent71123634744b9fe2ec7d6a3e38e9789fd84801e3 (diff)
parentb65dd1f45d10e10e45455358aeabb29167990e2c (diff)
Merge remote-tracking branch 'origin/master' into leap_master
Diffstat (limited to 'spec/unit/puppet/parser/functions/is_absolute_path_spec.rb')
-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