summaryrefslogtreecommitdiff
path: root/spec/functions
diff options
context:
space:
mode:
Diffstat (limited to 'spec/functions')
-rwxr-xr-xspec/functions/validate_absolute_path_spec.rb38
1 files changed, 29 insertions, 9 deletions
diff --git a/spec/functions/validate_absolute_path_spec.rb b/spec/functions/validate_absolute_path_spec.rb
index 342ae84..36c836b 100755
--- a/spec/functions/validate_absolute_path_spec.rb
+++ b/spec/functions/validate_absolute_path_spec.rb
@@ -39,6 +39,11 @@ describe Puppet::Parser::Functions.function(:validate_absolute_path) do
expect { subject.call [path] }.not_to raise_error
end
end
+ valid_paths do
+ it "validate_absolute_path(#{valid_paths.inspect}) should not fail" do
+ expect { subject.call [valid_paths] }.not_to raise_error
+ end
+ end
end
context "Puppet without mocking" do
@@ -47,6 +52,11 @@ describe Puppet::Parser::Functions.function(:validate_absolute_path) do
expect { subject.call [path] }.not_to raise_error
end
end
+ valid_paths do
+ it "validate_absolute_path(#{valid_paths.inspect}) should not fail" do
+ expect { subject.call [valid_paths] }.not_to raise_error
+ end
+ end
end
end
@@ -55,6 +65,7 @@ describe Puppet::Parser::Functions.function(:validate_absolute_path) do
[
nil,
[ nil ],
+ [ nil, nil ],
{ 'foo' => 'bar' },
{ },
'',
@@ -66,19 +77,28 @@ describe Puppet::Parser::Functions.function(:validate_absolute_path) do
end
context 'Relative paths' do
- %w{
- relative1
- .
- ..
- ./foo
- ../foo
- etc/puppetlabs/puppet
- opt/puppet/bin
- }.each do |path|
+ def self.rel_paths
+ %w{
+ relative1
+ .
+ ..
+ ./foo
+ ../foo
+ etc/puppetlabs/puppet
+ opt/puppet/bin
+ }
+ end
+ rel_paths.each do |path|
it "validate_absolute_path(#{path.inspect}) should fail" do
expect { subject.call [path] }.to raise_error Puppet::ParseError
end
end
+ rel_paths do
+ it "validate_absolute_path(#{rel_paths.inspect}) should fail" do
+ expect { subject.call [rel_paths] }.to raise_error Puppet::ParseError
+ end
+ end
end
end
end
+