On Thu, Jan 24, 2013 at 11:04 AM, John Julien <[email protected]> wrote:
> I worded that wrong, sorry for the confusion. I am actually trying to test
> for what a function is called with NOT what it returns. "execute" is called
> with an Array that contains a system command and arguments. I want to make
> sure that the array contains at least "/usr/sbin/usermod" and "-e". If all I
> cared about was making sure the /usr/sbin/usermod was in the array this
> syntax works "provider.expects(:execute).with(includes('/usr/sbin/usermod'))"
>
> The Mocha documentation uses this example of the includes method:
> object.expects(:method_1).with(includes('foo'))
Huh. I must go and re-read it; I didn't know that worked.
> Your suggestion of using the block method appears to be exactly what I needed
> provider.expects(:execute).with() {|args|
> args.include?('/usr/sbin/usermod') and args.include?('-e') }
I am glad I was helpful despite being out of date on the latest
developments in Mocha. :)
--
Daniel Pittman
⎋ Puppet Labs Developer – http://puppetlabs.com
♲ Made with 100 percent post-consumer electrons
--
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].
Visit this group at http://groups.google.com/group/puppet-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.