class Hurley::ParamPartTest

Public Instance Methods

test_build_with_content_type() click to toggle source
# File test/multipart_test.rb, line 117
def test_build_with_content_type
  part = Multipart::Part.new("boundary", "foo", "bar",
    :content_type => "text/plain")
  expected = %Q(--boundary\r\n) +
    %Q(Content-Disposition: form-data; name="foo"\r\n) +
    %Q(Content-Type: text/plain\r\n) +
    %Q(\r\nbar\r\n)
  assert_equal expected.size, part.length
  assert_equal expected, part.to_io.read
end
test_build_without_content_type() click to toggle source
# File test/multipart_test.rb, line 108
def test_build_without_content_type
  part = Multipart::Part.new("boundary", "foo", "bar", {})
  expected = %Q(--boundary\r\n) +
    %Q(Content-Disposition: form-data; name="foo"\r\n) +
    %Q(\r\nbar\r\n)
  assert_equal expected.size, part.length
  assert_equal expected, part.to_io.read
end