Sha256: ff969b0194d217a31b6af15b4758c831b40c132df6ecc5db6533cea66624925f

Contents?: true

Size: 667 Bytes

Versions: 3

Compression:

Stored size: 667 Bytes

Contents

require "spec_helper"

describe ParallelSplitTest::OutputRecorder do
  ['write', 'puts', 'print'].each do |method|
    it "records #{method}" do
      out = StringIO.new("")
      recorder = ParallelSplitTest::OutputRecorder.new(out)
      recorder.send(method, "XXX")

      # output got recorded
      recorder.recorded.strip.should == "XXX"
      out.read.should == ""

      # output was written to original
      out.rewind
      out.read.strip.should == "XXX"
    end
  end

  it "can puts without arguments" do
    out = StringIO.new("")
    recorder = ParallelSplitTest::OutputRecorder.new(out)
    recorder.puts
    recorder.recorded.should == "\n"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
parallel_split_test-0.3.0 spec/parallel_split_test/output_recorder_spec.rb
parallel_split_test-0.2.1 spec/parallel_split_test/output_recorder_spec.rb
parallel_split_test-0.2.0 spec/parallel_split_test/output_recorder_spec.rb