aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/ruby/core/thread/shared/to_s.rb8
-rw-r--r--spec/ruby/core/thread/to_s_spec.rb4
2 files changed, 4 insertions, 8 deletions
diff --git a/spec/ruby/core/thread/shared/to_s.rb b/spec/ruby/core/thread/shared/to_s.rb
index 7bc7234c85..0c4e3c0b96 100644
--- a/spec/ruby/core/thread/shared/to_s.rb
+++ b/spec/ruby/core/thread/shared/to_s.rb
@@ -1,15 +1,9 @@
require_relative '../fixtures/classes'
describe :thread_to_s, shared: true do
- sep = " "
- ruby_version_is(''..."2.7"){ sep = '@' }
+ sep = ruby_version_is("2.7") ? " " : "@"
it "returns a description including file and line number" do
- ruby_version_is(''...'2.5') do
- # Thread#to_s is not same as Thread#inspect until Ruby 2.4.
- skip if @method == :to_s
- end
-
Thread.new { "hello" }.send(@method).should =~ /^#<Thread:([^ ]*?)#{sep}#{Regexp.escape __FILE__}:#{__LINE__ } \w+>$/
end
diff --git a/spec/ruby/core/thread/to_s_spec.rb b/spec/ruby/core/thread/to_s_spec.rb
index cb182a017f..942d2716cf 100644
--- a/spec/ruby/core/thread/to_s_spec.rb
+++ b/spec/ruby/core/thread/to_s_spec.rb
@@ -2,5 +2,7 @@ require_relative '../../spec_helper'
require_relative 'shared/to_s'
describe "Thread#to_s" do
- it_behaves_like :thread_to_s, :to_s
+ ruby_version_is "2.5" do
+ it_behaves_like :thread_to_s, :to_s
+ end
end