summaryrefslogtreecommitdiff
path: root/spec/ruby/shared/rational/Rational.rb
diff options
context:
space:
mode:
authorBenoit Daloze <[email protected]>2023-02-27 21:02:44 +0100
committerBenoit Daloze <[email protected]>2023-02-27 21:02:44 +0100
commit18b4def471bb901d0baa4a1307185484cb05815f (patch)
tree779b24566144e9ee06c6f8de35bd2f7fd74ccdb4 /spec/ruby/shared/rational/Rational.rb
parentde60139053fa7c561858c5c5556d61c82f361dd9 (diff)
Update to ruby/spec@e7dc804
Diffstat (limited to 'spec/ruby/shared/rational/Rational.rb')
-rw-r--r--spec/ruby/shared/rational/Rational.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/ruby/shared/rational/Rational.rb b/spec/ruby/shared/rational/Rational.rb
index 2dc49c869c..a56d027c96 100644
--- a/spec/ruby/shared/rational/Rational.rb
+++ b/spec/ruby/shared/rational/Rational.rb
@@ -85,6 +85,11 @@ describe :kernel_Rational, shared: true do
end
end
+ it "raises a ZeroDivisionError if the second argument is 0" do
+ -> { Rational(1, 0) }.should raise_error(ZeroDivisionError, "divided by 0")
+ -> { Rational(1, 0.0) }.should raise_error(ZeroDivisionError, "divided by 0")
+ end
+
it "raises a TypeError if the first argument is nil" do
-> { Rational(nil) }.should raise_error(TypeError)
end