rodjek/rspec-puppet — pull request #80 by willaerk (2013-02-11 22:06:39+00:00)
Title: Asserting an exact set of resource parameters and values

This adds new matchers to check for an exact set of resource parameters. It does so by verifying the number of expected parameters is the same as the number of parameters in the catalogue and then delegating the verification of the parameter values to the 'with' matcher.

This functionality has been requested earlier in #42, where the 'with_only' syntax was proposed. As this would create an obvious ambiguity with the 'only' parameter for the 'with' matcher, I used 'only_with' instead. As I am not a native english speaker (and consequently miss out on a lot of subtleties in the language) this might not be the best choice. Please comment, or propose a better alternative (withonly ?), I'll update the PR accordingly.

Examples:

it { should contain_package('httpd').only_with_ensure('latest') }

it { should contain_file('/tmp/bla').only_with(
ensure => 'file',
content => 'foo
)}