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/integer/try_convert_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/ruby/core/integer') diff --git a/spec/ruby/core/integer/try_convert_spec.rb b/spec/ruby/core/integer/try_convert_spec.rb index 8a0ca671a9..ba14a5aa7e 100644 --- a/spec/ruby/core/integer/try_convert_spec.rb +++ b/spec/ruby/core/integer/try_convert_spec.rb @@ -29,7 +29,7 @@ describe "Integer.try_convert" do obj.should_receive(:to_int).and_return(Object.new) -> { Integer.try_convert obj - }.should raise_error(TypeError, "can't convert MockObject to Integer (MockObject#to_int gives Object)") + }.should raise_consistent_error(TypeError, "can't convert MockObject into Integer (MockObject#to_int gives Object)") end it "responds with a different error message when it raises a TypeError, depending on the type of the non-Integer object :to_int returns" do @@ -37,7 +37,7 @@ describe "Integer.try_convert" do obj.should_receive(:to_int).and_return("A String") -> { Integer.try_convert obj - }.should raise_error(TypeError, "can't convert MockObject to Integer (MockObject#to_int gives String)") + }.should raise_consistent_error(TypeError, "can't convert MockObject into Integer (MockObject#to_int gives String)") end it "does not rescue exceptions raised by #to_int" do -- cgit v1.2.3