diff options
Diffstat (limited to 'spec/ruby/shared/rational/to_s.rb')
-rw-r--r-- | spec/ruby/shared/rational/to_s.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/spec/ruby/shared/rational/to_s.rb b/spec/ruby/shared/rational/to_s.rb index b16594f10c..e90c6e5e39 100644 --- a/spec/ruby/shared/rational/to_s.rb +++ b/spec/ruby/shared/rational/to_s.rb @@ -2,8 +2,11 @@ require_relative '../../spec_helper' describe :rational_to_s, shared: true do it "returns a string representation of self" do - Rational(1, 1).to_s.should == "1/1" - Rational(2, 1).to_s.should == "2/1" + # Guard against the Mathn library + guard -> { !defined?(Math.rsqrt) } do + Rational(1, 1).to_s.should == "1/1" + Rational(2, 1).to_s.should == "2/1" + end Rational(1, 2).to_s.should == "1/2" Rational(-1, 3).to_s.should == "-1/3" Rational(1, -3).to_s.should == "-1/3" |