@@ -629,8 +629,8 @@ def test_projection_preserve_array_indexes
629629
630630 def test_insert_get_projection_18_fields
631631 doc_id = uniq_id ( :project_too_many_fields )
632- doc = ( 1 ..18 ) . each_with_object ( { } ) do |n , obj |
633- obj [ "field#{ n } " ] = n
632+ doc = ( 1 ..18 ) . to_h do |n |
633+ [ "field#{ n } " , n ]
634634 end
635635
636636 res = @collection . insert ( doc_id , doc )
@@ -640,17 +640,17 @@ def test_insert_get_projection_18_fields
640640 options = Options ::Get . new
641641 options . project ( ( 1 ..17 ) . map { |n | "field#{ n } " } )
642642 res = @collection . get ( doc_id , options )
643- expected = ( 1 ..17 ) . each_with_object ( { } ) do |n , obj |
644- obj [ "field#{ n } " ] = n
643+ expected = ( 1 ..17 ) . to_h do |n |
644+ [ "field#{ n } " , n ]
645645 end
646646
647647 assert_equal ( expected , res . content , "expected result do not include field18" )
648648 end
649649
650650 def test_upsert_get_projection_16_fields_and_expiry
651651 doc_id = uniq_id ( :project_too_many_fields )
652- doc = ( 1 ..18 ) . each_with_object ( { } ) do |n , obj |
653- obj [ "field#{ n } " ] = n
652+ doc = ( 1 ..18 ) . to_h do |n |
653+ [ "field#{ n } " , n ]
654654 end
655655
656656 options = Options ::Upsert . new
@@ -663,8 +663,8 @@ def test_upsert_get_projection_16_fields_and_expiry
663663 options . project ( ( 1 ..16 ) . map { |n | "field#{ n } " } )
664664 options . with_expiry = true
665665 res = @collection . get ( doc_id , options )
666- expected = ( 1 ..16 ) . each_with_object ( { } ) do |n , obj |
667- obj [ "field#{ n } " ] = n
666+ expected = ( 1 ..16 ) . to_h do |n |
667+ [ "field#{ n } " , n ]
668668 end
669669
670670 assert_equal ( expected , res . content , "expected result do not include field17, field18" )
0 commit comments