Branan Purvine-Riley
2012-Jun-08 20:32 UTC
[Puppet Users] Announce: puppetlabs_spec_helper 0.1.0 Available
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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Paul Belanger
2012-Jun-15 02:02 UTC
[Puppet Users] Re: Announce: puppetlabs_spec_helper 0.1.0 Available
On Friday, June 8, 2012 4:32:35 PM UTC-4, Branan Purvine-Riley wrote:> > 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 >I just stumbled across this post tonight, and have already implemented the gem in one of my modules. So far, so good. Thanks again for this and I expect to be adding it to move modules in the coming days. -- Paul Belanger | PolyBeacon, Inc. Jabber: paul.belanger@polybeacon.com | IRC: pabelanger (Freenode) Github: https://github.com/pabelanger | Twitter: https://twitter.com/pabelanger -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/MDYa5r-Oj0wJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.