pact-foundation / pact-support

Shared code for Pact gems
MIT License
7 stars 47 forks source link

fix: add blank lines to empty hashs - json 2.8.x regression #111

Closed YOU54F closed 5 days ago

YOU54F commented 6 days ago

json 2.8.0+ no longer prints empty hashs over new lines, so we now get this output

Diff
--------------------------------------
Key: - is expected 
     + is actual 
Matching keys and values are not shown

 {
-  "thing": {
-    "alligator": {
-      "name": "Mary"
-    }
-  }
+  "thing": {}
 }

Description of differences
--------------------------------------

compared to the expected

Diff
--------------------------------------
Key: - is expected 
     + is actual 
Matching keys and values are not shown

 {
   "thing": {
-    "alligator": {
-      "name": "Mary"
-    }
   }
 }

Description of differences
--------------------------------------

      generates the right number of lines, even with ActiveSupport loaded

Finished in 0.00154 seconds (files took 0.42989 seconds to load)
1 example, 0 failures

Interestingly it only fails on Ruby 3.x+ with json 2.8.x gem, which is pulled in by the faraday change when pinned here as part of 2.12.0 release

YOU54F commented 6 days ago

Raised issue over at ruby json repo

https://github.com/ruby/json/issues/714