summaryrefslogtreecommitdiff
path: root/spec/ruby/core/rational/shared/abs.rb
blob: 3d64bcc1a0e94f611f345002b6db18fe3f60bea7 (plain)
1
2
3
4
5
6
7
8
9
10
11
require_relative '../../../spec_helper'

describe :rational_abs, shared: true do
  it "returns self's absolute value" do
    Rational(3, 4).send(@method).should == Rational(3, 4)
    Rational(-3, 4).send(@method).should == Rational(3, 4)
    Rational(3, -4).send(@method).should == Rational(3, 4)

    Rational(bignum_value, -bignum_value).send(@method).should == Rational(bignum_value, bignum_value)
  end
end