Skip to content

Commit d225569

Browse files
committed
test: compare coordinates at the configured precision
assert_equal_coordinates used DEFAULT_GEOJSON_PRECISION; use RedmineGtt.geojson_precision so the comparison follows the live setting and stays correct if a test changes it.
1 parent ea20df3 commit d225569

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

test/test_helper.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@ def assert_geojson(json)
4444
end
4545

4646
def assert_equal_coordinates(a, b)
47-
# Compare at the precision GeoJSON output is rounded to. Comparing at a
48-
# lower precision than the output uses would double-round boundary values
49-
# (e.g. 135.2528349 -> round(6) 135.252835 -> round(5) 135.25284, while a
50-
# direct round(5) gives 135.25283).
51-
precision = RedmineGtt::DEFAULT_GEOJSON_PRECISION
47+
# Compare at the precision GeoJSON output is actually rounded to (follows
48+
# the configured setting, so it stays correct if a test changes it).
49+
# Comparing at a lower precision than the output uses would double-round
50+
# boundary values (e.g. 135.2528349 -> round(6) 135.252835 -> round(5)
51+
# 135.25284, while a direct round(5) gives 135.25283).
52+
precision = RedmineGtt.geojson_precision
5253
assert_equal a.flatten.map{|f|f.round precision}, b.flatten.map{|f|f.round precision}
5354
end
5455

0 commit comments

Comments
 (0)