1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Move spec/rubyspec to spec/ruby for consistency

* Other ruby implementations use the spec/ruby directory.
  [Misc #13792] [ruby-core:82287]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2017-09-20 20:18:52 +00:00
parent 75bfc6440d
commit 1d15d5f080
4370 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,35 @@
require File.expand_path('../../../spec_helper', __FILE__)
describe "Fixnum#/" do
it "returns self divided by the given argument" do
(2 / 2).should == 1
(3 / 2).should == 1
end
it "supports dividing negative numbers" do
(-1 / 10).should == -1
end
it "raises a ZeroDivisionError if the given argument is zero and not a Float" do
lambda { 1 / 0 }.should raise_error(ZeroDivisionError)
end
it "does NOT raise ZeroDivisionError if the given argument is zero and is a Float" do
(1 / 0.0).to_s.should == 'Infinity'
(-1 / 0.0).to_s.should == '-Infinity'
end
it "coerces fixnum and return self divided by other" do
(-1 / 50.4).should be_close(-0.0198412698412698, TOLERANCE)
(1 / bignum_value).should == 0
end
it "raises a TypeError when given a non-Integer" do
lambda {
(obj = mock('10')).should_receive(:to_int).any_number_of_times.and_return(10)
13 / obj
}.should raise_error(TypeError)
lambda { 13 / "10" }.should raise_error(TypeError)
lambda { 13 / :symbol }.should raise_error(TypeError)
end
end