diff options
| author | Luke Kanies <luke@madstop.com> | 2008-12-09 16:56:39 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-12-18 11:10:21 -0600 |
| commit | c306a1744793420337421f6fdf3630a9121861bd (patch) | |
| tree | d9febafe99325903172844ab47a4e78ac2a4fff1 /spec/unit/resource/reference.rb | |
| parent | 48a994998d3087f82c0c3175a39d2bb812e8f94f (diff) | |
| download | puppet-c306a1744793420337421f6fdf3630a9121861bd.tar.gz puppet-c306a1744793420337421f6fdf3630a9121861bd.tar.xz puppet-c306a1744793420337421f6fdf3630a9121861bd.zip | |
Adding equality testing to Puppet::Resource::Reference
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/resource/reference.rb')
| -rwxr-xr-x | spec/unit/resource/reference.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/unit/resource/reference.rb b/spec/unit/resource/reference.rb index e16fe55ba..001aa0395 100755 --- a/spec/unit/resource/reference.rb +++ b/spec/unit/resource/reference.rb @@ -62,6 +62,22 @@ describe Puppet::Resource::Reference do it "should downcase resource types when producing a backward-compatible reference array for builtin resource types" do Puppet::Resource::Reference.new("file", "/f").to_trans_ref.should == %w{file /f} end + + it "should be considered equivalent to another reference if their type and title match" do + Puppet::Resource::Reference.new("file", "/f").should == Puppet::Resource::Reference.new("file", "/f") + end + + it "should not be considered equivalent to a non-reference" do + Puppet::Resource::Reference.new("file", "/f").should_not == "foo" + end + + it "should not be considered equivalent to another reference if their types do not match" do + Puppet::Resource::Reference.new("file", "/f").should_not == Puppet::Resource::Reference.new("exec", "/f") + end + + it "should not be considered equivalent to another reference if their titles do not match" do + Puppet::Resource::Reference.new("file", "/foo").should_not == Puppet::Resource::Reference.new("file", "/f") + end end describe Puppet::Resource::Reference, "when resolving resources with a catalog" do |
