我写了一个测试如下:
context "on #{os}" do
it { is_expected.to compile.with_all_deps }
it { is_expected.to create_class('acpid') }
context 'base' do
it { is_expected.to contain_package('acpid').with( :ensure => 'latest')}
it { is_expected.to contain_service('acpid').that_requires('Package[acpid]') }
it { is_expected.to contain_service('acpid').with({
:ensure => 'running',
:enable => true,
:hasstatus => true,
:hasrestart => true,
:start => '/sbin/service haldaemon stop; /sbin/service acpid start; /sbin/service haldaemon start',
})
}
end
end
end
结束结束
当我运行 rspec spec/classes/init_spec.rb; 我收到以下错误:
1) acpid 在 centos-6-x86_64 上支持的操作系统失败/错误:it { is_expected.to compile.with_all_deps } NameError: undefined local variable or method is_expected' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0x000000057b9aa8>
# ./spec/classes/init_spec.rb:10:in
block (5 levels) in '