Sha256: 6b4a99c7011922164d502cc4b2b62008d01ce268882f706209af6308f8e7a3ce

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

# -*- ruby encoding: utf-8 -*-

require 'mime/types'
require 'minitest_helper'

class TestMIMETypesLoader < Minitest::Test
  def setup
    @path   = File.expand_path('../fixture', __FILE__)
    @loader = MIME::Types::Loader.new(@path)
  end

  def assert_correctly_loaded(types)
    assert_includes(types, 'application/1d-interleaved-parityfec')
    assert_includes(types['application/acad'].first.references, 'LTSW')
    assert_equal([%w(WebM http://www.webmproject.org/code/specs/container/)],
                 types['audio/webm'].first.urls)
    assert_equal(%w(webm), types['audio/webm'].first.extensions)
    refute(types['audio/webm'].first.registered?)

    assert_equal("Fixes a bug with IE6 and progressive JPEGs",
                 types['image/pjpeg'].first.docs)

    assert(types['application/x-apple-diskimage'].first.system?)
    assert_equal(/mac/, types['application/x-apple-diskimage'].first.system)

    assert(types['audio/vnd.qcelp'].first.obsolete?)
    assert_equal(%w(audio/QCELP),
                 types['audio/vnd.qcelp'].first.use_instead)
  end

  def test_load_yaml
    assert_correctly_loaded(@loader.load_yaml)
  end

  def test_load_json
    assert_correctly_loaded(@loader.load_json)
  end

  def test_load_v1
    assert_correctly_loaded(@loader.load_v1)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mime-types-2.3 test/test_mime_types_loader.rb
mime-types-2.2 test/test_mime_types_loader.rb
mime-types-2.1 test/test_mime_types_loader.rb
mime-types-2.0 test/test_mime_types_loader.rb