class ChefSpec::Librarian
def initialize
def initialize @tmpdir = Dir.mktmpdir end
def setup!
Setup and install the necessary dependencies in the temporary directory.
def setup! env = ::Librarian::Chef::Environment.new(project_path: Dir.pwd) env.config_db.local['path'] = @tmpdir ::Librarian::Action::Resolve.new(env).run ::Librarian::Action::Install.new(env).run ::RSpec.configure { |config| config.cookbook_path = @tmpdir } end
def teardown!
Remove the temporary directory.
def teardown! FileUtils.rm_rf(@tmpdir) if File.exists?(@tmpdir) end