summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/shared/strip.rb
blob: 9c232b4694a1cce7b3f69909e6478b33a1056a13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'

describe :string_strip, shared: true do
  ruby_version_is '3.0' do
    it "returns String instances when called on a subclass" do
      StringSpecs::MyString.new(" hello ").send(@method).should be_an_instance_of(String)
      StringSpecs::MyString.new(" ").send(@method).should be_an_instance_of(String)
      StringSpecs::MyString.new("").send(@method).should be_an_instance_of(String)
    end
  end

  ruby_version_is ''...'3.0' do
    it "returns subclass instances when called on a subclass" do
      StringSpecs::MyString.new(" hello ").send(@method).should be_an_instance_of(StringSpecs::MyString)
      StringSpecs::MyString.new(" ").send(@method).should be_an_instance_of(StringSpecs::MyString)
      StringSpecs::MyString.new("").send(@method).should be_an_instance_of(StringSpecs::MyString)
    end
  end
end