Sha256: 263d4e22403e90a7e69b1fc679fbbea504e6c73f75bc67be84553c4e6773068a
Contents?: true
Size: 660 Bytes
Versions: 4
Compression:
Stored size: 660 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Minitest # This cop enforces the test to use `assert_in_delta` # instead of using `assert_equal` to compare floats. # # @example # # 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') # class AssertInDelta < Cop include InDeltaMixin def_node_matcher :equal_floats_call, <<~PATTERN (send nil? :assert_equal $_ $_ $...) PATTERN end end end end
Version data entries
4 entries across 4 versions & 1 rubygems