summaryrefslogtreecommitdiff
path: root/spec/unit/recipe_spec.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-03-22 14:26:34 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2017-03-30 11:52:24 -0700
commitd08274d635b046210faf07d7f598fee5b3c3effe (patch)
treeeae7c43c4263749d458c06f609b3c7ef2ef997c2 /spec/unit/recipe_spec.rb
parent2151e4f1563441fdacc07c16eaaa4273bb88931d (diff)
downloadchef-d08274d635b046210faf07d7f598fee5b3c3effe.tar.gz
Chef-13: Support nameless resources and remove deprecated multi-arg resources
This makes nameless resources work in the DSL: ```ruby apt_update ``` It does it by giving it an empty-string name of "" It also drops support for multi-arg resources, that has been deprecated for some time: ```ruby some_resource "foo", "bar", "baz" ``` Note that multipackage package resources do not use multiple args, but a single argument which is an arry: ```ruby package [ "lsof", "strace", "tcpdump" ] ``` So this change does not affect that usage. Multi-arg has been deprecated for some time now and its not clear that it was ever used by anyone. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/unit/recipe_spec.rb')
-rw-r--r--spec/unit/recipe_spec.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb
index cb500da34a..8a2719120a 100644
--- a/spec/unit/recipe_spec.rb
+++ b/spec/unit/recipe_spec.rb
@@ -74,10 +74,14 @@ describe Chef::Recipe do
expect { recipe.not_home("not_home_resource") }.to raise_error(NameError)
end
- it "should require a name argument" do
- expect do
- recipe.cat
- end.to raise_error(ArgumentError)
+ it "does not require a name argument and looks up with empty brackets" do
+ recipe.zen_master
+ expect(run_context.resource_collection.lookup("zen_master[]").name).to eql("")
+ end
+
+ it "does not require a name argument and looks up with bare word" do
+ recipe.zen_master
+ expect(run_context.resource_collection.lookup("zen_master").name).to eql("")
end
it "should allow regular errors (not NameErrors) to pass unchanged" do