summaryrefslogtreecommitdiff
path: root/spec/unit/resource/conditional_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/resource/conditional_spec.rb')
-rw-r--r--spec/unit/resource/conditional_spec.rb50
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")