File: declared_type_test.rb

package info (click to toggle)
ruby-marcel 1.0.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,744 kB
  • sloc: xml: 7,041; ruby: 536; makefile: 7; javascript: 3
file content (17 lines) | stat: -rw-r--r-- 675 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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