summaryrefslogtreecommitdiff
path: root/spec/unit/resource_spec.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-04-18 12:02:33 -0700
committerdanielsdeleo <dan@opscode.com>2013-04-18 12:02:33 -0700
commitb7163d13fe84d1b4c45beaef3084f82dc07df415 (patch)
tree8aa0b402df2890b79967f1d479719346e5a8b7f8 /spec/unit/resource_spec.rb
parenta210f1151d7d51d2ef0b6653e1f463b22dde9a10 (diff)
downloadchef-b7163d13fe84d1b4c45beaef3084f82dc07df415.tar.gz
[CHEF-3432] use shared variable to track resource subclasses
Use a class (@@var) instead of class instance variable to track subclasses of Chef::Resource. This ensures that subclasses of subclasses will be added to the list.
Diffstat (limited to 'spec/unit/resource_spec.rb')
-rw-r--r--spec/unit/resource_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index ffcc7ae5b4..964946a339 100644
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@ -35,6 +35,21 @@ describe Chef::Resource do
@resource = Chef::Resource.new("funk", @run_context)
end
+ describe "when inherited", :focus do
+
+ it "adds an entry to a list of subclasses" do
+ subclass = Class.new(Chef::Resource)
+ Chef::Resource.resource_classes.should include(subclass)
+ end
+
+ it "keeps track of subclasses of subclasses" do
+ subclass = Class.new(Chef::Resource)
+ subclass_of_subclass = Class.new(subclass)
+ Chef::Resource.resource_classes.should include(subclass_of_subclass)
+ end
+
+ end
+
describe "when declaring the identity attribute" do
it "has no identity attribute by default" do
Chef::Resource.identity_attr.should be_nil