summaryrefslogtreecommitdiffstats
path: root/spec/unit/resource/reference.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-12-09 16:56:39 -0600
committerLuke Kanies <luke@madstop.com>2008-12-18 11:10:21 -0600
commitc306a1744793420337421f6fdf3630a9121861bd (patch)
treed9febafe99325903172844ab47a4e78ac2a4fff1 /spec/unit/resource/reference.rb
parent48a994998d3087f82c0c3175a39d2bb812e8f94f (diff)
downloadpuppet-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-xspec/unit/resource/reference.rb16
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