diff options
author | Dave Eddy <dave@daveeddy.com> | 2014-09-17 15:16:07 -0400 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-01-25 10:38:21 -0800 |
commit | 1e7ddda1a3701526a3aae48736e73de95e359f59 (patch) | |
tree | c7eaa2b2395d014a521c8831bd9cb18c57fd3da3 /spec/unit/resource | |
parent | 890d8a7ba8ab7c1cfb6e4415cbc89c85e7acd0b7 (diff) | |
download | chef-1e7ddda1a3701526a3aae48736e73de95e359f59.tar.gz |
add tests for array conditional notation
Diffstat (limited to 'spec/unit/resource')
-rw-r--r-- | spec/unit/resource/conditional_spec.rb | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/spec/unit/resource/conditional_spec.rb b/spec/unit/resource/conditional_spec.rb index 779c69425a..1f6d35b53b 100644 --- a/spec/unit/resource/conditional_spec.rb +++ b/spec/unit/resource/conditional_spec.rb @@ -47,7 +47,7 @@ describe Chef::Resource::Conditional do end describe "when created as an `only_if`" do - describe "after running a successful command" do + describe "after running a successful command given as a string" do before do @conditional = Chef::Resource::Conditional.only_if(@parent_resource, "true") end @@ -57,7 +57,7 @@ describe Chef::Resource::Conditional do end end - describe "after running a negative/false command" do + describe "after running a negative/false command given as a string" do before do @status.send("success?=", false) @conditional = Chef::Resource::Conditional.only_if(@parent_resource, "false") @@ -68,6 +68,27 @@ describe Chef::Resource::Conditional do end end + describe "after running a successful command given as an array" do + before do + @conditional = Chef::Resource::Conditional.only_if(@parent_resource, ["true"]) + end + + it "indicates that resource convergence should continue" do + @conditional.continue?.should be_true + end + end + + describe "after running a negative/false command given as an array" do + before do + @status.send("success?=", false) + @conditional = Chef::Resource::Conditional.only_if(@parent_resource, ["false"]) + end + + it "indicates that resource convergence should not continue" do + @conditional.continue?.should be_false + end + end + describe 'after running a command which timed out' do before do @conditional = Chef::Resource::Conditional.only_if(@parent_resource, "false") @@ -106,7 +127,7 @@ describe Chef::Resource::Conditional do end describe "when created as a `not_if`" do - describe "after running a successful/true command" do + describe "after running a successful/true command given as a string" do before do @conditional = Chef::Resource::Conditional.not_if(@parent_resource, "true") end @@ -116,7 +137,7 @@ describe Chef::Resource::Conditional do end end - describe "after running a failed/false command" do + describe "after running a failed/false command given as a string" do before do @status.send("success?=", false) @conditional = Chef::Resource::Conditional.not_if(@parent_resource, "false") @@ -127,6 +148,27 @@ describe Chef::Resource::Conditional do end end + describe "after running a successful/true command given as an array" do + before do + @conditional = Chef::Resource::Conditional.not_if(@parent_resource, ["true"]) + end + + it "indicates that resource convergence should not continue" do + @conditional.continue?.should be_false + end + end + + describe "after running a failed/false command given as an array" do + before do + @status.send("success?=", false) + @conditional = Chef::Resource::Conditional.not_if(@parent_resource, ["false"]) + end + + it "indicates that resource convergence should continue" do + @conditional.continue?.should be_true + end + end + describe 'after running a command which timed out' do before do @conditional = Chef::Resource::Conditional.not_if(@parent_resource, "false") |