Sha256: 1df6f0cb71c3b584e273db802fb041272cae1fe3d1469a944783e40968ea8811

Contents?: true

Size: 675 Bytes

Versions: 3

Compression:

Stored size: 675 Bytes

Contents

require 'test_helper'
require 'rack'

class Marcel::MimeType::DeclaredTypeTest < Marcel::TestCase
  test "returns declared type as last resort" do
    assert_equal "text/html", Marcel::MimeType.for(name: "unrecognisable", declared_type: "text/html")
  end

  test "returns application/octet-stream if declared type empty or unrecognised" do
    assert_equal "application/octet-stream", Marcel::MimeType.for(declared_type: "")
    assert_equal "application/octet-stream", Marcel::MimeType.for(declared_type: "unrecognised")
  end

  test "ignores charset declarations" do
    assert_equal "text/html", Marcel::MimeType.for(declared_type: "text/html; charset=utf-8")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
marcel-0.3.2 test/declared_type_test.rb
marcel-0.3.1 test/declared_type_test.rb
marcel-0.3.0 test/declared_type_test.rb