You want to test a resource definition (class, defined type) that uses a function provided by a third-party module your module depends upon.
It's supposed that you're implementing your tests with rspec-puppet
.
Add the folder spec/fixtures/<third-party module>/lib
to Ruby's $LOAD_PATH
.
According to Brice Figureau (@masterzen):
The Puppet::Parser::Functions class in Puppet core has the task of loading all functions defined in any puppet/parser/functions directories it will be able to find in the whole ruby load path.
Relying on rspec-puppet telling Puppet where to look for modules seems not to be enough to also have functions at disposal. In fact, exercising code that uses a third-party function without the additional step described in this pattern results in a Puppet::Error: Unknown function
exception.