acrmp/chefspec — pull request #142 by acrmp (2013-05-28 22:08:28+00:00)
Title: Basic guard support

This pull request adds support for evaluating resource conditionals / guards. This is essentially the same change originally proposed and implemented in #35.

Rather than always evaluating guards you'll need to tell chefspec explicitly that you want them evaluated as they may have nasty side effects:

```ruby
let(:chef_run){ ChefSpec::ChefRunner.new({:evaluate_guards => true}) }
```

The arguments to `Chef::Resource#should_skip?` changed between 10.12 and 10.14 so we need to handle this specially. I haven't tried to ensure compatibility with Chef 0.9.x now that ChefSpec itself depends on Chef > 0.10.0.

If you want to mock the result of Ruby guards this should be useful as-is. I'm going to add support for mocking shell guards later this week.

Cheers,

Andrew.