A particular testset for this exercise is causing me some trouble, namely test 13 “Ordering”. It runs over numerator/denominator pairs ranging from -5 to 5 allowing the denominator to become zero, and apparently expects this to be well-defined.
The Instructions for this Exercise clearly specify the denominator to be != 0 (as it should be, mathematicaly speaking).
Edit: At first I thought there was no way to pass this test. Since implementing the constructor for RationalNumber, say a//b, to throw an ArgumentError for b==0 doesn’t work, disallowing only the case a==b==0, does not help either (fails different cases of the same test), and of course making no restriction doesn’t work either and als fails test 2 “Rational(0,0)”.
It turns out there is a way to pass: By implementing the ording rules for infinite ‘rationals’, including infinity and negative infinity.
What I think is a bit problematic is that the instuctions don’t specify this.
The Note in the instructions mentions that implementations exist in which the denominator is allowed to be zero. Perhaps it could be reformulated to make clearer that this might be exactly what you are expected to implement.
Futher, I would suggest splitting the testcase “Ordering”, by excluding the denominator zero cases and introducing a new test “Ordering Inf” to cover theses cases specifically.