summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser/resource
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2009-10-26 23:09:07 -0700
committerJames Turnbull <james@lovedthanlost.net>2009-11-14 09:08:53 +1100
commitca56aa7e5849a5489e8d38e29b25ea934caafcd7 (patch)
treed144a73d0fcae991281f688284c09283510f965d /spec/unit/parser/resource
parentadc0a4ed939a717e8735485d493bde28ceab5ac0 (diff)
downloadpuppet-ca56aa7e5849a5489e8d38e29b25ea934caafcd7.tar.gz
puppet-ca56aa7e5849a5489e8d38e29b25ea934caafcd7.tar.xz
puppet-ca56aa7e5849a5489e8d38e29b25ea934caafcd7.zip
Least kludgy patch for #2675
This makes parameters responsible for the canonicalization of their values and provides a default (passthrough) implementation. It changes munge to pre- canonicalize the value and resource references to builtin types to canonicalize titles (which map to resorce namevars) with the corresponding parameter's classes's canonicalization. It adds a canonicalization routine to file paths that normalizes the behaviour (trailing slashes are ignored) and DRYs up the related code. Signed-off-by: Markus Roberts <Markus@reality.com>
Diffstat (limited to 'spec/unit/parser/resource')
-rwxr-xr-xspec/unit/parser/resource/reference.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/spec/unit/parser/resource/reference.rb b/spec/unit/parser/resource/reference.rb
index 6284e67cc..a703f9284 100755
--- a/spec/unit/parser/resource/reference.rb
+++ b/spec/unit/parser/resource/reference.rb
@@ -40,10 +40,15 @@ describe Puppet::Parser::Resource::Reference do
ref.to_s.should == "File[/tmp/yay]"
end
- it "should canonize resource references" do
+ it "should canonize resource reference types" do
ref = @type.new(:type => "foo::bar", :title => "/tmp/yay")
ref.to_s.should == "Foo::Bar[/tmp/yay]"
end
+
+ it "should canonize resource reference values" do
+ ref = @type.new(:type => "file", :title => "/tmp/yay/")
+ ref.to_s.should == "File[/tmp/yay]"
+ end
end
describe Puppet::Parser::Resource::Reference, " when modeling defined types" do