rodjek/rspec-puppet — pull request #237 by joshcooper (2014-12-03 06:08:42+00:00)
Title: Set $LOAD_PATH instead of puppet's libdir

Commit 7f7e74f02c set puppet's `libdir` to include the lib directory for
each module in the `modulepath`. Doing so enabled puppet's autoloader to
load modules that hadn't been pluginsynced. However, this only worked for
code that the autoloader directly loaded. It didn't work when the
autoloaded type, provider, etc required helper code in the same module,
or different module, because the module's lib directory was not in ruby's
$LOAD_PATH.

The commit also relied on inconsistent behavior in puppet whereby sometimes
puppet assumed `libdir` was a (semi)colon separated list of directories, and
sometimes it assumed a single directory. In Puppet 4.0, puppet will
only interpret the `libdir` setting as a single directory[1].

As a result, this commit stops setting `libdir` and instead updates the
ruby $LOAD_PATH. In doing so, rspec-puppet is the "application" the uses
puppet as a "library". In that pattern, rspec-puppet is the thing that
sets the ruby $LOAD_PATH, and puppet just uses the specified $LOAD_PATH.
This is similar to how we fixed loading faces from modules[2] in commit[3].

[1] https://tickets.puppetlabs.com/browse/PUP-3336
[2] https://projects.puppetlabs.com/issues/7316
[3] https://github.com/puppetlabs/puppet/commit/4f99f25cd