summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/to_s_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/to_s_spec.rb')
-rw-r--r--spec/ruby/core/string/to_s_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/ruby/core/string/to_s_spec.rb b/spec/ruby/core/string/to_s_spec.rb
new file mode 100644
index 0000000000..c48c7f89ac
--- /dev/null
+++ b/spec/ruby/core/string/to_s_spec.rb
@@ -0,0 +1,16 @@
+require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
+
+describe "String#to_s" do
+ 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