diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-22 14:26:34 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-30 11:52:24 -0700 |
commit | d08274d635b046210faf07d7f598fee5b3c3effe (patch) | |
tree | eae7c43c4263749d458c06f609b3c7ef2ef997c2 /spec/unit/resource_spec.rb | |
parent | 2151e4f1563441fdacc07c16eaaa4273bb88931d (diff) | |
download | chef-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/resource_spec.rb')
-rw-r--r-- | spec/unit/resource_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index a806c5d1d9..6285bad50a 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -284,6 +284,23 @@ describe Chef::Resource do resource.notifies :reload, run_context.resource_collection.find(:zen_master => "coffee, tea") expect(resource.delayed_notifications.detect { |e| e.resource.name == "coffee, tea" && e.action == :reload }).not_to be_nil end + + it "notifies a resource without a name via a string name with brackets" do + run_context.resource_collection << Chef::Resource::ZenMaster.new("") + resource.notifies :reload, "zen_master[]" + end + + it "notifies a resource without a name via a string name without brackets" do + run_context.resource_collection << Chef::Resource::ZenMaster.new("") + resource.notifies :reload, "zen_master" + expect(resource.delayed_notifications.first.resource).to eql("zen_master") + end + + it "notifies a resource without a name via a hash name with an empty string" do + run_context.resource_collection << Chef::Resource::ZenMaster.new("") + resource.notifies :reload, zen_master: "" + expect(resource.delayed_notifications.first.resource).to eql(zen_master: "") + end end describe "subscribes" do |