Unfortunately rspec already claims /have_.*/ in their matchers and I don't 
really want to break that functionality. 

I've pushed a small patch to enable contain_<foo> and it shouldn't be too much 
of an issue to get a contain() matcher that supports the Puppet nomenclature 
happening either. 

On Wednesday, 20 July 2011 at 2: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.
> -- 
> Brice Figureau
> My Blog: http://www.masterzen.fr/
> 
> -- 
> 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] 
> (mailto:[email protected]).
> To unsubscribe from this group, send email to 
> [email protected] 
> (mailto:[email protected]).
> For more options, visit this group at 
> http://groups.google.com/group/puppet-dev?hl=en.

-- 
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.

Reply via email to