provides :foo
default_action :quux
property :bar, String
load_current_value do
bar 'not blah'
end
action :quux do
converge_if_changed :bar do
converge_by 'calling Foo.bar' do
Foo.bar(new_resource.bar)
end
end
end
How do I test that the helper method is called
describe "resource calls helper method" do
before do
# *** I know that the helper method can be stubbed like this ***
allow(Foo).to receive(:bar).and_return 'foo'
end
recipe do
foo 'blah' do
bar 'blah'
end
end
# *** I know I can test Chef built-in resources like this ***
it { is_expected.to run_execute('blah') }
######################################################
# HOW DO I TEST THAT THE HELPER METHOD WAS CALLED???
# The following does not work
#######################################################
it { expect(Foo).to receive(:bar).with('blah')
end