summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2014-09-30 20:11:11 -0400
committerBryan McLellan <btm@loftninjas.org>2014-09-30 20:13:34 -0400
commitf29e72f26288a7db82139e066a2cfaebe16f261c (patch)
treefa12a235c99d0ec7cd4f898ae9d40e9efc7eff38
parentc0e6d45e8ca93bbaec11c24bc6c613c95dcebdbc (diff)
downloadchef-f29e72f26288a7db82139e066a2cfaebe16f261c.tar.gz
Unsupported block exception is now raised by configure
The fix for #1943 moved some code into a new configure method, which is also where we now raise if we're passed a block and a guard_interpreter as that is where we evaluate guard interpreters. This updates the unit test for that behavior.
-rw-r--r--spec/unit/resource/conditional_spec.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/spec/unit/resource/conditional_spec.rb b/spec/unit/resource/conditional_spec.rb
index 8d0fae18f0..1fc2518013 100644
--- a/spec/unit/resource/conditional_spec.rb
+++ b/spec/unit/resource/conditional_spec.rb
@@ -27,11 +27,6 @@ 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
@@ -43,6 +38,14 @@ describe Chef::Resource::Conditional do
Chef::Resource::Conditional.only_if(@parent_resource, "true")
end
+ describe "configure" do
+ it "raises an exception when a guard_interpreter is specified and a block is given" do
+ @parent_resource.guard_interpreter :canadian_mounties
+ conditional = Chef::Resource::Conditional.send(:new, :always, @parent_resource, nil, {}) { True }
+ expect { conditional.configure }.to raise_error(ArgumentError, /does not support blocks/)
+ end
+ end
+
describe "when created as an `only_if`" do
describe "after running a successful command" do
before do