summaryrefslogtreecommitdiff
path: root/spec/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-12-10 09:22:09 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2025-12-10 09:22:09 +0900
commitf9eb0d8da2cb570c6cf7754e4078ed0de266a52c (patch)
tree27e8ee2f47f1bcd6626321e9a3b179c66d3a1f88 /spec/ruby
parent264c469bc2cd6a9320cb1545d83ebda69e421f49 (diff)
Use `ruby_version_is`
As the markers for spec/mspec/tool/remove_old_guards.rb.
Diffstat (limited to 'spec/ruby')
-rw-r--r--spec/ruby/core/exception/frozen_error_spec.rb2
-rw-r--r--spec/ruby/language/def_spec.rb6
2 files changed, 4 insertions, 4 deletions
diff --git a/spec/ruby/core/exception/frozen_error_spec.rb b/spec/ruby/core/exception/frozen_error_spec.rb
index 1cf35496d4..af2e925661 100644
--- a/spec/ruby/core/exception/frozen_error_spec.rb
+++ b/spec/ruby/core/exception/frozen_error_spec.rb
@@ -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
diff --git a/spec/ruby/language/def_spec.rb b/spec/ruby/language/def_spec.rb
index 5cc36d61f0..0cf1790791 100644
--- a/spec/ruby/language/def_spec.rb
+++ b/spec/ruby/language/def_spec.rb
@@ -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