puppetlabs_spec_helper is a Rubygem to make writing and running module spec
tests using rspec-puppet easier. It includes a set of common rake tasks and
a spec_helper that correctly initializes puppet and rspec-puppet for
testing.

The code is available on github at
http://github.com/puppetlabs/puppetlabs_spec_helper. Patches are welcome.


To convert a module with existing spec tests to use the gem:

* install the gem with 'gem install puppetlabs_spec_helper'

* Change your Rakefile to the following contents:

    require 'rubygems'
    require 'puppetlabs_spec_helper/rake_tasks'

If you have any special rake tasks, you can add them after the requires and
they will work as expected.

* Change spec/spec_helper.rb to the following contents:

    require 'rubygems'
    require 'puppetlabs_spec_helper/module_spec_helper'

* Create a .fixtures.yml file:

    fixtures:
      repositories:
        "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib"
      symlinks:
        "MY_MODULE": "#{source_dir}"

Other dependency modules can be added to the "repositories" section.

* Run 'rm -r spec/fixtures'. The rake task will populate the fixtures
directory for you based on your .fixtures.yml


Once these steps are completed, you can execute 'rake spec' to run your
rspec-puppet spec tests. For an example module which uses the gem for its
spec tests, see https://github.com/puppetlabs/puppetlabs-apt

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to