On Jul 19, 2011, at 9:59 AM, Brice Figureau wrote:
> On 18/07/11 09:18, Tim Sharpe wrote:
>> We have a generic create_resource matcher than can be used however for a
>> nicer experience I also want to create specific matchers for the built
>> in types.
>>
>> it { should create_resource('package',
>> 'mysql-server').with_param('ensure', 'present') }
>> vs
>> it { should create_package('mysql-server').with_ensure('present') }
>
> If your intent is checking the catalog content, it would be even more
> readable to use "contain" or "have" instead of "create":
>
> it { should contain_package('mysql') }
> or
> it { should have_package... }
>
> I'm even wondering if the following wouldn't be better:
> it { should contain('Package[mysql]').with_ensure('installed') }
>
> Of course this uses the Puppet idiom so it might not fit all users, but
> it is pretty readable for people that already dealt with the DSL.
Supporting either isn't that hard - in fact, the Catalog class's 'resource'
method supports both, so it should be easy indeed.
--
There are no such things as applied sciences, only applications of
science. -- Louis Pasteur
---------------------------------------------------------------------
Luke Kanies | http://puppetlabs.com | http://about.me/lak
Join us in PDX for PuppetConf: http://bit.ly/puppetconfsig
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.