Skip to content

Commit 0eb2bf1

Browse files
committed
Better comparison to get better output if it fails
1 parent 0f086e9 commit 0eb2bf1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/lib/rails_stats/json_formatter_test.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,12 @@
8888
calculator = RailsStats::StatsCalculator.new(root_directory)
8989
formatter = RailsStats::JSONFormatter.new(calculator)
9090

91-
assert_equal JSON.parse(JSON_STRING), formatter.result
91+
sorted_expectation = JSON.parse(JSON_STRING).sort {|x, y| x["name"] <=> y["name"] }
92+
sorted_result = formatter.result.sort {|x, y| x["name"] <=> y["name"] }
93+
94+
sorted_expectation.each_with_index do |x, i|
95+
assert_equal x, sorted_result[i]
96+
end
9297
end
9398
end
9499
end

0 commit comments

Comments
 (0)