diff options
author | bbbco <bdgoad@gmail.com> | 2015-12-15 17:29:07 -0500 |
---|---|---|
committer | bbbco <bdgoad@gmail.com> | 2015-12-15 17:29:07 -0500 |
commit | ff216f362b28ddc501247b37790f438aad29e65b (patch) | |
tree | fc58b9c6a3cfa998b20b1e90786d2f8a700da12d /spec | |
parent | f314c1da2ab5e2f9bd528b8acdf79c1ccf7879d7 (diff) | |
download | chef-ff216f362b28ddc501247b37790f438aad29e65b.tar.gz |
Add extra tests around whether to skip with multiple guards
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/resource_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 59951941d7..f4dbc8d745 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -743,6 +743,12 @@ describe Chef::Resource do expect(resource.should_skip?(:purr)).to be_truthy end + it "should return false when only_if is met and also not_if is not met" do + resource.only_if { true } + resource.not_if { false } + expect(resource.should_skip?(:purr)).to be_falsey + end + it "should return true when one of multiple only_if's is not met" do resource.only_if { true } resource.only_if { false } @@ -757,6 +763,20 @@ describe Chef::Resource do expect(resource.should_skip?(:purr)).to be_truthy end + it "should return false when all of multiple only_if's are met" do + resource.only_if { true } + resource.only_if { true } + resource.only_if { true } + expect(resource.should_skip?(:purr)).to be_falsey + end + + it "should return false when all of multiple not_if's are not met" do + resource.not_if { false } + resource.not_if { false } + resource.not_if { false } + expect(resource.should_skip?(:purr)).to be_falsey + end + it "should return true when action is :nothing" do expect(resource.should_skip?(:nothing)).to be_truthy end |