##// END OF EJS Templates
Fixes unhandled case in json builder....
Jean-Philippe Lang -
r4349:558a951ed64a
parent child
Show More
@@ -56,10 +56,14 module Redmine
56 if @struct.last.is_a?(Array)
56 if @struct.last.is_a?(Array)
57 @struct.last << ret
57 @struct.last << ret
58 else
58 else
59 if @struct.last.has_key?(sym) && @struct.last[sym].is_a?(Hash)
60 @struct.last[sym].merge! ret
61 else
59 @struct.last[sym] = ret
62 @struct.last[sym] = ret
60 end
63 end
61 end
64 end
62 end
65 end
66 end
63
67
64 def output
68 def output
65 raise "Need to implement #{self.class.name}#output"
69 raise "Need to implement #{self.class.name}#output"
@@ -35,6 +35,13 class Redmine::Views::Builders::JsonTest < HelperTestCase
35 b.birth :city => 'London', :country => 'UK'
35 b.birth :city => 'London', :country => 'UK'
36 end
36 end
37 end
37 end
38
39 assert_json_output({'person' => {'id' => 1, 'name' => 'Ryan', 'birth' => {'city' => 'London', 'country' => 'UK'}}}) do |b|
40 b.person :id => 1 do
41 b.name 'Ryan'
42 b.birth :city => 'London', :country => 'UK'
43 end
44 end
38 end
45 end
39
46
40 def test_array
47 def test_array
General Comments 0
You need to be logged in to leave comments. Login now