summaryrefslogtreecommitdiff
path: root/spec/ruby/core/kernel/shared/sprintf.rb
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2026-02-05 20:38:00 +0100
committerBenoit Daloze <eregontp@gmail.com>2026-02-07 10:06:36 +0100
commitd066b9e01ccb2260fac8b2580c10e73335c7c7db (patch)
treeece08ae6b0309149e09a640a3b41537a6485ee13 /spec/ruby/core/kernel/shared/sprintf.rb
parent96d00640978d78ede1f5b2b63e422cfd1e849891 (diff)
Refactor type error to be more consistent
[Bug #21864] Co-Authored-By: Benoit Daloze <eregontp@gmail.com>
Diffstat (limited to 'spec/ruby/core/kernel/shared/sprintf.rb')
-rw-r--r--spec/ruby/core/kernel/shared/sprintf.rb8
1 files changed, 4 insertions, 4 deletions
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