summaryrefslogtreecommitdiff
path: root/spec/ruby/shared/rational/abs.rb
blob: aa1bdc436334582f327dc54e8bde6a31b514655f (plain)
1
2
3
4
5
6
7
8
9
10
11
require File.expand_path('../../../spec_helper', __FILE__)

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