mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@875a09e
This commit is contained in:
parent
a06301b103
commit
5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions
|
@ -31,24 +31,24 @@ describe "Integer#round" do
|
|||
|
||||
platform_is_not wordsize: 32 do
|
||||
it "raises a RangeError when passed a big negative value" do
|
||||
lambda { 42.round(fixnum_min) }.should raise_error(RangeError)
|
||||
-> { 42.round(fixnum_min) }.should raise_error(RangeError)
|
||||
end
|
||||
end
|
||||
|
||||
it "raises a RangeError when passed Float::INFINITY" do
|
||||
lambda { 42.round(Float::INFINITY) }.should raise_error(RangeError)
|
||||
-> { 42.round(Float::INFINITY) }.should raise_error(RangeError)
|
||||
end
|
||||
|
||||
it "raises a RangeError when passed a beyond signed int" do
|
||||
lambda { 42.round(1<<31) }.should raise_error(RangeError)
|
||||
-> { 42.round(1<<31) }.should raise_error(RangeError)
|
||||
end
|
||||
|
||||
it "raises a TypeError when passed a String" do
|
||||
lambda { 42.round("4") }.should raise_error(TypeError)
|
||||
-> { 42.round("4") }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it "raises a TypeError when its argument cannot be converted to an Integer" do
|
||||
lambda { 42.round(nil) }.should raise_error(TypeError)
|
||||
-> { 42.round(nil) }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it "calls #to_int on the argument to convert it to an Integer" do
|
||||
|
@ -60,7 +60,7 @@ describe "Integer#round" do
|
|||
it "raises a TypeError when #to_int does not return an Integer" do
|
||||
obj = mock("Object")
|
||||
obj.stub!(:to_int).and_return([])
|
||||
lambda { 42.round(obj) }.should raise_error(TypeError)
|
||||
-> { 42.round(obj) }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it "returns different rounded values depending on the half option" do
|
||||
|
@ -95,7 +95,7 @@ describe "Integer#round" do
|
|||
end
|
||||
|
||||
it "raises ArgumentError for an unknown rounding mode" do
|
||||
lambda { 42.round(-1, half: :foo) }.should raise_error(ArgumentError, /invalid rounding mode: foo/)
|
||||
lambda { 42.round(1, half: :foo) }.should raise_error(ArgumentError, /invalid rounding mode: foo/)
|
||||
-> { 42.round(-1, half: :foo) }.should raise_error(ArgumentError, /invalid rounding mode: foo/)
|
||||
-> { 42.round(1, half: :foo) }.should raise_error(ArgumentError, /invalid rounding mode: foo/)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue