Sha256: 070d997af7fc6df8b54dd7be89a307f3e805380e4366f4fc4eedd949002235c2
Contents?: true
Size: 580 Bytes
Versions: 15
Compression:
Stored size: 580 Bytes
Contents
class InfinityMatcher def initialize(expected_sign) @expected_sign = expected_sign end def matches?(actual) @actual = actual @actual.kind_of?(Float) && @actual.infinite? == @expected_sign end def failure_message ["Expected #{@actual}", "to be #{"-" if @expected_sign == -1}Infinity"] end def negative_failure_message ["Expected #{@actual}", "not to be #{"-" if @expected_sign == -1}Infinity"] end end class Object def be_positive_infinity InfinityMatcher.new(1) end def be_negative_infinity InfinityMatcher.new(-1) end end
Version data entries
15 entries across 15 versions & 2 rubygems