summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2009-12-30 21:20:45 -0800
committerJames Turnbull <james@lovedthanlost.net>2010-01-01 11:45:44 +1100
commit13cbf043c6e16c14b0ab9fccd5738a8c9e5925b3 (patch)
treee2cef0d11711a7177146a9acd420ed4482ab7290 /spec
parent5c6f07b404e946266b33f08855116f7bb1a1800c (diff)
downloadpuppet-13cbf043c6e16c14b0ab9fccd5738a8c9e5925b3.tar.gz
puppet-13cbf043c6e16c14b0ab9fccd5738a8c9e5925b3.tar.xz
puppet-13cbf043c6e16c14b0ab9fccd5738a8c9e5925b3.zip
ReFix 2675 ending slash in directory should get stripped off
There was an intermittent bug in Puppet::Parser::Resource::Reference, during initialization, and object could sometimes have its title set before its type is set. This prevented the title from going through type-specific canonicalization. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/parser/resource.rb11
-rwxr-xr-xspec/unit/parser/resource/reference.rb7
2 files changed, 18 insertions, 0 deletions
diff --git a/spec/unit/parser/resource.rb b/spec/unit/parser/resource.rb
index 3f08de958..d41d4f48b 100755
--- a/spec/unit/parser/resource.rb
+++ b/spec/unit/parser/resource.rb
@@ -101,6 +101,17 @@ describe Puppet::Parser::Resource do
end
end
+ describe "when refering to a resource with name canonicalization" do
+ before do
+ @arguments = {:type => "file", :title => "/path/", :scope => stub('scope', :source => mock('source'))}
+ end
+
+ it "should canonicalize its own name" do
+ res = Puppet::Parser::Resource.new(@arguments)
+ res.ref.should == "File[/path]"
+ end
+ end
+
describe "when evaluating" do
before do
@type = Puppet::Parser::Resource
diff --git a/spec/unit/parser/resource/reference.rb b/spec/unit/parser/resource/reference.rb
index a703f9284..19fe076e5 100755
--- a/spec/unit/parser/resource/reference.rb
+++ b/spec/unit/parser/resource/reference.rb
@@ -49,6 +49,13 @@ describe Puppet::Parser::Resource::Reference do
ref = @type.new(:type => "file", :title => "/tmp/yay/")
ref.to_s.should == "File[/tmp/yay]"
end
+
+ it "should canonize resource reference values without order dependencies" do
+ args = [[:title, "/tmp/yay/"], [:type, "file"]]
+ ref = @type.new(args)
+ ref.to_s.should == "File[/tmp/yay]"
+ end
+
end
describe Puppet::Parser::Resource::Reference, " when modeling defined types" do