class Hurley::UploadIOTest

Public Instance Methods

test_with_file_io_and_custom_filename() click to toggle source
# File test/multipart_test.rb, line 277
def test_with_file_io_and_custom_filename
  io = UploadIO.new(File.new(__FILE__), "text/plain", "wat.rb")
  assert_equal "text/plain", io.content_type
  assert_equal "wat.rb", io.original_filename
  assert_equal __FILE__, io.local_path
  assert_empty io.opts
  assert_equal IO.read(__FILE__), io.read
end
test_with_file_io_and_no_custom_filename() click to toggle source
# File test/multipart_test.rb, line 268
def test_with_file_io_and_no_custom_filename
  io = UploadIO.new(File.new(__FILE__), "text/plain")
  assert_equal "text/plain", io.content_type
  assert_equal "multipart_test.rb", io.original_filename
  assert_equal __FILE__, io.local_path
  assert_empty io.opts
  assert_equal IO.read(__FILE__), io.read
end
test_with_filename_and_custom_filename() click to toggle source
# File test/multipart_test.rb, line 259
def test_with_filename_and_custom_filename
  io = UploadIO.new(__FILE__, "text/plain", "wat.rb")
  assert_equal "text/plain", io.content_type
  assert_equal "wat.rb", io.original_filename
  assert_equal __FILE__, io.local_path
  assert_empty io.opts
  assert_equal IO.read(__FILE__), io.read
end
test_with_filename_and_no_custom_filename() click to toggle source
# File test/multipart_test.rb, line 250
def test_with_filename_and_no_custom_filename
  io = UploadIO.new(__FILE__, "text/plain")
  assert_equal "text/plain", io.content_type
  assert_equal "multipart_test.rb", io.original_filename
  assert_equal __FILE__, io.local_path
  assert_empty io.opts
  assert_equal IO.read(__FILE__), io.read
end
test_with_io_and_custom_filename() click to toggle source
# File test/multipart_test.rb, line 296
def test_with_io_and_custom_filename
  stringio = StringIO.new(IO.read(__FILE__))
  io = UploadIO.new(stringio, "text/plain", "wat.rb")
  assert_equal "text/plain", io.content_type
  assert_equal "wat.rb", io.original_filename
  assert_equal "local.path", io.local_path
  assert_empty io.opts
  assert_equal IO.read(__FILE__), io.read
end
test_with_io_and_no_custom_filename() click to toggle source
# File test/multipart_test.rb, line 286
def test_with_io_and_no_custom_filename
  stringio = StringIO.new(IO.read(__FILE__))
  io = UploadIO.new(stringio, "text/plain")
  assert_equal "text/plain", io.content_type
  assert_equal "local.path", io.original_filename
  assert_equal "local.path", io.local_path
  assert_empty io.opts
  assert_equal IO.read(__FILE__), io.read
end