summaryrefslogtreecommitdiff
path: root/spec/ruby/core/numeric/quo_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/numeric/quo_spec.rb')
-rw-r--r--spec/ruby/core/numeric/quo_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/ruby/core/numeric/quo_spec.rb b/spec/ruby/core/numeric/quo_spec.rb
index 5c952b11a9..b4a23fd476 100644
--- a/spec/ruby/core/numeric/quo_spec.rb
+++ b/spec/ruby/core/numeric/quo_spec.rb
@@ -52,4 +52,13 @@ describe "Numeric#quo" do
obj.quo(19).should == 1.quo(20)
end
+
+ it "raises a ZeroDivisionError if the given argument is zero and not a Float" do
+ -> { 1.quo(0) }.should raise_error(ZeroDivisionError)
+ end
+
+ it "returns infinity if the given argument is zero and is a Float" do
+ (1.quo(0.0)).to_s.should == 'Infinity'
+ (-1.quo(0.0)).to_s.should == '-Infinity'
+ end
end