From d066b9e01ccb2260fac8b2580c10e73335c7c7db Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Thu, 5 Feb 2026 20:38:00 +0100 Subject: Refactor type error to be more consistent [Bug #21864] Co-Authored-By: Benoit Daloze --- spec/ruby/core/kernel/shared/sprintf.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'spec/ruby/core/kernel/shared') diff --git a/spec/ruby/core/kernel/shared/sprintf.rb b/spec/ruby/core/kernel/shared/sprintf.rb index 2b2c6c9b63..5ffe118035 100644 --- a/spec/ruby/core/kernel/shared/sprintf.rb +++ b/spec/ruby/core/kernel/shared/sprintf.rb @@ -306,13 +306,13 @@ describe :kernel_sprintf, shared: true do it "raises TypeError if argument is not String or Integer and cannot be converted to them" do -> { @method.call("%c", []) - }.should raise_error(TypeError, /no implicit conversion of Array into Integer/) + }.should raise_consistent_error(TypeError, /no implicit conversion of Array into Integer/) end it "raises TypeError if argument is nil" do -> { @method.call("%c", nil) - }.should raise_error(TypeError, /no implicit conversion from nil to integer/) + }.should raise_consistent_error(TypeError, /no implicit conversion of nil into Integer/) end it "tries to convert argument to String with to_str" do @@ -341,7 +341,7 @@ describe :kernel_sprintf, shared: true do -> { @method.call("%c", obj) - }.should raise_error(TypeError, /can't convert BasicObject to String/) + }.should raise_consistent_error(TypeError, /can't convert BasicObject into String/) end it "raises TypeError if converting to Integer with to_int returns non-Integer" do @@ -352,7 +352,7 @@ describe :kernel_sprintf, shared: true do -> { @method.call("%c", obj) - }.should raise_error(TypeError, /can't convert BasicObject to Integer/) + }.should raise_consistent_error(TypeError, /can't convert BasicObject into Integer/) end end -- cgit v1.2.3