diff options
Diffstat (limited to 'spec/ruby/library/stringio/puts_spec.rb')
-rw-r--r-- | spec/ruby/library/stringio/puts_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/library/stringio/puts_spec.rb b/spec/ruby/library/stringio/puts_spec.rb index 396d9f25f4..152bfb13f8 100644 --- a/spec/ruby/library/stringio/puts_spec.rb +++ b/spec/ruby/library/stringio/puts_spec.rb @@ -51,6 +51,14 @@ describe "StringIO#puts when passed an Array" do @io.puts([obj]) @io.string.should == "to_s\n" end + + it "returns general object info if :to_s does not return a string" do + object = mock('hola') + object.should_receive(:to_s).and_return(false) + + @io.puts(object).should == nil + @io.string.should == object.inspect.split(" ")[0] + ">\n" + end end describe "StringIO#puts when passed 1 or more objects" do |