On Tuesday, March 6, 2012 at 11:24 AM, Trevor Vaughan wrote:
> Hi Nick,
>
> Thanks for getting back to me.
>
> Unfortunately, this doesn't seem to be working for me.
>
> I tried:
>
> require 'rubygems'
> require 'puppet'
> require 'spec'
> require 'spec/mocks'
>
> env = Puppet::Node::Environment.new('nodename')
> Puppet::Parser::Functions::function(:mangle_ip_address)
> s = Puppet::Parser::Scope.new
> s.stub(:e).and_return env
>
> # Mask the ipaddress variable
> s.setvar('ipaddress','11.22.33.44')
> s.function_mangle_ip_address([])
>
> But unfortunately ended with the same result.
>
> I do figure that :e is not the correct procedure to stub, but I'm not
> sure which one is.
>
Hah oops, I guess I shouldn't write emails in the morning. That should be
stubbing the :environment method (which it will consult to get at
known_resource_types).
Nick
--
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.