Browse files

Fix bug with optional arrays in the matcher

When a type parameter takes an array with a single value, the compiled version
only has the single value not as an array.
  • Loading branch information...
1 parent c49240e commit 2db185bf22beacbbc16de4422606f390c56a0089 @rodjek committed Aug 9, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/rspec-puppet/matchers/create_generic.rb
View
2 lib/rspec-puppet/matchers/create_generic.rb
@@ -51,7 +51,7 @@ def matches?(catalogue)
(@errors ||= []) << "#{name.to_s} matching `#{value.inspect}` but its value of `#{rsrc_hsh[name.to_sym].inspect}` does not"
end
elsif value.kind_of?(Array) then
- unless rsrc_hsh[name.to_sym].join == value.join
+ unless Array(rsrc_hsh[name.to_sym]).flatten.join == value.flatten.join
ret = false
(@errors ||= []) << "#{name.to_s} set to `#{value.inspect}` but it is set to `#{rsrc_hsh[name.to_sym].inspect}` in the catalogue"
end

0 comments on commit 2db185b

Please sign in to comment.