Skip to content

Commit 13e8689

Browse files
committed
Minor updates to test runner
1 parent d7be3d5 commit 13e8689

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

elasticsearch-api/api-spec-testing/rspec_matchers.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174

175175
failure_message do |response|
176176
"the expected response pair/value(s) #{@mismatched_pairs}" +
177-
" does not match the pair/value(s) in the response #{response}"
177+
" does not match the pair/value(s) in the response #{response}"
178178
end
179179

180180
def sanitize_pairs(expected_pairs)
@@ -235,8 +235,14 @@ def compare_hash(expected_pairs, actual_hash, test)
235235
when Hash
236236
compare_hash(expected_value, actual_value, test)
237237
when Array
238-
unless compare_array(expected_value, actual_value, test, actual_hash)
239-
@mismatched_pairs.merge!(expected_key => expected_value)
238+
begin
239+
unless compare_array(expected_value.sort, actual_value.sort, test, actual_hash)
240+
@mismatched_pairs.merge!(expected_key => expected_value)
241+
end
242+
rescue TypeError, ArgumentError
243+
unless compare_array(expected_value, actual_value, test, actual_hash)
244+
@mismatched_pairs.merge!(expected_key => expected_value)
245+
end
240246
end
241247
when String
242248
unless compare_string(expected_value, actual_value, test, actual_hash)
@@ -283,6 +289,8 @@ def compare_array(expected, actual, test, response)
283289
return false unless compare_array(value, actual[i], test, response)
284290
when String
285291
return false unless compare_string(value, actual[i], test, response)
292+
else
293+
true
286294
end
287295
end
288296
end

0 commit comments

Comments
 (0)