Module: ChefSpec::API::OsxProfileMatchers

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

Overview

Since:

  • 5.1.0

Instance Method Summary collapse

Instance Method Details

#install_osx_profile(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher

Assert that an osx_profile resource exists in the Chef run with the action :install. Given a Chef Recipe that installs “bsmith” as an profile:

osx_profile 'bsmith' do
  action :install
end

The Examples section demonstrates the different ways to test an osx_profile resource with ChefSpec.

Examples:

Assert that an osx_profile was installed

expect(chef_run).to install_osx_profile('bsmith')

Assert that an osx_profile was not installed

expect(chef_run).to_not install_osx_profile('bsmith')

Parameters:

  • resource_name (String, Regex)

    the name of the resource to match

Returns:

Since:

  • 5.1.0



30
31
32
# File 'lib/chefspec/api/osx_profile.rb', line 30

def install_osx_profile(resource_name)
  ChefSpec::Matchers::ResourceMatcher.new(:osx_profile, :install, resource_name)
end

#remove_osx_profile(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher

Assert that an osx_profile resource exists in the Chef run with the action :remove. Given a Chef Recipe that removes “bsmith” as an profile:

osx_profile 'bsmith' do
  action :remove
end

The Examples section demonstrates the different ways to test an osx_profile resource with ChefSpec.

Examples:

Assert that an osx_profile was removed

expect(chef_run).to remove_osx_profile('bsmith')

Assert that an osx_profile was not removed

expect(chef_run).to_not remove_osx_profile('bsmith')

Parameters:

  • resource_name (String, Regex)

    the name of the resource to match

Returns:

Since:

  • 5.1.0



58
59
60
# File 'lib/chefspec/api/osx_profile.rb', line 58

def remove_osx_profile(resource_name)
  ChefSpec::Matchers::ResourceMatcher.new(:osx_profile, :remove, resource_name)
end