Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rodjek/rspec-puppet
head fork: rodjek/rspec-puppet
Commits on Aug 11, 2011
@rodjek Prettify README with some syntax highlighting 20cfb2d
Commits on Aug 29, 2011
@rodjek Add support for testing undefined resource parameters
Closes #13
@rodjek Bump to 0.0.7 c2fd88f
@rodjek munge symbol fact names to strings 26920e9
@rodjek Bump to 0.0.8 6026434
Commits on Aug 31, 2011
@athak athak Add support for additional puppet settings 0820a4f
Commits on Sep 16, 2011
@rodjek default manifest_dir, manifest & template_dir to nil 37906c4
@rodjek automatically set domain fact 1cd3bb9
@rodjek Bump to 0.0.9 cdd0bcb
Commits on Nov 01, 2011
@rodjek Initial function testing mock up 89ac6b8
@rodjek Move manifest matchers into ManifestMatchers module b757ad1
@rodjek WIP 7310eec
@rodjek Document function testing 81257c7
@rodjek Missing an end in an example bb9f233
@rodjek Double plural eb50b75
@rodjek Add new files to gemspec dd259e6
@rodjek Munge libdir to autoload module plugins without pluginsync 7f7e74f
@rodjek Don't hardcode path separator bf2be94
Commits on Nov 03, 2011
@rodjek Better failure messages for the run matcher aefb870
@rodjek Bump to 0.1.0 c73f8ce
Commits on Dec 06, 2011
@jeffmccune jeffmccune Fix rspec dependency
Without this patch, working with rspec-puppet in IRB fails when directly
requiring the library:

    ruby-1.8.7-p334 :001 > require 'rspec-puppet'
    NameError: uninitialized constant RSpec
        from /Users/jeff/.rvm/gems/ruby-1.8.7-p334@puppet/gems/rspec-puppet-0.1.0/lib/rspec-puppet/matchers/create_generic.rb:1
        from /Users/jeff/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /Users/jeff/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from /Users/jeff/.rvm/gems/ruby-1.8.7-p334@puppet/gems/rspec-puppet-0.1.0/lib/rspec-puppet/matchers.rb:1
        from /Users/jeff/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /Users/jeff/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from /Users/jeff/.rvm/gems/ruby-1.8.7-p334@puppet/gems/rspec-puppet-0.1.0/lib/rspec-puppet.rb:2
        from /Users/jeff/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:58:in `gem_original_require'
        from /Users/jeff/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:58:in `require'
        from (irb):1

This patch fixes the problem by requiring rspec directly from rspec-puppet.rb
Commits on Dec 29, 2011
@jeffmccune jeffmccune Add Regexp support to with_* matchers and improve error messages
Without this patch it is difficult to match portions of long strings
which are attribute values of resource parameters.  For example, the
content parameter of a file resource with a multi-line template.

This patch makes it easier to match portions of the parameter's value by
passing a Regexp instance to the with_ catch all matcher.

The use case looks like:

    describe 'with lsbmajdistrelease available' do
      let(:facts) { @facter_facts.merge({'lsbmajdistrelease' => '6'}) }
      it { should_not contain_file('puppetenterprise.repo').with_content(missing_content) }
      it { should contain_package 'pe-ruby-devel' }
      it do
        should contain_file('puppetenterprise.repo').with_content(/baseurl=http/)
        should contain_file('puppetenterprise.repo').with_content(/pe_base/)
        should contain_file('puppetenterprise.repo').with_content(/pe_updates/)
        should contain_file('puppetenterprise.repo').with_content(/pe_extras/)

This feature allows the same parameter to be matched multiple times using
multiple different regular expressions.

This patch also improves the error message by presenting the actual value in
the catalog when it does not match the expectation.  This change applies to
both String and Regexp expectation matches.

The error output now looks like:

    1) pe_devel on redhat el6 os families with lsbmajdistrelease available
       Failure/Error: should contain_file('puppetenterprise.repo').with_content(/JEFF MCCUNE/)
         expected that the catalogue would contain File[puppetenterprise.repo] with content \
         matching `/JEFF MCCUNE/` but its value of `"# KERMIT FROG\n"` does not

Spec tests have been added to exercise the handling of Regexp instances.

Reviewed-by: Dan Bode
@bodepd bodepd Add Rake task 'spec'
Adds the Rake task 'spec' for consistency
with other Rakefiles in Puppet related projects.
@jeffmccune jeffmccune Merge pull request #17 from jeffmccune/feature/master/improve_matcher…

Add Regexp support to with_* matchers and improve error messages
@jeffmccune jeffmccune Merge pull request #16 from jeffmccune/bug/master/fix_rspec_requirement
Fix rspec dependency
@bodepd bodepd Add with method to generic matcher
This commit adds a method 'with' that can be used
to test mulitple parameters/values with a single
method call


  it do should contain_service('keystone').with(
    'ensure'     => 'running',
    'enable'     => 'true',
    'hasstatus'  => 'true',
    'hasrestart' => 'true'
  ) end

It was created as a more condensed alternative to
chaining methods per parameter to validate.
Commits on Dec 30, 2011
@bodepd bodepd Add 'without' method
Adds a method 'without' which accepts a list of
parameters that should not be defined in the resource.


  it { should contain_service('keystone').without(
    ['restart', 'status']
@jeffmccune jeffmccune Merge pull request #18 from bodepd/with_without_methods
Adds with/without methods
Commits on Jan 20, 2012
@rodjek bump to 0.1.1 d102ebe
Commits on Feb 15, 2012
@rodjek Organise fixtures into modules/ & manifests/ a3fff45
@rodjek Add support for testing the catalogue for a defined host a1b5ebe
Commits on Feb 16, 2012
@nanliu nanliu Add Puppet[:config] as a supported option. cbc3a77
Commits on Mar 12, 2012
@rodjek Add helper script to configure a module for rspec-puppet testing 4300f25
@rodjek Merge pull request #21 from nanliu/tb/config
Add Puppet[:config] as a supported option.
Commits on Apr 05, 2012
@rodjek Friendlier descriptions for contain_ matcher 130aec5
@rodjek Have Travis-ci test rspec-puppet automatically cf7100f
Commits on Apr 06, 2012
@rodjek Have travis build 1.9 398fc77
@rodjek Puppet 2.7 under 1.9.x converts all array members to strings
This hack should keep things working the same under 1.8 and 1.9
@rodjek String#to_a doesn't work under 1.9 eea6dd5
Something went wrong with that request. Please try again.