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') }

On Monday, 18 July 2011 at 3:23 PM, Luke Kanies wrote:

> On Jul 17, 2011, at 4:53 PM, Tim Sharpe wrote:
> 
> > Hi Dan,
> > 
> > Yeah, I'm focusing mainly on getting a clean RSpec API at the moment. What 
> > it looks like currently is
> > 
> > require 'rspec-puppet'
> > 
> > describe 'sysctl', :type => :define do
> > let(:module_path) { '/path/to/my/modules' }
> > let(:name) { 'baz' }
> > let(:params) { { :value => 'foo' } }
> > 
> > it { should create_exec('sysctl/reload').with_command("/sbin/sysctl -p 
> > /etc/sysctl.conf") }
> > end
> > 
> > 
> > This generates the catalogue for "sysctl { 'baz': value => 'foo' }" and 
> > checks that Exec['sysctl/reload'] exists with the specified command.
> > 
> > The code still has a few hardcoded values - that I need to get rid of - 
> > that prevent it from being usable by anyone else, but you can check out the 
> > code at https://github.com/rodjek/rspec-puppet. I'd love to hear any 
> > suggestions that you have! 
> 
> I really like this. I've been getting more into matchers, and I think it'd be 
> fantastic to have a collection of matchers that made it easy to test 
> manifests.
> 
> What's the reason for the separate 'create_exec', vs. the more generic 
> 'create_resource'?
> 
> -- 
> If there is anything the nonconformist hates worse than a conformist,
> it's another nonconformist who doesn't conform to the prevailing
> standard of nonconformity. --Bill Vaughan
> ---------------------------------------------------------------------
> 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] 
> (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