summaryrefslogtreecommitdiff
path: root/spec/unit/recipe_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/recipe_spec.rb')
-rw-r--r--spec/unit/recipe_spec.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb
index 2bdf470143..c795ba3788 100644
--- a/spec/unit/recipe_spec.rb
+++ b/spec/unit/recipe_spec.rb
@@ -182,7 +182,48 @@ describe Chef::Recipe do
zm_resource # force let binding evaluation
run_context.resource_collection.resources(:zen_master => "klopp").should == zm_resource
end
+ end
+
+ describe "creating a resource with short name" do
+ # zen_follower resource has this:
+ # provides :follower, :on_platforms => ["zen"]
+ before do
+ node.stub(:[]) do |key|
+ case key
+ when :platform
+ :zen
+ when :platform_version
+ "1.0.0"
+ else
+ nil
+ end
+ end
+ end
+
+ let(:resource_follower) do
+ recipe.declare_resource(:follower, "srst") do
+ master "none"
+ end
+ end
+ it "defines the resource using the declaration name with short name" do
+ resource_follower
+ run_context.resource_collection.lookup("follower[srst]").should_not be_nil
+ end
+ end
+
+ describe "creating a resource with a long name" do
+ let(:resource_zn_follower) do
+ recipe.declare_resource(:zen_follower, "srst") do
+ master "none"
+ end
+ end
+
+
+ it "defines the resource using the declaration name with long name" do
+ resource_zn_follower
+ run_context.resource_collection.lookup("zen_follower[srst]").should_not be_nil
+ end
end
describe "when attempting to create a resource of an invalid type" do