if @struct.last.is_a?(Array)
@struct.last << ret
else
- @struct.last[sym] = ret
+ if @struct.last.has_key?(sym) && @struct.last[sym].is_a?(Hash)
+ @struct.last[sym].merge! ret
+ else
+ @struct.last[sym] = ret
+ end
end
end
end
b.birth :city => 'London', :country => 'UK'
end
end
+
+ assert_json_output({'person' => {'id' => 1, 'name' => 'Ryan', 'birth' => {'city' => 'London', 'country' => 'UK'}}}) do |b|
+ b.person :id => 1 do
+ b.name 'Ryan'
+ b.birth :city => 'London', :country => 'UK'
+ end
+ end
end
def test_array