From 89995e4db0eacf55260cf5ca85e715e2e45dfce5 Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Tue, 25 Nov 2014 12:45:23 +0100 Subject: Allow array of pathes in validate_absolute_path --- spec/functions/validate_absolute_path_spec.rb | 38 ++++++++++++++++++++------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'spec') 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 + -- cgit v1.2.3