Skip to content

Files

Latest commit

 

History

History
23 lines (15 loc) · 433 Bytes

Minitest-AssertInDelta.md

File metadata and controls

23 lines (15 loc) · 433 Bytes

Pattern: Missing use of assert_in_delta

Issue: -

Description

Enforces the test to use assert_in_delta instead of using assert_equal to compare floats.

Examples

# bad
assert_equal(0.2, actual)
assert_equal(0.2, actual, 'message')

# good
assert_in_delta(0.2, actual)
assert_in_delta(0.2, actual, 0.001, 'message')

Further Reading