I have a successful resource: (converged, worked as expected)
cron_d 'zk_metric' do
minute '*'
command “something something"
end
But after adding spec
it 'add cron_d' do
expect(chef_run).to create_cron_d('zk_metric')
end
chefspec
got the error:
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)
Why is this happening?
The matcher is already defined https://github.com/opscode-cookbooks/cron/blob/master/libraries/matchers.rb
Do I need to include
or require
something in my spec file (neither worked so far)? Or I need to create my own?
(Edit: stackoverflow autobot asked me to add ruby-on-rails tag, and so I did.)