diff options
Diffstat (limited to 'spec/ruby/core/integer/round_spec.rb')
-rw-r--r-- | spec/ruby/core/integer/round_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/core/integer/round_spec.rb b/spec/ruby/core/integer/round_spec.rb index 622a55280e..a45a7b5fb3 100644 --- a/spec/ruby/core/integer/round_spec.rb +++ b/spec/ruby/core/integer/round_spec.rb @@ -67,12 +67,15 @@ describe "Integer#round" do 25.round(-1, half: :up).should eql(30) 25.round(-1, half: :down).should eql(20) 25.round(-1, half: :even).should eql(20) + 25.round(-1, half: nil).should eql(30) 35.round(-1, half: :up).should eql(40) 35.round(-1, half: :down).should eql(30) 35.round(-1, half: :even).should eql(40) + 35.round(-1, half: nil).should eql(40) (-25).round(-1, half: :up).should eql(-30) (-25).round(-1, half: :down).should eql(-20) (-25).round(-1, half: :even).should eql(-20) + (-25).round(-1, half: nil).should eql(-30) end ruby_version_is "2.4"..."2.5" do @@ -90,4 +93,9 @@ describe "Integer#round" do 35.round(1, half: :even).should eql(35) end 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/) + end end |