Skip to content

Instantly share code, notes, and snippets.

View martinb3's full-sized avatar

Martin Smith martinb3

View GitHub Profile
@bytheway
bytheway / hwrp_and_chefspec.rb
Last active January 4, 2016 20:09
Using more of the build-in goodness chefspec provides to simplify things even further. We can run expectations against the chef runner directly.
# I wanted to find a way to unit test a "Heavy-Weight" provider, but all the examples I found ended up stubbing out
# the chef world to make sure we could verify functionality as well as prevent the provider from converging on the
# development machine.
#
# I started thinking that chefspec already isolates things, and provides a great suite of matchers that we can
# use to check on the creation of chef resources inside our heavy provider. This is one approach that allows
# testing a single provider method, without a full chef run, in "isolation," with the helpful chefspec matchers.
# In my spec_helper