OxDEAD Unicornz

Have you ever seen so many?

Some Comments on Jakshi's Accessing Chef Attributes in Serverspec Tests Blog Post

Here is an awesome post pouring some light on using node attributes during ServerSpec tests, but I have one tiny addition. It’s useful to have node attributes supplied by Ohai, so I’d add this to the respective recipe:

1
2
3
4
5
6
7
8
9
10
--- a/test/fixtures/cookbooks/test-helper/recipes/default.rb 2014-12-19 16:55:02.636535159 -0800
+++ b/test/fixtures/cookbooks/test-helper/recipes/default.rb 2014-11-24 20:28:35.083708281 -0800
@@ -20,6 +20,7 @@
 
     attrs = {}
 
+    attrs = attrs.deep_merge(node.automatic_attrs) unless node.automatic_attrs.empty?
     attrs = attrs.deep_merge(node.default_attrs) unless node.default_attrs.empty?
     attrs = attrs.deep_merge(node.normal_attrs) unless node.normal_attrs.empty?
     attrs = attrs.deep_merge(node.override_attrs) unless node.override_attrs.empty?