2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../../shared/rational/comparison'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
|
|
|
describe "Rational#<=> when passed a Rational object" do
|
2018-01-29 11:08:16 -05:00
|
|
|
it_behaves_like :rational_cmp_rat, :<=>
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "Rational#<=> when passed a Integer object" do
|
2018-01-29 11:08:16 -05:00
|
|
|
it_behaves_like :rational_cmp_int, :<=>
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "Rational#<=> when passed a Float object" do
|
2018-01-29 11:08:16 -05:00
|
|
|
it_behaves_like :rational_cmp_float, :<=>
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "Rational#<=> when passed an Object that responds to #coerce" do
|
2018-01-29 11:08:16 -05:00
|
|
|
it_behaves_like :rational_cmp_coerce, :<=>
|
|
|
|
it_behaves_like :rational_cmp_coerce_exception, :<=>
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "Rational#<=> when passed a non-Numeric Object that doesn't respond to #coerce" do
|
2018-01-29 11:08:16 -05:00
|
|
|
it_behaves_like :rational_cmp_other, :<=>
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|