diff options
| author | Luke Kanies <luke@madstop.com> | 2008-12-09 15:30:11 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-12-09 15:30:11 -0600 |
| commit | c927ce05bbd96fa9aacc8e52f8eb797403a1e433 (patch) | |
| tree | 721ca37083dcf46f4f94610d8003df53450c64c1 /spec | |
| parent | e88746b48cfd4ce7cd9acd0baf61d9b660b460e9 (diff) | |
Renaming Puppet::ResourceReference to Puppet::Resource::Reference
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/resource.rb | 20 | ||||
| -rwxr-xr-x | spec/unit/resource/reference.rb (renamed from spec/unit/resource_reference.rb) | 34 |
2 files changed, 27 insertions, 27 deletions
diff --git a/spec/unit/resource.rb b/spec/unit/resource.rb index b21a6fccb..f90856177 100755 --- a/spec/unit/resource.rb +++ b/spec/unit/resource.rb @@ -18,8 +18,8 @@ describe Puppet::Resource do end it "should create a resource reference with its type and title" do - ref = Puppet::ResourceReference.new("file", "/f") - Puppet::ResourceReference.expects(:new).with("file", "/f").returns ref + ref = Puppet::Resource::Reference.new("file", "/f") + Puppet::Resource::Reference.expects(:new).with("file", "/f").returns ref Puppet::Resource.new("file", "/f") end @@ -41,24 +41,24 @@ describe Puppet::Resource do end it "should use the resource reference to determine its type" do - ref = Puppet::ResourceReference.new("file", "/f") - Puppet::ResourceReference.expects(:new).returns ref + ref = Puppet::Resource::Reference.new("file", "/f") + Puppet::Resource::Reference.expects(:new).returns ref resource = Puppet::Resource.new("file", "/f") ref.expects(:type).returns "mytype" resource.type.should == "mytype" end it "should use its resource reference to determine its title" do - ref = Puppet::ResourceReference.new("file", "/f") - Puppet::ResourceReference.expects(:new).returns ref + ref = Puppet::Resource::Reference.new("file", "/f") + Puppet::Resource::Reference.expects(:new).returns ref resource = Puppet::Resource.new("file", "/f") ref.expects(:title).returns "mytitle" resource.title.should == "mytitle" end it "should use its resource reference to produce its canonical reference string" do - ref = Puppet::ResourceReference.new("file", "/f") - Puppet::ResourceReference.expects(:new).returns ref + ref = Puppet::Resource::Reference.new("file", "/f") + Puppet::Resource::Reference.expects(:new).returns ref resource = Puppet::Resource.new("file", "/f") ref.expects(:to_s).returns "Foo[bar]" resource.ref.should == "Foo[bar]" @@ -266,12 +266,12 @@ describe Puppet::Resource do end it "should convert resource references into the backward-compatible form" do - @resource[:foo] = Puppet::ResourceReference.new(:file, "/f") + @resource[:foo] = Puppet::Resource::Reference.new(:file, "/f") @resource.to_trans["foo"].should == %w{file /f} end it "should convert resource references into the backward-compatible form even when within arrays" do - @resource[:foo] = ["a", Puppet::ResourceReference.new(:file, "/f")] + @resource[:foo] = ["a", Puppet::Resource::Reference.new(:file, "/f")] @resource.to_trans["foo"].should == ["a", %w{file /f}] end end diff --git a/spec/unit/resource_reference.rb b/spec/unit/resource/reference.rb index baa3890cb..e16fe55ba 100755 --- a/spec/unit/resource_reference.rb +++ b/spec/unit/resource/reference.rb @@ -1,73 +1,73 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.dirname(__FILE__) + '/../../spec_helper' -require 'puppet/resource_reference' +require 'puppet/resource/reference' -describe Puppet::ResourceReference do +describe Puppet::Resource::Reference do it "should have a :title attribute" do - Puppet::ResourceReference.new(:file, "foo").title.should == "foo" + Puppet::Resource::Reference.new(:file, "foo").title.should == "foo" end it "should canonize types to capitalized strings" do - Puppet::ResourceReference.new(:file, "foo").type.should == "File" + Puppet::Resource::Reference.new(:file, "foo").type.should == "File" end it "should canonize qualified types so all strings are capitalized" do - Puppet::ResourceReference.new("foo::bar", "foo").type.should == "Foo::Bar" + Puppet::Resource::Reference.new("foo::bar", "foo").type.should == "Foo::Bar" end it "should set its type to 'Class' and its title to the passed title if the passed type is :component and the title has no square brackets in it" do - ref = Puppet::ResourceReference.new(:component, "foo") + ref = Puppet::Resource::Reference.new(:component, "foo") ref.type.should == "Class" ref.title.should == "foo" end it "should interpret the title as a reference and assign appropriately if the type is :component and the title contains square brackets" do - ref = Puppet::ResourceReference.new(:component, "foo::bar[yay]") + ref = Puppet::Resource::Reference.new(:component, "foo::bar[yay]") ref.type.should == "Foo::Bar" ref.title.should == "yay" end it "should set the type to 'Class' if it is nil and the title contains no square brackets" do - ref = Puppet::ResourceReference.new(nil, "yay") + ref = Puppet::Resource::Reference.new(nil, "yay") ref.type.should == "Class" ref.title.should == "yay" end it "should interpret the title as a reference and assign appropriately if the type is nil and the title contains square brackets" do - ref = Puppet::ResourceReference.new(nil, "foo::bar[yay]") + ref = Puppet::Resource::Reference.new(nil, "foo::bar[yay]") ref.type.should == "Foo::Bar" ref.title.should == "yay" end it "should interpret the title as a reference and assign appropriately if the type is nil and the title contains nested square brackets" do - ref = Puppet::ResourceReference.new(nil, "foo::bar[baz[yay]]") + ref = Puppet::Resource::Reference.new(nil, "foo::bar[baz[yay]]") ref.type.should == "Foo::Bar" ref.title.should =="baz[yay]" end it "should be considered builtin if an existing resource type matches the type" do - Puppet::ResourceReference.new("file", "/f").should be_builtin_type + Puppet::Resource::Reference.new("file", "/f").should be_builtin_type end it "should be not considered builtin if an existing resource type does not match the type" do - Puppet::ResourceReference.new("foobar", "/f").should_not be_builtin_type + Puppet::Resource::Reference.new("foobar", "/f").should_not be_builtin_type end it "should be able to produce a backward-compatible reference array" do - Puppet::ResourceReference.new("foobar", "/f").to_trans_ref.should == %w{Foobar /f} + Puppet::Resource::Reference.new("foobar", "/f").to_trans_ref.should == %w{Foobar /f} end it "should downcase resource types when producing a backward-compatible reference array for builtin resource types" do - Puppet::ResourceReference.new("file", "/f").to_trans_ref.should == %w{file /f} + Puppet::Resource::Reference.new("file", "/f").to_trans_ref.should == %w{file /f} end end -describe Puppet::ResourceReference, "when resolving resources with a catalog" do +describe Puppet::Resource::Reference, "when resolving resources with a catalog" do it "should resolve all resources using the catalog" do config = mock 'catalog' - ref = Puppet::ResourceReference.new("foo::bar", "yay") + ref = Puppet::Resource::Reference.new("foo::bar", "yay") ref.catalog = config config.expects(:resource).with("Foo::Bar[yay]").returns(:myresource) |
