Ask Your Question
1

rspec-puppet: undefined method `has_resource_count?'. What can be wrong?

asked 2013-08-22 03:03:10 -0500

updated 2013-08-26 05:26:55 -0500

I'm stuck with error, and can't figure out what is wrong:

Puppet class:

class httpd::install {
  package { 'httpd': ensure => installed }
}

Rspec test.:

# spec/classes/install_spec.pp    
require 'spec_helper'

    describe "httpd::install" do
      it { should contain_package('httpd').with({ :ensure => 'installed'}) }

      it { should have_resource_count(1) }  
    end

And when I run it, i got error message:

Failures:

  1) httpd::install should have resource count 1
     Failure/Error: it { should have_resource_count(1) }
     NoMethodError: undefined method `has_resource_count?' for
#<Puppet::Resource::Catalog:0xXXXX>
     # ./spec/classes/install_spec.rb:8

All the gems are latest.

OS = CentOs 6.4 (Final).

I'm using open source Puppet ... (more)

edit retag flag offensive close merge delete

Comments

I'm new to rspec, so I can't offer a direct answer yet, but just for curiousity's sake, what happens if you change the test so it asserts ...(more)

GregLarkin gravatar imageGregLarkin ( 2013-08-23 02:19:52 -0500 )edit

I tried different values (1, 2, 0) - the result is the same: *NoMethodError*

Aleksey Timohin gravatar imageAleksey Timohin ( 2013-08-23 02:38:01 -0500 )edit

Ok, thanks for checking that. I'm not a certified Puppet developer yet, so I'll bet one of them could see the problem immediately. In the mean time, I ...(more)

GregLarkin gravatar imageGregLarkin ( 2013-08-23 10:07:12 -0500 )edit

Here is all the code you might need. But to reproduce the problem, you'll need rspec-puppet ready environment, and probably some of rspec-puppet basic knowledge, to place the files ...(more)

Aleksey Timohin gravatar imageAleksey Timohin ( 2013-08-23 10:40:28 -0500 )edit

I didn't find any mentions of this bug over the internet, that's why I'm not sure, that the bug is common. If it was - there probably were ...(more)

Aleksey Timohin gravatar imageAleksey Timohin ( 2013-08-23 10:43:41 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-08-26 16:13:18 -0500

GregLarkin gravatar image

Here's the problem: https://github.com/rodjek/rspec-puppet/issues/98

The master branch of rspec-puppet includes the missing matchers that are already listed on the website. At the moment, you'll have to build your own version of the gem or wait until the 0.2.0 release.

edit flag offensive delete link more

Comments

Thank you, very much.

Aleksey Timohin gravatar imageAleksey Timohin ( 2013-08-27 02:34:34 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-08-22 03:03:10 -0500

Seen: 914 times

Last updated: Aug 26 '13