我有一个成功的资源:(收敛,按预期工作)
cron_d 'zk_metric' do
minute '*'
command “something something"
end
但添加规格后
it 'add cron_d' do
expect(chef_run).to create_cron_d('zk_metric')
end
chefspec
得到错误:
Failures:
1) myorg::myrecipe add cron_d
Failure/Error: expect(chef_run).to create_cron_d('zk_metric')
NoMethodError:
undefined method `create_cron_d' for #<RSpec::ExampleGroups::Myorgmyrecipe:0x007fa726086e50>
# ./spec/myrecipe_spec.rb:93:in `block (2 levels) in <top (required)>'
Finished in 12.17 seconds (files took 1.08 seconds to load)
为什么会这样?
匹配器已经定义https://github.com/opscode-cookbooks/cron/blob/master/libraries/matchers.rb
我是否需要include
或require
在我的规范文件中使用某些东西(到目前为止都没有工作)?还是我需要创建自己的?
(编辑:stackoverflow autobot 要求我添加 ruby-on-rails 标签,所以我做到了。)