Sha256: e7439184597df536a0deec8c9945cfa0241423e7fcfdd3ba6dfe146fa0f5d41c
Contents?: true
Size: 714 Bytes
Versions: 41
Compression:
Stored size: 714 Bytes
Contents
module Matchers class GenerallyEqual EPSILON = 0.0001 def initialize(expected) @expected = expected end def matches?(actual) @actual = actual if @actual.kind_of?(Float) || @expected.kind_of?(Float) (@expected - EPSILON .. @expected + EPSILON).include? @actual else @expected == @actual end end def failure_message_for_should "expected #{@actual.inspect} to be generally equal to #{@expected.inspect}" end def failure_message_for_should_not "expected #{@actual.inspect} not to be generally equal to #{@expected.inspect}" end end def be_generally_equal(expected) GenerallyEqual.new(expected) end end
Version data entries
41 entries across 41 versions & 2 rubygems