summaryrefslogtreecommitdiff
path: root/spec/ruby/shared/rational/abs.rb
blob: 8beb20da7e3f892e63b62b0f92fc4e245b575526 (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