class Hurley::CompositeReadIOTest

Public Instance Methods

test_read_all() click to toggle source
# File test/multipart_test.rb, line 222
def test_read_all
  io = CompositeReadIO.new StringIO.new("one"), StringIO.new("two")
  assert_equal "onetwo", io.read
end
test_read_chunks() click to toggle source
# File test/multipart_test.rb, line 227
def test_read_chunks
  io = CompositeReadIO.new StringIO.new("one"), StringIO.new("two")
  assert_equal "on", io.read(2)
  assert_equal "et", io.read(2)
  assert_equal "wo", io.read(2)
  assert_nil io.read(2)

  io.rewind

  assert_equal "on", io.read(2)
  assert_equal "et", io.read(2)
  assert_equal "wo", io.read(2)
  assert_nil io.read(2)

  io.rewind

  assert_equal "one", io.read(3)
  assert_equal "two", io.read(3)
  assert_nil io.read(3)
end