summaryrefslogtreecommitdiff
path: root/spec/unit/resource_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/resource_spec.rb')
-rw-r--r--spec/unit/resource_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index a2ba2b272f..3808d99a06 100644
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@ -492,6 +492,20 @@ describe Chef::Resource do
expect(r.resource_name).to eq :blah
expect(r.declared_type).to eq :d
end
+
+ # This tests some somewhat confusing behavior that used to occur due to the resource_name call
+ # automatically wiring up the old canonical provides line.
+ it "setting resoure_name does not override provides in prior resource" do
+ c1 = Class.new(Chef::Resource) do
+ resource_name :self_resource_name_test_4
+ provides :self_resource_name_test_4
+ end
+ c2 = Class.new(Chef::Resource) do
+ resource_name :self_resource_name_test_4
+ provides(:self_resource_name_test_4) { false } # simulates any filter that does not match
+ end
+ expect(Chef::Resource.resource_for_node(:self_resource_name_test_4, node)).to eql(c1)
+ end
end
describe "to_json" do