diff options
author | Thom May <thom@may.lt> | 2016-01-04 11:39:58 -0800 |
---|---|---|
committer | Thom May <thom@may.lt> | 2016-01-04 11:39:58 -0800 |
commit | 136cf3be7fd7477309ce61fde052c02c446dc931 (patch) | |
tree | 3dc4c5218f494d439ba8db0c7b34087ee4b47bf4 /spec/unit | |
parent | 59029900f00c5fe5f2450cb14b37f5c877accdb6 (diff) | |
parent | ff216f362b28ddc501247b37790f438aad29e65b (diff) | |
download | chef-136cf3be7fd7477309ce61fde052c02c446dc931.tar.gz |
Merge pull request #4315 from bbbco/master
Add extra tests around whether to skip with multiple guards
Diffstat (limited to 'spec/unit')
-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 |