diff options
Diffstat (limited to 'spec/ruby/core/string/to_s_spec.rb')
| -rw-r--r-- | spec/ruby/core/string/to_s_spec.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/ruby/core/string/to_s_spec.rb b/spec/ruby/core/string/to_s_spec.rb index b483b1b138..c48c7f89ac 100644 --- a/spec/ruby/core/string/to_s_spec.rb +++ b/spec/ruby/core/string/to_s_spec.rb @@ -1,7 +1,16 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require File.expand_path('../fixtures/classes.rb', __FILE__) -require File.expand_path('../shared/to_s.rb', __FILE__) +require_relative '../../spec_helper' +require_relative 'fixtures/classes' describe "String#to_s" do - it_behaves_like(:string_to_s, :to_s) + it "returns self when self.class == String" do + a = "a string" + a.should.equal?(a.to_s) + end + + it "returns a new instance of String when called on a subclass" do + a = StringSpecs::MyString.new("a string") + s = a.to_s + s.should == "a string" + s.should.instance_of?(String) + end end |
