diff --git a/core/kernel/Integer_spec.rb b/core/kernel/Integer_spec.rb index c37733e88..74dd3e0dd 100644 --- a/core/kernel/Integer_spec.rb +++ b/core/kernel/Integer_spec.rb @@ -586,6 +586,21 @@ Integer("777", obj).should == 0777 end + # https://bugs.ruby-lang.org/issues/19349 + ruby_version_is ''...'3.3' do + it "ignores the base if it is not an integer and does not respond to #to_i" do + Integer("777", "8").should == 777 + end + end + + ruby_version_is '3.3' do + it "raises a TypeError if it is not an integer and does not respond to #to_i" do + -> { + Integer("777", "8") + }.should raise_error(TypeError, "no implicit conversion of String into Integer") + end + end + describe "when passed exception: false" do describe "and valid argument" do it "returns an Integer number" do