Project

General

Profile

Defect #20788 ยป 20788-missing-jsonvalue-false.patch

Yuichi HARADA, 2018-11-21 03:30

View differences:

lib/redmine/views/builders/structure.rb
47 47
        end
48 48

  
49 49
        def method_missing(sym, *args, &block)
50
          if args.any?
50
          if args.count > 0
51 51
            if args.first.is_a?(Hash)
52 52
              if @struct.last.is_a?(Array)
53 53
                @struct.last << args.first unless block
test/unit/lib/redmine/views/builders/json_test.rb
18 18
require File.expand_path('../../../../../../test_helper', __FILE__)
19 19

  
20 20
class Redmine::Views::Builders::JsonTest < ActiveSupport::TestCase
21
  def test_nil_and_false
22
    assert_json_output({'value' => nil}) do |b|
23
      b.value nil
24
    end
25

  
26
    assert_json_output({'value' => false}) do |b|
27
      b.value false
28
    end
29
  end
21 30

  
22 31
  def test_hash
23 32
    assert_json_output({'person' => {'name' => 'Ryan', 'age' => 32}}) do |b|
    (1-1/1)