chef-infrachefspec

ChefSpec test if python modules were installed


I found a way in InSpec to test whether or not python modules have been installed with chef, but I'm using ChefSpec and I can't find an alternative. Does anybody know if there's a way to check if a certain pip module has been installed with ChefSpec?


Solution

  • ChefSpec doesn't test side effects, so you don't check the module itself, you look at what resources were scheduled for execution. If you're using poise-python, that would mean a test like:

    it { is_expected.to install_python_package('foo') }