I try do implement tests for my puppet code and was playing with rspec-puppet but the following code gives me errors require ''spec_helper'' describe ''irqbalance'' do it { should include_class(''irqbalance'') } it { should include_class(''irqbalance::data'') } it { should contain_package(''irqbalance'').with(:ensure => ''installed'') } end The errors looks like NoMethodError: undefined method `include_class'' NoMethodError: undefined method `contain_package'' I feel lost. These methods are supposed to provided by rspec-puppet ? $ gem list|grep rspec rspec (2.10.0) rspec-core (2.10.1) rspec-expectations (2.10.0) rspec-mocks (2.10.1) rspec-puppet (0.1.3) This is on OS-X -- Kind Regards, Markus Falb
Hi Markus, you are missing an opening statement. Try: require ''spec_helper'' describe ''class::name'', :type => :class do describe ''irqbalance'' do it { should include_class(''irqbalance'') } it { should include_class(''irqbalance::data'') } it { should contain_package(''irqbalance'').with(:ensure => ''installed'') } end end Cheers, Atha On Friday, May 25, 2012 at 8:35 AM, Markus Falb wrote:> I try do implement tests for my puppet code and was playing with > rspec-puppet but the following code gives me errors > > require ''spec_helper'' > describe ''irqbalance'' do > it { should include_class(''irqbalance'') } > it { should include_class(''irqbalance::data'') } > it { should contain_package(''irqbalance'').with(:ensure => ''installed'') } > end > > The errors looks like > > NoMethodError: > undefined method `include_class'' > NoMethodError: > undefined method `contain_package'' > > I feel lost. > These methods are supposed to provided by rspec-puppet ? > > $ gem list|grep rspec > rspec (2.10.0) > rspec-core (2.10.1) > rspec-expectations (2.10.0) > rspec-mocks (2.10.1) > rspec-puppet (0.1.3) > > This is on OS-X > -- > Kind Regards, Markus Falb-- 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.
On 25.5.2012 14:51, Atha Kouroussis wrote:> Hi Markus, > you are missing an opening statement. Try: > > require ''spec_helper'' > describe ''class::name'', :type => :class do > describe ''irqbalance'' do > it { should include_class(''irqbalance'') } > it { should include_class(''irqbalance::data'') } > it { should contain_package(''irqbalance'').with(:ensure => ''installed'') } > end > endThank you, that helped. I am getting another error messages like Puppet::Error: Could not parse for environment production: No file(s) found for import of ''/Users/mafalb/.puppet/manifests/site.pp'' but i am getting closer. -- Kind Regards, Markus Falb
This is related to https://github.com/rodjek/rspec-puppet/issues/15 and http://projects.puppetlabs.com/issues/11191. It looks like there is a setup script in rspec-puppet called rspec-puppet-init to handle this problem. Alternatively, the workaround that bodepd mentions in the github issue is to just create an empty site.pp, so `touch /Users/mafalb/.puppet/manifests/site.pp` should also address this problem for you. HTH -matthaus On Fri, May 25, 2012 at 12:33 PM, Markus Falb <markus.falb@fasel.at> wrote:> On 25.5.2012 14:51, Atha Kouroussis wrote: >> Hi Markus, >> you are missing an opening statement. Try: >> >> require ''spec_helper'' >> describe ''class::name'', :type => :class do >> describe ''irqbalance'' do >> it { should include_class(''irqbalance'') } >> it { should include_class(''irqbalance::data'') } >> it { should contain_package(''irqbalance'').with(:ensure => ''installed'') } >> end >> end > > Thank you, that helped. > I am getting another error messages like > > Puppet::Error: > Could not parse for environment production: No file(s) found for > import of ''/Users/mafalb/.puppet/manifests/site.pp'' > > but i am getting closer. > -- > Kind Regards, Markus Falb >-- Matthaus Litteken Release Manager, Puppet Labs -- 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.
Hi Markus, For more information on what that script does, check out http://rspec-puppet.com/setup/ (also contains a step by step guide for how to setup rspec-puppet in your modules manually). Cheers, Tim On Saturday, 26 May 2012 at 5:39 AM, Matthaus Litteken wrote:> This is related to https://github.com/rodjek/rspec-puppet/issues/15 > and http://projects.puppetlabs.com/issues/11191. It looks like there > is a setup script in rspec-puppet called rspec-puppet-init to handle > this problem. Alternatively, the workaround that bodepd mentions in > the github issue is to just create an empty site.pp, so `touch > /Users/mafalb/.puppet/manifests/site.pp` should also address this > problem for you. > > HTH > -matthaus > > On Fri, May 25, 2012 at 12:33 PM, Markus Falb <markus.falb@fasel.at (mailto:markus.falb@fasel.at)> wrote: > > On 25.5.2012 14:51, Atha Kouroussis wrote: > > > Hi Markus, > > > you are missing an opening statement. Try: > > > > > > require ''spec_helper'' > > > describe ''class::name'', :type => :class do > > > describe ''irqbalance'' do > > > it { should include_class(''irqbalance'') } > > > it { should include_class(''irqbalance::data'') } > > > it { should contain_package(''irqbalance'').with(:ensure => ''installed'') } > > > end > > > end > > > > > > > > > Thank you, that helped. > > I am getting another error messages like > > > > Puppet::Error: > > Could not parse for environment production: No file(s) found for > > import of ''/Users/mafalb/.puppet/manifests/site.pp'' > > > > but i am getting closer. > > -- > > Kind Regards, Markus Falb > > > > > > > -- > Matthaus Litteken > Release Manager, Puppet Labs > > -- > 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 (mailto:puppet-users@googlegroups.com). > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com (mailto:puppet-users+unsubscribe@googlegroups.com). > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. > >-- 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.