summaryrefslogtreecommitdiff
path: root/spec/unit/resource/conditional_spec.rb
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2014-09-11 14:20:51 -0400
committerBryan McLellan <btm@loftninjas.org>2014-09-30 20:13:17 -0400
commitd23eb2cdbdb2a9f49653426756c1d84cb2cab4be (patch)
tree04ce345d519f9020cbc20ef47aa71f4d44191894 /spec/unit/resource/conditional_spec.rb
parentb663f070786ad004fc2d8a71699a3d30abdd9f6d (diff)
downloadchef-d23eb2cdbdb2a9f49653426756c1d84cb2cab4be.tar.gz
guard_interpreter requires a command
Raises an exception if guard_interpreter is set (not :default) and we are not given a command (i.e. we are given a block). This is not supported, as we pass a command to an external interpreter. Related to #1943
Diffstat (limited to 'spec/unit/resource/conditional_spec.rb')
-rw-r--r--spec/unit/resource/conditional_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/unit/resource/conditional_spec.rb b/spec/unit/resource/conditional_spec.rb
index 4df185bcd6..92ca53118b 100644
--- a/spec/unit/resource/conditional_spec.rb
+++ b/spec/unit/resource/conditional_spec.rb
@@ -27,6 +27,15 @@ describe Chef::Resource::Conditional do
@parent_resource = Chef::Resource.new(nil, Chef::Node.new)
end
+ it "raises an exception when a guard_interpreter is specified and a block is given" do
+ @parent_resource.guard_interpreter :canadian_mounties
+ expect { Chef::Resource::Conditional.send(:new, :always, @parent_resource, nil, {}) { True } }.to raise_error(ArgumentError, /does not support blocks/)
+ end
+
+ it "raises an exception when neither a block or command is given" do
+ expect { Chef::Resource::Conditional.send(:new, :always, @parent_resource, nil, {})}.to raise_error(ArgumentError, /requires either a command or a block/)
+ end
+
describe "when created as an `only_if`" do
describe "after running a successful command" do
before do