Sha256: 9cf6ffc13d255250cc9420e31830bb7f68674a2f901db33de0cbbc7415d9bea4

Contents?: true

Size: 416 Bytes

Versions: 2

Compression:

Stored size: 416 Bytes

Contents

module Spec
  module Expectations
    module NumericExpectations
      # Passes if receiver is less than +-delta away from other
      def should_be_close(other, delta)
        should.be._close_for_rspec(other, delta)
      end

      private
      def _close_for_rspec?(other, delta)
        (self - other).abs < delta
      end
    end
  end
end

class Numeric
  include Spec::Expectations::NumericExpectations
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-0.7.5.1 lib/spec/expectations/extensions/numeric.rb
rspec-0.7.5 lib/spec/expectations/extensions/numeric.rb