summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorneha-p6 <neha.pansare6@gmail.com>2022-01-27 17:26:24 +0530
committerNeha Pansare <neha.pansare@progress.com>2022-02-09 18:42:07 +0530
commit1db710e55ec53d12222654818f577044f63168d1 (patch)
tree4e180dfa6bdc26c05ce33e0f83ff2e97beec73ed /spec/unit
parent1c8f84f84d267524076e2d0c5a69bc23be04f593 (diff)
downloadchef-1db710e55ec53d12222654818f577044f63168d1.tar.gz
Validate resource spec passed to subscribes
Signed-off-by: Neha Pansare <neha.pansare@progress.com>
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/resource_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index f20a6d3bc6..86e666c00e 100644
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@ -300,6 +300,14 @@ describe Chef::Resource do
end
describe "subscribes" do
+ context "with syntax error in resources parameter" do
+ it "raises an exception immediately" do
+ expect do
+ resource.subscribes(:run, "typo[missing-closing-bracket")
+ end.to raise_error(Chef::Exceptions::InvalidResourceSpecification)
+ end
+ end
+
it "should make resources appear in the actions hash of subscribed nodes" do
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
zr = run_context.resource_collection.find(zen_master: "coffee")