fixed bug where webrat would lose complex parameters (like foo[bar[baz]][]) in merb due to not correctly merging Mashes.

This commit is contained in:
Drew Colthorp 2008-11-13 08:56:24 -06:00 committed by Bryan Helmkamp
parent 5249826cb7
commit 83f3ab468d
1 changed files with 4 additions and 2 deletions

View File

@ -103,7 +103,9 @@ module Webrat
@element["action"].blank? ? @session.current_url : @element["action"]
end
HASH = [Hash, HashWithIndifferentAccess] rescue [Hash]
HASH = [Hash]
HASH << HashWithIndifferentAccess rescue nil # Rails
HASH << Mash rescue nil # Merb
def merge(all_params, new_param)
new_param.each do |key, value|
@ -122,7 +124,7 @@ module Webrat
a.keys.each do |k|
if b.has_key?(k)
case [a[k], b[k]].map{|value| value.class}
when [Hash, Hash]
when *HASH.zip(HASH)
a[k] = merge_hash_values(a[k], b[k])
b.delete(k)
when [Array, Array]