We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 860b6de + f8cb384 commit f54a97cCopy full SHA for f54a97c
lib/pact/shared/active_support_support.rb
@@ -42,10 +42,11 @@ def fix_regexp regexp
42
# Oh ActiveSupport, why....
43
def fix_json_formatting json
44
if json =~ /\{".*?":"/
45
- JSON.pretty_generate(JSON.parse(json, create_additions: false))
+ json = JSON.pretty_generate(JSON.parse(json, create_additions: false))
46
else
47
json
48
end
49
+ fix_empty_hash_and_array json
50
51
52
def remove_unicode json
@@ -61,5 +62,13 @@ def warn_about_regexp(thing)
61
62
63
64
65
+
66
+ private
67
68
+ def fix_empty_hash_and_array json
69
+ json = json.gsub(/({\s*})/, "{\n }")
70
+ json.gsub(/\[\s*\]/, "[\n ]")
71
+ json
72
+ end
73
74
0 commit comments