summaryrefslogtreecommitdiffstats
path: root/spec/unit/parameter
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@rimspace.net>2011-03-15 11:45:02 -0700
committerMatt Robinson <matt@puppetlabs.com>2011-03-15 11:55:59 -0700
commitc86a980fe9b2f2e109fe7956a1be2705f3fc2ade (patch)
treec62ae3e63fac89286140e6879538ba14009663ba /spec/unit/parameter
parent77fbf7fdd3d17c169057a17e8d5829907975d169 (diff)
downloadpuppet-c86a980fe9b2f2e109fe7956a1be2705f3fc2ade.tar.gz
puppet-c86a980fe9b2f2e109fe7956a1be2705f3fc2ade.tar.xz
puppet-c86a980fe9b2f2e109fe7956a1be2705f3fc2ade.zip
(#4884) Add consistent path validation and behavior
Many path parameters were implementing their own inconsistent validation and behavior. Now those parameters can have a parent class that makes things a lot more consistent. Reviewed-by: Matt Robinson and Max Martin
Diffstat (limited to 'spec/unit/parameter')
-rw-r--r--spec/unit/parameter/path_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/unit/parameter/path_spec.rb b/spec/unit/parameter/path_spec.rb
new file mode 100644
index 000000000..08a26de33
--- /dev/null
+++ b/spec/unit/parameter/path_spec.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+require File.expand_path(File.join(File.dirname(__FILE__), '../../spec_helper'))
+
+require 'puppet/parameter/path'
+
+[false, true].each do |arrays|
+ describe "Puppet::Parameter::Path with arrays #{arrays}" do
+ it_should_behave_like "all path parameters", :path, :array => arrays do
+ # The new type allows us a test that is guaranteed to go direct to our
+ # validation code, without passing through any "real type" overrides or
+ # whatever on the way.
+ Puppet::newtype(:test_puppet_parameter_path) do
+ newparam(:path, :parent => Puppet::Parameter::Path, :arrays => arrays) do
+ isnamevar
+ accept_arrays arrays
+ end
+ end
+
+ def instance(path)
+ Puppet::Type.type(:test_puppet_parameter_path).new(:path => path)
+ end
+ end
+ end
+end