In debugging this issue on Windows, it turns out that a Resource's `#source_line` could be a path with Windows-style back slashes: C:\Users\jdoe\AppData\Local\Temp\xxyy\cookbooks\logrotate\recipes\default.rb:20 or a path with Unix-style forward slashes: C:/Users/jdoe/AppData/Local/Temp/xxyy/cookbooks/logrotate/recipes/default.rb:20 This commit normalizes the path delimeters to always be Unix-style forward slashes for the purpose of Regexp comparison. To guard against any behavior regressions in `ChefSpec::Coverage::BerkshelfFilter`, a minimal set of specs was added to exercise the behavior of the `#matches?` method. Normally, we would require the Berkshelf codebase to create a `Berkshelf::Berksfile` instance, but due to the soft-dependency nature of the Berkshelf code (i.e. optional and not required), a couple of Rspec code doubles was used instead to mimic the `Berksfile`'s behavior. Fixes #594
This is being tracked upstream in chef/chef#3078. The behavior of converge changed from re-raising exceptions to returning them. This will hopefully be resolved in 12.1.2 but this code will be needed to match things up for 12.1.0 and 12.1.1. Without this, you cannot test for exceptions being raised by recipe code.
…erwise fall back to Chef::Resource#resource_name (Chef <= 11)