Module: ChefSpec::API::StateAttrs

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

Instance Method Summary collapse

Instance Method Details

#have_state_attrs(*state_attrs) ⇒ ChefSpec::Matchers::StateAttrsMatcher

Assert that a Chef resource has certain state attributes (since Chef 11.8.0):

state_attrs :time, :temperature

The Examples section demonstrates the different ways to test a resource’s state_attrs with ChefSpec.

Examples:

Assert the lwrp resource has two state attributes

expect(lwrp).to have_state_attrs(:time, :temperature)

Parameters:

  • state_attrs (Array)

    the list of state attributes to assert

Returns:

See Also:



24
25
26
# File 'lib/chefspec/api/state_attrs.rb', line 24

def have_state_attrs(*state_attrs)
  ChefSpec::Matchers::StateAttrsMatcher.new(state_attrs)
end