From c86a980fe9b2f2e109fe7956a1be2705f3fc2ade Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Tue, 15 Mar 2011 11:45:02 -0700 Subject: (#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 --- spec/unit/parameter/path_spec.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 spec/unit/parameter/path_spec.rb (limited to 'spec/unit/parameter') 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 -- cgit