summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/shared/each_line.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/shared/each_line.rb')
-rw-r--r--spec/ruby/core/string/shared/each_line.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/ruby/core/string/shared/each_line.rb b/spec/ruby/core/string/shared/each_line.rb
index 156565ff13..f9c910596a 100644
--- a/spec/ruby/core/string/shared/each_line.rb
+++ b/spec/ruby/core/string/shared/each_line.rb
@@ -93,10 +93,20 @@ describe :string_each_line, shared: true do
end
end
- it "yields subclass instances for subclasses" do
- a = []
- StringSpecs::MyString.new("hello\nworld").send(@method) { |s| a << s.class }
- a.should == [StringSpecs::MyString, StringSpecs::MyString]
+ ruby_version_is ''...'3.0' do
+ it "yields subclass instances for subclasses" do
+ a = []
+ StringSpecs::MyString.new("hello\nworld").send(@method) { |s| a << s.class }
+ a.should == [StringSpecs::MyString, StringSpecs::MyString]
+ end
+ end
+
+ ruby_version_is '3.0' do
+ it "yields String instances for subclasses" do
+ a = []
+ StringSpecs::MyString.new("hello\nworld").send(@method) { |s| a << s.class }
+ a.should == [String, String]
+ end
end
it "returns self" do