diff options
Diffstat (limited to 'spec/ruby/core/string/shared/strip.rb')
-rw-r--r-- | spec/ruby/core/string/shared/strip.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ruby/core/string/shared/strip.rb b/spec/ruby/core/string/shared/strip.rb new file mode 100644 index 0000000000..3af77b50fe --- /dev/null +++ b/spec/ruby/core/string/shared/strip.rb @@ -0,0 +1,14 @@ +require_relative '../../../spec_helper' +require_relative '../fixtures/classes' + +describe :string_strip, shared: true do + it "returns a String in the same encoding as self" do + " hello ".encode("US-ASCII").send(@method).encoding.should == Encoding::US_ASCII + 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 |