puppetlabs/puppetlabs_spec_helper — pull request #29 by joshcooper (2012-12-18 20:56:49+00:00)
Title: (#18165) Initialize TestHelper as soon as possible

This PR ensures puppet's TestHelper is initialized as soon as possible and is intended to support various puppet versions, i.e. those with the `Puppet::Test::TestHelper.initialize` method and previous versions that don't have it.

This PR includes a test to ensure we can require a custom type from this module during a spec test. The test will only pass once PR https://github.com/puppetlabs/puppet/pull/1332 is merged (for issue http://projects.puppetlabs.com/issues/15529).

Note if testing with older versions of Puppet, e.g. 2.7, 3.0.x, the test will fail, as that functionality doesn't work on those. Ideally, I would set expectations to ensure the autoloader methods are invoked as expected, but the functionality we're testing needs to occur outside of an `it` block. Comments welcome on ways to improve this.