1

I would like to use a serverspec check and run it against two acceptable outcomes, so that if either passes then the check passes. I want my check to pass if the exit status of the command is either 0 or 1. Here is my check:

describe command("rm /var/tmp/*.test") do
  its(:exit_status) { should eq 0 }   
end

Right now it can only check if the exit status is 0. How can I change my check to use either 0 or 1 as an acceptable exit status?

Alex Cohen
  • 5,596
  • 16
  • 54
  • 104

1 Answers1

2

Use a compound matcher.

its(:exit_status) { should eq(0).or eq(1) }
coderanger
  • 52,400
  • 4
  • 52
  • 75