]> source.dussan.org Git - redmine.git/commitdiff
Merged r17643 to 3.3-stable (#20788).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 29 Nov 2018 15:41:34 +0000 (15:41 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 29 Nov 2018 15:41:34 +0000 (15:41 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@17651 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/views/builders/structure.rb
test/unit/lib/redmine/views/builders/json_test.rb

index 03f73c64969c18bac1e7238a66752980decebd61..420190fc95c6c19147e1a8a59a92e74365fd9c1f 100644 (file)
@@ -48,7 +48,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
index 0cb75c98b2bd229ed6a7bd16aa397eecd784398b..13381e3aa9b97cc3702e5430d6ddfefab18ba7e8 100644 (file)
 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|