There is no helper built in to rspec-puppet to do this, but you can do it
by using an rspec expect() around a catalogue.resources check:
it "has no file resources with ensure => directory" do
expect(catalogue.resources.select { |r| r.type == "File" && r[:ensure] ==
"directory" }).to be_empty
end
On Mon, Jul 20, 2015 at 12:28 PM <[email protected]> wrote:
> RSpec question for all the helpful folks here:
>
> How do I test that there is no resource in the catalog that matches
> certain parameters?
>
> I know how to test that a specific resource does not exist, or a specific
> resource does not match certain parameters.
>
> I want to test that, for example, there are no file resources with :ensure
> => directory set.
>
> Is this possible?
>
> Thanks in advance,
> - Johnson
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/89c69357-d468-47ec-80ca-50f847a24a24%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/89c69357-d468-47ec-80ca-50f847a24a24%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/CAJaQvGCJR%2BAGt2pi4rPBYsk3bhn7whw9grqwC-o31XQ07hqjaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.