Fix parameters that take hash or array of hashes

The method used to cast scalars to arrays is `Array()`. This also will
cast `nil` to an empty array, and preserve array depth for existing
arrays.

Casting hashes to arrays with `Array()` produces strange results and so
the more verbose form of `[hsh].flatten.compact` must be used when a
parameter may be one or more hashes. This updates the tests and
templates accordingly.