0

我对这一切都很陌生。我正在尝试使用 Beaker 测试一个 puppet 模块。我不断得到这个:

NoMethodError: undefined method `describe' for 
#Beaker::TestCase:0x007fd6f95e6460
/Users/user1/beaker/Puppet/puppet-files/spec/classes/unit_spec.rb:3  
/Users/user1/.rvm/gems/ruby-2.2.7/gems/beaker-3.24.0/bin/beaker:9  
/Users/user1/.rvm/gems/ruby-2.2.7/bin/ruby_executable_hooks:15  
/Users/user1/.rvm/gems/ruby-2.2.7/bin/ruby_executable_hooks:15.

这是我正在运行的命令 - “beaker --hosts myhost.yaml --pre-suite spec”。

我的 unit_spec.rb 包含以下内容:

require 'puppetlabs_spec_helper/rake_tasks'

describe 'application' do
  context 'applied to supported operating system' do
    on_supported_os.each do |os, facts|
      context "#{os}" do
       let(:facts) do
         facts
       end

       context "without any parameters" do
         let(:params) {{ }}

         it { is_expected.to compile.with_all_deps }
         it { is_expected.to contain_class('files') }
       end
     end
   end
 end


 context 'applied to unsupported operating system' do
   describe 'ubuntu-14-x86_64' do
     let(:facts) {{
       :osfamily        => 'Debian',
       :operatingsystem => 'Ubuntu'
     }}

     it { is_expected.to raise_error(Puppet::Error, /Ubuntu not supported/) }
   end
 end

结尾

任何帮助将非常感激!顺便说一句,我正在使用'puppetlabs_spec_helper/rake_tasks',因为当我刚刚使用'spec_helper'时,它给了我一个错误,即使它在那里也无法“加载此类文件”。

4

0 回答 0