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:
parent
5249826cb7
commit
83f3ab468d
@ -103,7 +103,9 @@ module Webrat
|
|||||||
@element["action"].blank? ? @session.current_url : @element["action"]
|
@element["action"].blank? ? @session.current_url : @element["action"]
|
||||||
end
|
end
|
||||||
|
|
||||||
HASH = [Hash, HashWithIndifferentAccess] rescue [Hash]
|
HASH = [Hash]
|
||||||
|
HASH << HashWithIndifferentAccess rescue nil # Rails
|
||||||
|
HASH << Mash rescue nil # Merb
|
||||||
|
|
||||||
def merge(all_params, new_param)
|
def merge(all_params, new_param)
|
||||||
new_param.each do |key, value|
|
new_param.each do |key, value|
|
||||||
@ -122,7 +124,7 @@ module Webrat
|
|||||||
a.keys.each do |k|
|
a.keys.each do |k|
|
||||||
if b.has_key?(k)
|
if b.has_key?(k)
|
||||||
case [a[k], b[k]].map{|value| value.class}
|
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])
|
a[k] = merge_hash_values(a[k], b[k])
|
||||||
b.delete(k)
|
b.delete(k)
|
||||||
when [Array, Array]
|
when [Array, Array]
|
||||||
|
Loading…
Reference in New Issue
Block a user