我的rspec-puppet单元测试存在一些问题。我不断收到以下错误。我已经包含了我的木偶类清单和规格测试。我使用http://rspec-puppet.com/上的说明设置了测试环境。错误如下。
木偶清单
# Cups class for stopping and disabling cups
class cups {
service { 'cupsd':
ensure => stopped,
enable => false,
}
}
规范测试
require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
describe 'cups' do
it { should contain_service('cupsd').with_ensure('stopped') }
it { should contain_service('cupsd').with_enable('false') }
end
故障:
1) cups cups service
Failure/Error: it { should contain_service('cupsd').with_ensure('stopped') }
NoMethodError:
undefined method `lookup' for Puppet:Module
# ./spec/classes/cups_spec.rb:6:in `block (3 levels) in <top (required)>'
2) cups cups service
Failure/Error: it { should contain_service('cupsd').with_enable('false') }
NoMethodError:
undefined method `lookup' for Puppet:Module
# ./spec/classes/cups_spec.rb:7:in `block (3 levels) in <top (required)>'