rspec-puppet

Why do I get puppet-rspec 'class does not exist' when it does?

感情迁移 提交于 2019-12-20 04:34:58
问题 I setup a new puppet demo module with the following Gemfile and it worked as expected when I ran a simple puppet-rspec test. Gemfile source 'https://rubygems.org' if puppetversion = ENV['PUPPET_GEM_VERSION'] gem 'puppet', puppetversion, :require => false else gem 'puppet', '3.7.5' end gem 'metadata-json-lint' gem 'puppetlabs_spec_helper', '>= 0.1.0' gem 'puppet-lint', '>= 1.0.0' gem 'facter', '>= 1.7.0' gem 'rspec-puppet-facts' # rspec must be v2 for ruby 1.8.7 if RUBY_VERSION >= '1.8.7' and

Correct way to start RSpec-puppet unit tests

二次信任 提交于 2019-12-12 19:41:22
问题 I have created a simple Puppet 4 class and a unit test to go along with it as follows (after executing touch metadata.json; rspec-puppet-init while in modules/test/ ): # modules/test/manifests/hello_world1.pp class test::hello_world1 { file { "/tmp/hello_world1": content => "Hello, world!\n" } } # modules/test/spec/classes/test__hello_world1_spec.rb require 'spec_helper' describe 'test::hello_world1' do it { is_expected.to compile } it { is_expected.to contain_file('/tmp/hello_world1')\ .with

Rspec + puppet: nested fixtures?

孤街浪徒 提交于 2019-12-12 06:38:10
问题 i am trying to start using rspec to test some already made (and in production) puppet modules, but this thing keep trying to make me mad. First off, i am doing a "complete" test with rake. The task is: Rakefile: desc 'Validate manifests, templates, and ruby files' task :validate do Dir['manifests/**/*.pp'].each do |manifest| sh "puppet parser validate --noop #{manifest}" end Dir['spec/**/*.rb', 'lib/**/*.rb'].each do |ruby_file| sh "ruby -c #{ruby_file}" unless ruby_file =~ %r{spec/fixtures}