No commit activity in last 3 years
No release in over 3 years
Minitest-Matchers for testing Chef in Test Kitchen
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

TestKitchenChefMinitestMatchers

Minitest assertions / matchers for testing Chef in Test Kitchen.

Platforms

Tested on Linux, should work on Windows, but is untested.
Chef-client needs to be installed to the default location for either platform.

Installation

Add to your Gemfile under test/integration//minitest/Gemfile:

gem "test_kitchen_chef_minitest_matchers"

Then, in your tests, add:

require "test_kitchen_chef_minitest_matchers"

Chef gem installations

Check whether a gem was successfully installed for the embedded Chef Ruby, for example using the chef_gem resource.

Adds assert_chef_gem_installed and refute_chef_gem_installed.

# Let's check whether the PostgreSQL gem is installed
assert_chef_gem_installed "pg"

# We can check for a specific version
assert_chef_gem_installed "pg", "0.18.2"

# Or we can use the gem version constraints, including the pessimistic constraint
assert_chef_gem_installed "pg", "~> 0.18"

# The MySQL gem should not be installed
refute_chef_gem_installed "mysql2"

# While the PostgreSQL gem should be installed, no 0.17.x version should be installed
refute_chef_gem_installed "pg", "~> 0.17"

For fans of the spec syntax, .must_be_installed_as_chef_gem and .must_not_be_installed_as_chef_gem are added.

# Let's check whether the PostgreSQL gem is installed
"pg".must_be_installed_as_chef_gem

# We can check for a specific version
"pg".must_be_installed_as_chef_gem("0.18.2")

# Or we can use the gem version constraints, including the pessimistic constraint
"pg".must_be_installed_as_chef_gem("~> 0.18")

# The MySQL gem should not be installed
"mysql2".must_not_be_installed_as_chef_gem

# While the PostgreSQL gem should be installed, no 0.17.x version should be installed
"pg".must_not_be_installed_as_chef_gem("~> 0.17")