我写了一个测试如下:
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)在centos-6-x86_64上支持acpid操作系统
失败/错误:{is_expected.to compile.with_all_deps}
NameError:
未定义的局部变量或方法is_expected' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0x000000057b9aa8>
# ./spec/classes/init_spec.rb:10:in
块(5级)在&#39;