lib/pork/expect.rb in pork-1.4.0 vs lib/pork/expect.rb in pork-1.4.1
- old
+ new
@@ -38,9 +38,13 @@
def lt rhs; self < rhs; end
def gt rhs; self > rhs; end
def lte rhs; self <= rhs; end
def gte rhs; self >= rhs; end
+ def approx rhs, precision=10
+ round(precision) == rhs.round(precision)
+ end
+
def raise exception=::RuntimeError
satisfy("#{__not__}raising #{exception}") do
begin
if ::Kernel.block_given? then yield else @object.call end
rescue exception => e