diff options
Diffstat (limited to 'spec/ruby/core/string/shared/strip.rb')
-rw-r--r-- | spec/ruby/core/string/shared/strip.rb | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/spec/ruby/core/string/shared/strip.rb b/spec/ruby/core/string/shared/strip.rb index 9c232b4694..3af77b50fe 100644 --- a/spec/ruby/core/string/shared/strip.rb +++ b/spec/ruby/core/string/shared/strip.rb @@ -2,19 +2,13 @@ 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 + it "returns a String in the same encoding as self" do + " hello ".encode("US-ASCII").send(@method).encoding.should == Encoding::US_ASCII 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 + 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 |