[chef] Testing templates with mock node attributes


Chronological Thread 
  • From: Carlton Stedman < >
  • To:
  • Subject: [chef] Testing templates with mock node attributes
  • Date: Fri, 26 Apr 2013 14:32:08 -0400 (EDT)

Ohai, Chefs,

I have been trying to use a test-driven development method for baking Chef recipes and have been having good success with chefspec and minitest-chef-handler. However, one area that currently is difficult to test are templates.

I am looking for a way to get the output of erb templates, correctly substituting in node attributes (e.g. have a <%= node[:something] %> and want to get it to substitute correctly). So far, I haven't found a solution.

I was wondering if anyone has a solution to this?

Otherwise, I am considering working on one, perhaps using Fauxhai to mock for node attribute substitution.

Thanks a lot,
Carlton



Archive powered by MHonArc 2.6.16.

§