Use ruby_version_is

As the markers for spec/mspec/tool/remove_old_guards.rb.
This commit is contained in:
Nobuyoshi Nakada committed 2025-12-10 09:22:09 +09:00
1 parent 264c469bc2
commit f9eb0d8da2
2 files changed
+4 -4

No files matched your search

@@ -26,7 +26,7 @@ describe "FrozenError#message" do
object = Object.new
object.freeze
msg_class = RUBY_VERSION >= "4" ? "Object" : "object"
msg_class = ruby_version_is("4.0") ? "Object" : "object"
-> {
def object.x; end
+3 -3
View File
@@ -97,7 +97,7 @@ describe "An instance method" do
def foo; end
end
}.should raise_error(FrozenError) { |e|
msg_class = RUBY_VERSION >= "4" ? "Module" : "module"
msg_class = ruby_version_is("4.0") ? "Module" : "module"
e.message.should == "can't modify frozen #{msg_class}: #{e.receiver}"
}
@@ -107,7 +107,7 @@ describe "An instance method" do
def foo; end
end
}.should raise_error(FrozenError){ |e|
msg_class = RUBY_VERSION >= "4" ? "Class" : "class"
msg_class = ruby_version_is("4.0") ? "Class" : "class"
e.message.should == "can't modify frozen #{msg_class}: #{e.receiver}"
}
end
@@ -285,7 +285,7 @@ describe "A singleton method definition" do
it "raises FrozenError with the correct class name" do
obj = Object.new
obj.freeze
msg_class = RUBY_VERSION >= "4" ? "Object" : "object"
msg_class = ruby_version_is("4.0") ? "Object" : "object"
-> { def obj.foo; end }.should raise_error(FrozenError, "can't modify frozen #{msg_class}: #{obj}")
obj = Object.new