diff options
Diffstat (limited to 'spec/ruby/core/io/puts_spec.rb')
-rw-r--r-- | spec/ruby/core/io/puts_spec.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/spec/ruby/core/io/puts_spec.rb b/spec/ruby/core/io/puts_spec.rb index 8f2f4f2c81..51240eed73 100644 --- a/spec/ruby/core/io/puts_spec.rb +++ b/spec/ruby/core/io/puts_spec.rb @@ -43,18 +43,16 @@ describe "IO#puts" do object.should_receive(:method_missing).with(:to_ary) object.should_receive(:to_s).and_return("#<Object:0x...>") - @io.should_receive(:write).with("#<Object:0x...>") - @io.should_receive(:write).with("\n") @io.puts(object).should == nil + ScratchPad.recorded.should == "#<Object:0x...>\n" end it "calls :to_ary before writing non-string objects" do object = mock('hola') object.should_receive(:to_ary).and_return(["hola"]) - @io.should_receive(:write).with("hola") - @io.should_receive(:write).with("\n") @io.puts(object).should == nil + ScratchPad.recorded.should == "hola\n" end it "calls :to_s before writing non-string objects that don't respond to :to_ary" do @@ -69,9 +67,8 @@ describe "IO#puts" do object = mock('hola') object.should_receive(:to_s).and_return(false) - @io.should_receive(:write).with(object.inspect.split(" ")[0] + ">") - @io.should_receive(:write).with("\n") @io.puts(object).should == nil + ScratchPad.recorded.should == object.inspect.split(" ")[0] + ">\n" end it "writes each arg if given several" do |