1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-04 14:49:41 +00:00

REST API with JSON content missing false values (#20788).

Patch by Yuichi HARADA.

git-svn-id: http://svn.redmine.org/redmine/trunk@17643 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2018-11-28 18:03:07 +00:00
parent 12fbad088c
commit f130bf9e2b
2 changed files with 10 additions and 1 deletions

View File

@ -47,7 +47,7 @@ module Redmine
end
def method_missing(sym, *args, &block)
if args.any?
if args.count > 0
if args.first.is_a?(Hash)
if @struct.last.is_a?(Array)
@struct.last << args.first unless block

View File

@ -18,6 +18,15 @@
require File.expand_path('../../../../../../test_helper', __FILE__)
class Redmine::Views::Builders::JsonTest < ActiveSupport::TestCase
def test_nil_and_false
assert_json_output({'value' => nil}) do |b|
b.value nil
end
assert_json_output({'value' => false}) do |b|
b.value false
end
end
def test_hash
assert_json_output({'person' => {'name' => 'Ryan', 'age' => 32}}) do |b|