Skip to content

Instantly share code, notes, and snippets.

@calavera
Created May 2, 2012 19:16
Show Gist options
  • Select an option

  • Save calavera/2579422 to your computer and use it in GitHub Desktop.

Select an option

Save calavera/2579422 to your computer and use it in GitHub Desktop.
minitest-chef-handler recipe
gem_package "minitest" do
action :nothing
end.run_action(:upgrade)
gem_package "minitest-chef-handler" do
action :nothing
end.run_action(:upgrade)
require 'rubygems'
Gem.clear_paths
require 'minitest-chef-handler'
# The path is not mandatory if you're using minitest-chef-handler 0.5.0 or above.
# The gem autodetects your tests inside the cookbooks.
path = File.join(Chef::Config[:cookbook_path],
"**",
"test",
"test_*.rb")
Chef::Log.info "path is #{path}, entries: #{Dir.glob(path).entries}"
handler = MiniTest::Chef::Handler.new(:path => path)
Chef::Client.send(:report_handlers) << handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment