summaryrefslogtreecommitdiff
path: root/spec/unit/resource
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2014-09-25 21:01:57 -0400
committerBryan McLellan <btm@loftninjas.org>2014-09-30 20:13:31 -0400
commit3eb618e7826115c3be40d68b072adea7e5b0248e (patch)
tree5191138f96ad0dd86124e959c161316e79c95c02 /spec/unit/resource
parent906b6cc2dd59c001955a6d8e7dc26296c6663539 (diff)
downloadchef-3eb618e7826115c3be40d68b072adea7e5b0248e.tar.gz
unit test for guard_interpreter creation during compilation
make sure we don't evaluate the guard_interpreter immediately, i.e. during compilation of the resource, as the conditional may be seen before the guard_interpreter attribute.
Diffstat (limited to 'spec/unit/resource')
-rw-r--r--spec/unit/resource/conditional_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/unit/resource/conditional_spec.rb b/spec/unit/resource/conditional_spec.rb
index 92ca53118b..8d0fae18f0 100644
--- a/spec/unit/resource/conditional_spec.rb
+++ b/spec/unit/resource/conditional_spec.rb
@@ -36,6 +36,13 @@ describe Chef::Resource::Conditional do
expect { Chef::Resource::Conditional.send(:new, :always, @parent_resource, nil, {})}.to raise_error(ArgumentError, /requires either a command or a block/)
end
+ it "does not evaluate a guard interpreter on initialization of the conditional" do
+ expect_any_instance_of(Chef::Resource::Conditional).not_to receive(:configure)
+ expect(Chef::GuardInterpreter::DefaultGuardInterpreter).not_to receive(:new)
+ expect(Chef::GuardInterpreter::ResourceGuardInterpreter).not_to receive(:new)
+ Chef::Resource::Conditional.only_if(@parent_resource, "true")
+ end
+
describe "when created as an `only_if`" do
describe "after running a successful command" do
before do