File tree Expand file tree Collapse file tree 1 file changed +18
-13
lines changed Expand file tree Collapse file tree 1 file changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -78,21 +78,26 @@ def ordered_call(call)
78
78
%w[ title verb path versions query request_data response_data code show_in_doc recorded ] . each do |k |
79
79
next unless call . has_key? ( k )
80
80
ordered_call [ k ] = case call [ k ]
81
- when ActiveSupport ::HashWithIndifferentAccess
82
- # UploadedFiles break the to_json call, turn them into a string so they don't break
83
- call [ k ] . each do |pkey , pval |
84
- if ( pval . is_a? ( Rack ::Test ::UploadedFile ) || pval . is_a? ( ActionDispatch ::Http ::UploadedFile ) )
85
- call [ k ] [ pkey ] = "<FILE CONTENT '#{ pval . original_filename } '>"
86
- end
87
- end
88
- JSON . parse ( call [ k ] . to_json ) # to_hash doesn't work recursively and I'm too lazy to write the recursion:)
89
- else
90
- call [ k ]
91
- end
92
- end
81
+ when ActiveSupport ::HashWithIndifferentAccess
82
+ convert_file_value ( call [ k ] ) . to_hash
83
+ else
84
+ call [ k ]
85
+ end
86
+ end
93
87
return ordered_call
94
88
end
95
89
90
+ def convert_file_value hash
91
+ hash . each do |k , v |
92
+ if ( v . is_a? ( Rack ::Test ::UploadedFile ) || v . is_a? ( ActionDispatch ::Http ::UploadedFile ) )
93
+ hash [ k ] = "<FILE CONTENT '#{ v . original_filename } '>"
94
+ elsif v . is_a? ( Hash )
95
+ hash [ k ] = convert_file_value ( v )
96
+ end
97
+ end
98
+ hash
99
+ end
100
+
96
101
def load_recorded_examples
97
102
self . class . load_recorded_examples
98
103
end
@@ -131,7 +136,7 @@ def deep_merge_examples(new_examples, old_examples)
131
136
new_example [ :title ] ||= old_example [ "title" ] if old_example [ "title" ] . present?
132
137
end
133
138
new_example
134
- end
139
+ end
135
140
end
136
141
137
142
def load_new_examples
You can’t perform that action at this time.
0 commit comments