Module: ChefSpec::API::DoNothing

Defined in:
lib/chefspec/api/do_nothing.rb

Instance Method Summary collapse

Instance Method Details

#do_nothingChefSpec::Matchers::DoNothingMatcher

Assert that a resource in the Chef run does not perform any actions. Given a resource with action :nothing:

package 'apache2' do
  action :nothing
end

The Examples section demonstrates the different ways to test that no actions were performed on a resource in a Chef run.

Examples:

Assert the package does not perform any actions

expect(chef_run.package('apache2')).to do_nothing

Returns:


20
21
22
# File 'lib/chefspec/api/do_nothing.rb', line 20

def do_nothing
  ChefSpec::Matchers::DoNothingMatcher.new
end