rodjek/rspec-puppet — pull request #36 by bodepd (2012-08-01 22:52:11+00:00)
Title: Add support for pre_condition with functions

This commit adds support for using the pre_condition
hook to specify the source code that should be used to
compile a catalog that can be introspected by functions for
testing purposes.

This allows users to test functions that need access to
catalog contents.

This allows the following snippet to test a function that
needs access to the catalog generated by pre_condition:

describe 'defined_with_params' do
#describe 'when resource is passed as a string' do
let :pre_condition do
'user { "dan": }'
end
it { should run.with_params('User[dan]', {}).and_return('true') }
end