From 66a399d623c2c1ff0993b2472752285bb87701c9 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Mon, 3 Mar 2014 08:32:43 -0700 Subject: [PATCH] adjusted the 'do' action, so that it will replace $args within the body --- test/integration/yaml_suite/yaml_doc.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/test/integration/yaml_suite/yaml_doc.js b/test/integration/yaml_suite/yaml_doc.js index 7b8bcdad8..613abcb78 100644 --- a/test/integration/yaml_suite/yaml_doc.js +++ b/test/integration/yaml_suite/yaml_doc.js @@ -331,9 +331,32 @@ YamlDoc.prototype = { paramName = camelName; } - params[paramName] = (typeof val === 'string' && val[0] === '$') ? this.get(val) : val; + // for ercursively traversing the params to replace '$stashed' vars + var transformObject = function (vals, val, i) { + switch (typeof val) { + case 'string': + val = (val[0] === '$') ? this.get(val) : val; + break; + case 'object': + val = _.transform(val, transformObject); + } + vals[i] = val; + }.bind(this); + + // start with the initial param, only traverse traversables + switch (typeof val) { + case 'string': + val = (val[0] === '$') ? this.get(val) : val; + break; + case 'object': + val = _.transform(val, transformObject); + break; + } + + params[paramName] = val; }, {}, this); + expect(clientAction || clientActionName).to.be.a('function'); if (typeof clientAction === 'function') {