Place include_recipe_helper.rb
in spec/support/helpers/
directory.
Then create a spec/spec_helper.rb
with the following:
require 'chefspec'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir["./spec/support/**/*.rb"].each {|f| require f}
RSpec.configure do |config|
# ...
config.include IncludeRecipeHelper
end
Example usage, assuming example::default
includes other_cookbook::recipe
:
require_relative '../spec_helper'
describe 'example::default' do
let(:runner) { ChefSpec::Runner.new }
subject { runner.converge(described_recipe) }
before do
enable_stubbed_include_recipe
end
it { should include_recipe('other_cookbook::recipe') }
end