summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser/resource/reference.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/parser/resource/reference.rb')
-rwxr-xr-xspec/unit/parser/resource/reference.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/spec/unit/parser/resource/reference.rb b/spec/unit/parser/resource/reference.rb
index 45af3d938..24b70d088 100755
--- a/spec/unit/parser/resource/reference.rb
+++ b/spec/unit/parser/resource/reference.rb
@@ -15,7 +15,7 @@ describe Puppet::Parser::Resource::Reference do
proc { @type.new(:type => "file") }.should raise_error(Puppet::DevError)
end
- it "should know when it models a builtin type" do
+ it "should know when it refers to a builtin type" do
ref = @type.new(:type => "file", :title => "/tmp/yay")
ref.builtin?.should be_true
ref.builtintype.should equal(Puppet::Type.type(:file))
@@ -23,13 +23,18 @@ describe Puppet::Parser::Resource::Reference do
it "should return a relationship-style resource reference when asked" do
ref = @type.new(:type => "file", :title => "/tmp/yay")
- ref.to_ref.should == ["file", "/tmp/yay"]
+ ref.to_ref.should == ["File", "/tmp/yay"]
end
it "should return a resource reference string when asked" do
ref = @type.new(:type => "file", :title => "/tmp/yay")
ref.to_s.should == "File[/tmp/yay]"
end
+
+ it "should canonize resource references" do
+ ref = @type.new(:type => "foo::bar", :title => "/tmp/yay")
+ ref.to_s.should == "Foo::Bar[/tmp/yay]"
+ end
end
describe Puppet::Parser::Resource::Reference, " when modeling defined types" do
@@ -45,22 +50,21 @@ describe Puppet::Parser::Resource::Reference, " when modeling defined types" do
@compile = Puppet::Parser::Compile.new(@node, @parser)
end
- it "should be able to model definitions" do
+ it "should be able to find defined types" do
ref = @type.new(:type => "mydefine", :title => "/tmp/yay", :scope => @compile.topscope)
ref.builtin?.should be_false
ref.definedtype.should equal(@definition)
end
- it "should be able to model classes" do
+ it "should be able to find classes" do
ref = @type.new(:type => "class", :title => "myclass", :scope => @compile.topscope)
ref.builtin?.should be_false
ref.definedtype.should equal(@class)
end
- it "should be able to model nodes" do
+ it "should be able to find nodes" do
ref = @type.new(:type => "node", :title => "mynode", :scope => @compile.topscope)
ref.builtin?.should be_false
ref.definedtype.object_id.should == @nodedef.object_id
end
end
-