Skip to content

Commit 5521faa

Browse files
author
bmarkons
committed
Fix flaky test
1 parent 52470df commit 5521faa

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

test/models/benchmark_type_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class BenchmarkTypeTest < ActiveSupport::TestCase
3333
groups.first.benchmark_types << benchmark_types.first(3)
3434
groups.second.benchmark_types << benchmark_types.last(3)
3535

36-
assert_equal benchmark_types.first.comparison_benchmark_types.to_a, benchmark_types[1..2]
37-
assert_equal benchmark_types.third.comparison_benchmark_types.to_a, benchmark_types.first(2) + benchmark_types.last(2)
36+
assert_matched_arrays benchmark_types.first.comparison_benchmark_types, benchmark_types[1..2]
37+
assert_matched_arrays benchmark_types.third.comparison_benchmark_types, benchmark_types.first(2) + benchmark_types.last(2)
3838
end
3939
end

test/test_helper.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,13 @@ class ActiveSupport::TestCase
1414
end
1515

1616
Sidekiq::Testing.fake!
17+
18+
module MiniTest::Assertions
19+
def assert_matched_arrays(expected, actual)
20+
expected_array = expected.to_ary
21+
assert_kind_of Array, expected_array
22+
actual_array = actual.to_ary
23+
assert_kind_of Array, actual_array
24+
assert_equal expected_array.sort, actual_array.sort
25+
end
26+
end

0 commit comments

Comments
 (0)