mime-types 1.15 → 1.16
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +2 -0
- data/{ChangeLog → History.txt} +21 -15
- data/Install.txt +17 -0
- data/{LICENCE → Licence.txt} +0 -3
- data/Manifest.txt +12 -0
- data/README.txt +28 -0
- data/Rakefile +268 -160
- data/lib/mime/types.rb +109 -916
- data/lib/mime/types.rb.data +1324 -0
- data/mime-types.gemspec +43 -0
- data/setup.rb +799 -580
- data/test/test_mime_type.rb +356 -0
- data/test/test_mime_types.rb +122 -0
- metadata +120 -51
- metadata.gz.sig +0 -0
- data/Install +0 -16
- data/README +0 -30
- data/pre-setup.rb +0 -46
- data/tests/tc_mime_type.rb +0 -275
- data/tests/tc_mime_types.rb +0 -77
- data/tests/testall.rb +0 -18
data/tests/tc_mime_types.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
#--
|
3
|
-
# MIME::Types for Ruby
|
4
|
-
# http://rubyforge.org/projects/mime-types/
|
5
|
-
# Copyright 2003 - 2005 Austin Ziegler.
|
6
|
-
# Licensed under a MIT-style licence.
|
7
|
-
#
|
8
|
-
# $Id: tc_mime_types.rb,v 1.2 2006/02/12 21:27:22 austin Exp $
|
9
|
-
#++
|
10
|
-
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib") if __FILE__ == $0
|
11
|
-
|
12
|
-
require 'mime/types'
|
13
|
-
require 'test/unit'
|
14
|
-
|
15
|
-
class TestMIME__Types < Test::Unit::TestCase #:nodoc:
|
16
|
-
def test_s_AREF # singleton method '[]'
|
17
|
-
text_plain = MIME::Type.new('text/plain') do |t|
|
18
|
-
t.encoding = '8bit'
|
19
|
-
t.extensions = ['asc', 'txt', 'c', 'cc', 'h', 'hh', 'cpp', 'hpp',
|
20
|
-
'dat', 'hlp']
|
21
|
-
end
|
22
|
-
text_plain_vms = MIME::Type.new('text/plain') do |t|
|
23
|
-
t.encoding = '8bit'
|
24
|
-
t.extensions = ['doc']
|
25
|
-
t.system = 'vms'
|
26
|
-
end
|
27
|
-
text_vnd_fly = MIME::Type.new('text/vnd.fly')
|
28
|
-
assert_equal(MIME::Types['text/plain'].sort,
|
29
|
-
[text_plain, text_plain_vms].sort)
|
30
|
-
|
31
|
-
tst_bmp = MIME::Types["image/x-bmp"] +
|
32
|
-
MIME::Types["image/vnd.wap.wbmp"] + MIME::Types["image/x-win-bmp"]
|
33
|
-
|
34
|
-
assert_equal(tst_bmp.sort, MIME::Types[/bmp$/].sort)
|
35
|
-
assert_nothing_raised {
|
36
|
-
MIME::Types['image/bmp'][0].system = RUBY_PLATFORM
|
37
|
-
}
|
38
|
-
assert_equal([MIME::Type.from_array('image/x-bmp', ['bmp'])],
|
39
|
-
MIME::Types[/bmp$/, { :platform => true }])
|
40
|
-
|
41
|
-
assert(MIME::Types['text/vnd.fly', { :complete => true }].empty?)
|
42
|
-
assert(!MIME::Types['text/plain', { :complete => true} ].empty?)
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_s_add
|
46
|
-
assert_nothing_raised do
|
47
|
-
@eruby = MIME::Type.new("application/x-eruby") do |t|
|
48
|
-
t.extensions = "rhtml"
|
49
|
-
t.encoding = "8bit"
|
50
|
-
end
|
51
|
-
|
52
|
-
MIME::Types.add(@eruby)
|
53
|
-
end
|
54
|
-
|
55
|
-
assert_equal(MIME::Types['application/x-eruby'], [@eruby])
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_s_type_for
|
59
|
-
assert_equal(MIME::Types.type_for('xml').sort, [ MIME::Types['text/xml'], MIME::Types['application/xml'] ].sort)
|
60
|
-
assert_equal(MIME::Types.type_for('gif'), MIME::Types['image/gif'])
|
61
|
-
assert_nothing_raised do
|
62
|
-
MIME::Types['image/gif'][0].system = RUBY_PLATFORM
|
63
|
-
end
|
64
|
-
assert_equal(MIME::Types.type_for('gif', true), MIME::Types['image/gif'])
|
65
|
-
assert(MIME::Types.type_for('zzz').empty?)
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_s_of
|
69
|
-
assert_equal(MIME::Types.of('xml').sort, [ MIME::Types['text/xml'], MIME::Types['application/xml'] ].sort)
|
70
|
-
assert_equal(MIME::Types.of('gif'), MIME::Types['image/gif'])
|
71
|
-
assert_nothing_raised do
|
72
|
-
MIME::Types['image/gif'][0].system = RUBY_PLATFORM
|
73
|
-
end
|
74
|
-
assert_equal(MIME::Types.of('gif', true), MIME::Types['image/gif'])
|
75
|
-
assert(MIME::Types.of('zzz').empty?)
|
76
|
-
end
|
77
|
-
end
|
data/tests/testall.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
#--
|
3
|
-
# MIME::Types for Ruby
|
4
|
-
# http://rubyforge.org/projects/mime-types/
|
5
|
-
# Copyright 2003 - 2005 Austin Ziegler.
|
6
|
-
# Licensed under a MIT-style licence.
|
7
|
-
#
|
8
|
-
# $Id: testall.rb,v 1.1 2005/07/08 11:58:06 austin Exp $
|
9
|
-
#++
|
10
|
-
|
11
|
-
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib") if __FILE__ == $0
|
12
|
-
|
13
|
-
puts "Checking for test cases:"
|
14
|
-
Dir['tc_*.rb'].each do |testcase|
|
15
|
-
puts "\t#{testcase}"
|
16
|
-
require testcase
|
17
|
-
end
|
18
|
-
puts
|