Thanks for the pointers!  That is the understanding I was missing and I 
will rework the code to rewrite it to get that working. 

On Wednesday, January 14, 2015 at 7:37:12 PM UTC-5, Michael Smith wrote:
>
> This is related to https://github.com/puppetlabs/puppet/pull/3443.
>
> The piece that's important here is the definition of #trusted. That may 
> need to be stubbed so that it returns true (or false, it's worth testing 
> both cases in a spec test) to get the behavior you want.
>
> One technique we often use is, when we have to call executables, wrapping 
> those calls in their own method so it can be stubbed. For example, you 
> might write
>
> def exec_getprpw(user):
>   %x(/usr/lbin/getprpw #{user} 2>&1)
> end
>
> then in the test
>
> provider.stubs(:exec_getprpw).with('root').returns('Some text')
>
> This simulates the call to getprpw without having a dependency on a 
> particular OS.
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/49328c02-e2c4-43cc-904e-a61f2bcc8f51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to