Sha256: 091831a1e6d9851065c031593799c6a05f062002524eb7315fcd4df32c9d3057

Contents?: true

Size: 599 Bytes

Versions: 6

Compression:

Stored size: 599 Bytes

Contents

require File.expand_path(File.dirname(__FILE__)) + '/helper'

class TestBufferIO < Test::Unit::TestCase
  
  def test_write_in_mem_has_a_stringio
    io = Tracksperanto::BufferIO.new
    9000.times { io.write("a") }
    assert_kind_of StringIO, io.__getobj__
    assert_nothing_raised { io.close! }
  end
  
  def test_write_larger_than_max_swaps_tempfile
    io = Tracksperanto::BufferIO.new
    io.write("a" * 6_000_001)
    f = io.__getobj__
    assert_kind_of Tempfile, f
    f.rewind
    assert_equal 6_000_001, f.read.length
    flexmock(f).should_receive(:close!).once
    io.close!
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tracksperanto-2.2.4 test/test_buffer_io.rb
tracksperanto-2.2.2 test/test_buffer_io.rb
tracksperanto-2.2.0 test/test_buffer_io.rb
tracksperanto-2.1.1 test/test_buffer_io.rb
tracksperanto-2.1.0 test/test_buffer_io.rb
tracksperanto-2.0.2 test/test_buffer_io.rb