jpmobile 5.1.1 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +17 -3
- data/.ruby-version +1 -1
- data/CONTRIBUTING.md +0 -6
- data/Gemfile +2 -2
- data/Gemfile.lock +116 -105
- data/Rakefile +0 -1
- data/jpmobile.gemspec +8 -7
- data/lib/jpmobile.rb +1 -1
- data/lib/jpmobile/docomo_guid.rb +1 -0
- data/lib/jpmobile/email.rb +1 -1
- data/lib/jpmobile/emoticon.rb +3 -3
- data/lib/jpmobile/emoticon/z_combine.rb +14 -14
- data/lib/jpmobile/fallback_view_selector.rb +1 -1
- data/lib/jpmobile/filter.rb +6 -20
- data/lib/jpmobile/mail.rb +17 -15
- data/lib/jpmobile/mobile/abstract_mobile.rb +11 -12
- data/lib/jpmobile/mobile/android.rb +2 -2
- data/lib/jpmobile/mobile/android_tablet.rb +2 -2
- data/lib/jpmobile/mobile/au.rb +4 -1
- data/lib/jpmobile/mobile/docomo.rb +4 -0
- data/lib/jpmobile/mobile/ipad.rb +2 -2
- data/lib/jpmobile/mobile/iphone.rb +2 -2
- data/lib/jpmobile/mobile/softbank.rb +2 -1
- data/lib/jpmobile/mobile/willcom.rb +1 -0
- data/lib/jpmobile/path_set.rb +2 -0
- data/lib/jpmobile/rack/filter.rb +1 -1
- data/lib/jpmobile/rack/params_filter.rb +9 -9
- data/lib/jpmobile/rails.rb +1 -1
- data/lib/jpmobile/resolver.rb +2 -1
- data/lib/jpmobile/trans_sid.rb +3 -3
- data/lib/jpmobile/util.rb +2 -2
- data/lib/jpmobile/version.rb +1 -1
- data/lib/tasks/jpmobile_tasks.rake +7 -8
- data/spec/rack/jpmobile/android_spec.rb +2 -2
- data/spec/rack/jpmobile/au_spec.rb +17 -17
- data/spec/rack/jpmobile/black_berry_spec.rb +2 -2
- data/spec/rack/jpmobile/docomo_spec.rb +15 -15
- data/spec/rack/jpmobile/emoticon_spec.rb +31 -31
- data/spec/rack/jpmobile/filter_spec.rb +23 -23
- data/spec/rack/jpmobile/iphone_spec.rb +3 -3
- data/spec/rack/jpmobile/mobile_by_ua_spec.rb +3 -3
- data/spec/rack/jpmobile/params_filter_spec.rb +14 -14
- data/spec/rack/jpmobile/softbank_spec.rb +9 -9
- data/spec/rack/jpmobile/willcom_spec.rb +6 -6
- data/spec/rack/jpmobile/windows_phone.rb +2 -2
- data/spec/unit/decorated_mail_spec.rb +1 -1
- data/spec/unit/mail_spec.rb +3 -3
- data/spec/unit/receive_mail_spec.rb +30 -30
- data/spec/unit/util_spec.rb +4 -4
- data/spec/unit/valid_ip_spec.rb +1 -1
- data/test/rails/overrides/Gemfile.jpmobile +1 -1
- data/test/rails/overrides/app/controllers/filter_controller_base.rb +2 -2
- data/test/rails/overrides/app/mailers/decorated_mailer.rb +1 -1
- data/test/rails/overrides/spec/controllers/mobile_spec_controller_spec.rb +6 -6
- data/test/rails/overrides/spec/features/filter_spec.rb +10 -10
- data/test/rails/overrides/spec/mailers/mobile_mailer_spec.rb +20 -20
- data/test/rails/overrides/spec/rails_helper.rb +1 -1
- data/tools/e4u_conv.rb +3 -3
- data/tools/generate_emoticon_conversion_table.rb +1 -1
- metadata +30 -20
- data/test/rails/overrides/Gemfile +0 -55
- data/test/rails/overrides/spec/controllers/hankaku_filter_controller_spec.rb +0 -14
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.join(
|
1
|
+
require File.join(__dir__, '../../rack_helper.rb')
|
2
2
|
|
3
3
|
describe '絵文字が' do
|
4
4
|
include Rack::Test::Methods
|
@@ -18,8 +18,8 @@ describe '絵文字が' do
|
|
18
18
|
@softbank_cr = ''
|
19
19
|
@softbank_utf8 = [0xf04a].pack('U')
|
20
20
|
|
21
|
-
@emoticon_yaml = File.join(
|
22
|
-
@emoticon_images = File.join(
|
21
|
+
@emoticon_yaml = File.join(__dir__, '../../../tmp/emoticon.yml')
|
22
|
+
@emoticon_images = File.join(__dir__, '../../../tmp/emoticons')
|
23
23
|
end
|
24
24
|
|
25
25
|
context 'PC のとき' do
|
@@ -51,8 +51,8 @@ describe '絵文字が' do
|
|
51
51
|
|
52
52
|
context 'PC で絵文字を変換するとき' do
|
53
53
|
before(:each) do
|
54
|
-
unless FileTest.exist?(File.join(
|
55
|
-
FileTest.directory?(File.join(
|
54
|
+
unless FileTest.exist?(File.join(__dir__, '../../../tmp/emoticon.yaml')) &&
|
55
|
+
FileTest.directory?(File.join(__dir__, '../../../tmp/emoticons'))
|
56
56
|
skip "emoticon.yaml and emoticons directory don't exists"
|
57
57
|
end
|
58
58
|
|
@@ -113,7 +113,7 @@ describe '絵文字が' do
|
|
113
113
|
@res = Rack::MockRequest.env_for(
|
114
114
|
'/',
|
115
115
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH902i(c100;TB;W24H12)',
|
116
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
116
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
117
117
|
)
|
118
118
|
end
|
119
119
|
|
@@ -142,13 +142,13 @@ describe '絵文字が' do
|
|
142
142
|
end
|
143
143
|
|
144
144
|
it 'パラメータが変換されること' do
|
145
|
-
query_string = ascii_8bit('q=' +
|
145
|
+
query_string = ascii_8bit('q=' + CGI.escape(sjis("\xf8\x9f")))
|
146
146
|
|
147
147
|
res = Rack::MockRequest.env_for(
|
148
148
|
"/?#{query_string}",
|
149
149
|
'REQUEST_METHOD' => 'GET',
|
150
150
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
151
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
151
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
152
152
|
)
|
153
153
|
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(Jpmobile::Filter.new(RenderParamApp.new))).call(res)
|
154
154
|
req = Rack::Request.new(res[1])
|
@@ -162,7 +162,7 @@ describe '絵文字が' do
|
|
162
162
|
@res = Rack::MockRequest.env_for(
|
163
163
|
'/',
|
164
164
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
165
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
165
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
166
166
|
)
|
167
167
|
end
|
168
168
|
|
@@ -191,13 +191,13 @@ describe '絵文字が' do
|
|
191
191
|
end
|
192
192
|
|
193
193
|
it 'パラメータが変換されること' do
|
194
|
-
query_string = ascii_8bit('q=' +
|
194
|
+
query_string = ascii_8bit('q=' + CGI.escape(sjis("\xf6\x60")))
|
195
195
|
|
196
196
|
res = Rack::MockRequest.env_for(
|
197
197
|
"/?#{query_string}",
|
198
198
|
'REQUEST_METHOD' => 'GET',
|
199
199
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
200
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
200
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
201
201
|
)
|
202
202
|
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(Jpmobile::Filter.new(RenderParamApp.new))).call(res)
|
203
203
|
req = Rack::Request.new(res[1])
|
@@ -211,7 +211,7 @@ describe '絵文字が' do
|
|
211
211
|
@res = Rack::MockRequest.env_for(
|
212
212
|
'/',
|
213
213
|
'HTTP_USER_AGENT' => 'SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1',
|
214
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
214
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
215
215
|
)
|
216
216
|
end
|
217
217
|
|
@@ -240,13 +240,13 @@ describe '絵文字が' do
|
|
240
240
|
end
|
241
241
|
|
242
242
|
it 'パラメータが変換されること' do
|
243
|
-
query_string = 'q=' +
|
243
|
+
query_string = 'q=' + CGI.escape([0xe04A].pack('U'))
|
244
244
|
|
245
245
|
res = Rack::MockRequest.env_for(
|
246
246
|
"/?#{query_string}",
|
247
247
|
'REQUEST_METHOD' => 'GET',
|
248
248
|
'HTTP_USER_AGENT' => 'SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1',
|
249
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
249
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
250
250
|
)
|
251
251
|
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(Jpmobile::Filter.new(RenderParamApp.new))).call(res)
|
252
252
|
req = Rack::Request.new(res[1])
|
@@ -260,7 +260,7 @@ describe '絵文字が' do
|
|
260
260
|
@res = Rack::MockRequest.env_for(
|
261
261
|
'/',
|
262
262
|
'HTTP_USER_AGENT' => 'Vodafone/1.0/V705SH/SHJ001/SN000000000000000 Browser/VF-NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1',
|
263
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
263
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
264
264
|
)
|
265
265
|
end
|
266
266
|
|
@@ -272,13 +272,13 @@ describe '絵文字が' do
|
|
272
272
|
end
|
273
273
|
|
274
274
|
it 'パラメータが変換されること' do
|
275
|
-
query_string = 'q=' +
|
275
|
+
query_string = 'q=' + CGI.escape([0xe04A].pack('U'))
|
276
276
|
|
277
277
|
res = Rack::MockRequest.env_for(
|
278
278
|
"/?#{query_string}",
|
279
279
|
'REQUEST_METHOD' => 'GET',
|
280
280
|
'HTTP_USER_AGENT' => 'Vodafone/1.0/V705SH/SHJ001/SN000000000000000 Browser/VF-NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1',
|
281
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
281
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
282
282
|
)
|
283
283
|
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(Jpmobile::Filter.new(RenderParamApp.new))).call(res)
|
284
284
|
req = Rack::Request.new(res[1])
|
@@ -293,7 +293,7 @@ describe '絵文字が' do
|
|
293
293
|
@res = Rack::MockRequest.env_for(
|
294
294
|
'/',
|
295
295
|
'HTTP_USER_AGENT' => 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0_1 like Mac OS X; ja-jp) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A306 Safari/6531.22.7',
|
296
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
296
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
297
297
|
)
|
298
298
|
end
|
299
299
|
|
@@ -305,13 +305,13 @@ describe '絵文字が' do
|
|
305
305
|
end
|
306
306
|
|
307
307
|
it 'converts query parameters' do
|
308
|
-
query_string = 'q=' +
|
308
|
+
query_string = 'q=' + CGI.escape([0xe04A].pack('U'))
|
309
309
|
|
310
310
|
res = Rack::MockRequest.env_for(
|
311
311
|
"/?#{query_string}",
|
312
312
|
'REQUEST_METHOD' => 'GET',
|
313
313
|
'HTTP_USER_AGENT' => 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0_1 like Mac OS X; ja-jp) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A306 Safari/6531.22.7',
|
314
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
314
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
315
315
|
)
|
316
316
|
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(Jpmobile::Filter.new(RenderParamApp.new))).call(res)
|
317
317
|
req = Rack::Request.new(res[1])
|
@@ -330,7 +330,7 @@ describe '絵文字が' do
|
|
330
330
|
@res = Rack::MockRequest.env_for(
|
331
331
|
'/',
|
332
332
|
'HTTP_USER_AGENT' => 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9A334 Safari/7534.48.3',
|
333
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
333
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
334
334
|
)
|
335
335
|
@unicode_single = "\342\230\200"
|
336
336
|
@unicode_multi = "\342\233\205"
|
@@ -344,13 +344,13 @@ describe '絵文字が' do
|
|
344
344
|
end
|
345
345
|
|
346
346
|
it 'converts query parameters' do
|
347
|
-
query_string = 'q=' +
|
347
|
+
query_string = 'q=' + CGI.escape(@unicode_multi)
|
348
348
|
|
349
349
|
res = Rack::MockRequest.env_for(
|
350
350
|
"/?#{query_string}",
|
351
351
|
'REQUEST_METHOD' => 'GET',
|
352
352
|
'HTTP_USER_AGENT' => 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0_1 like Mac OS X; ja-jp) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A306 Safari/6531.22.7',
|
353
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
353
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
354
354
|
)
|
355
355
|
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(Jpmobile::Filter.new(RenderParamApp.new))).call(res)
|
356
356
|
req = Rack::Request.new(res[1])
|
@@ -376,7 +376,7 @@ describe '絵文字が' do
|
|
376
376
|
@res = Rack::MockRequest.env_for(
|
377
377
|
'/',
|
378
378
|
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Linux; U; Android 1.6; ja-jp; SonyEriccsonSO-01B Build/R1EA018) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1',
|
379
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
379
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
380
380
|
)
|
381
381
|
end
|
382
382
|
|
@@ -388,13 +388,13 @@ describe '絵文字が' do
|
|
388
388
|
end
|
389
389
|
|
390
390
|
it 'converts query parameters irreversibly' do
|
391
|
-
query_string = 'q=' +
|
391
|
+
query_string = 'q=' + CGI.escape(@google_multi)
|
392
392
|
|
393
393
|
res = Rack::MockRequest.env_for(
|
394
394
|
"/?#{query_string}",
|
395
395
|
'REQUEST_METHOD' => 'GET',
|
396
396
|
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Linux; U; Android 1.6; ja-jp; SonyEriccsonSO-01B Build/R1EA018) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1',
|
397
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
397
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
398
398
|
)
|
399
399
|
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(Jpmobile::Filter.new(RenderParamApp.new))).call(res)
|
400
400
|
req = Rack::Request.new(res[1])
|
@@ -413,7 +413,7 @@ describe '絵文字が' do
|
|
413
413
|
@res = Rack::MockRequest.env_for(
|
414
414
|
'/',
|
415
415
|
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Linux; U; Android 2.2; ja-jp; SC-01C Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1',
|
416
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
416
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
417
417
|
)
|
418
418
|
end
|
419
419
|
|
@@ -425,13 +425,13 @@ describe '絵文字が' do
|
|
425
425
|
end
|
426
426
|
|
427
427
|
it 'converts query parameters irreversibly' do
|
428
|
-
query_string = 'q=' +
|
428
|
+
query_string = 'q=' + CGI.escape(@google_multi)
|
429
429
|
|
430
430
|
res = Rack::MockRequest.env_for(
|
431
431
|
"/?#{query_string}",
|
432
432
|
'REQUEST_METHOD' => 'GET',
|
433
433
|
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Linux; U; Android 2.2; ja-jp; SC-01C Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1',
|
434
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
434
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
435
435
|
)
|
436
436
|
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(Jpmobile::Filter.new(RenderParamApp.new))).call(res)
|
437
437
|
req = Rack::Request.new(res[1])
|
@@ -445,13 +445,13 @@ describe '絵文字が' do
|
|
445
445
|
end
|
446
446
|
|
447
447
|
it 'should convert unsupported emoticon to "〓"' do
|
448
|
-
query_string = 'q=' +
|
448
|
+
query_string = 'q=' + CGI.escape("\xF3\xBE\x93\xA4")
|
449
449
|
|
450
450
|
res = Rack::MockRequest.env_for(
|
451
451
|
"/?#{query_string}",
|
452
452
|
'REQUEST_METHOD' => 'GET',
|
453
453
|
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Linux; U; Android 2.2; ja-jp; SC-01C Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1',
|
454
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
454
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
455
455
|
)
|
456
456
|
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(Jpmobile::Filter.new(RenderParamApp.new))).call(res)
|
457
457
|
req = Rack::Request.new(res[1])
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.join(
|
1
|
+
require File.join(__dir__, '../../rack_helper.rb')
|
2
2
|
|
3
3
|
describe Jpmobile::Filter do
|
4
4
|
include Rack::Test::Methods
|
@@ -16,7 +16,7 @@ describe Jpmobile::Filter do
|
|
16
16
|
'/',
|
17
17
|
'REQUEST_METHOD' => 'GET',
|
18
18
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
19
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
19
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
20
20
|
)
|
21
21
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8))).call(res)
|
22
22
|
expect(res[1]['Content-Type']).to eq('text/html; charset=Shift_JIS')
|
@@ -29,7 +29,7 @@ describe Jpmobile::Filter do
|
|
29
29
|
'/',
|
30
30
|
'REQUEST_METHOD' => 'GET',
|
31
31
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
32
|
-
'Content-Type' => 'application/xhtml+xml; charset=utf-8'
|
32
|
+
'Content-Type' => 'application/xhtml+xml; charset=utf-8',
|
33
33
|
)
|
34
34
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8))).call(res)
|
35
35
|
expect(res[1]['Content-Type']).to eq('application/xhtml+xml; charset=Shift_JIS')
|
@@ -41,7 +41,7 @@ describe Jpmobile::Filter do
|
|
41
41
|
'/',
|
42
42
|
'REQUEST_METHOD' => 'GET',
|
43
43
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
44
|
-
'Content-Type' => 'application/xml; charset=utf-8'
|
44
|
+
'Content-Type' => 'application/xml; charset=utf-8',
|
45
45
|
)
|
46
46
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8))).call(res)
|
47
47
|
expect(res[1]['Content-Type']).to eq('application/xml; charset=utf-8')
|
@@ -53,7 +53,7 @@ describe Jpmobile::Filter do
|
|
53
53
|
'/',
|
54
54
|
'REQUEST_METHOD' => 'GET',
|
55
55
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
56
|
-
'Content-Type' => 'image/jpeg'
|
56
|
+
'Content-Type' => 'image/jpeg',
|
57
57
|
)
|
58
58
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8))).call(res)
|
59
59
|
expect(res[1]['Content-Type']).to eq('image/jpeg')
|
@@ -65,7 +65,7 @@ describe Jpmobile::Filter do
|
|
65
65
|
'/',
|
66
66
|
'REQUEST_METHOD' => 'GET',
|
67
67
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
68
|
-
'Content-Type' => 'application/octet-stream'
|
68
|
+
'Content-Type' => 'application/octet-stream',
|
69
69
|
)
|
70
70
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8))).call(res)
|
71
71
|
expect(res[1]['Content-Type']).to eq('application/octet-stream')
|
@@ -77,7 +77,7 @@ describe Jpmobile::Filter do
|
|
77
77
|
'/',
|
78
78
|
'REQUEST_METHOD' => 'GET',
|
79
79
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
80
|
-
'Content-Type' => 'video/mpeg'
|
80
|
+
'Content-Type' => 'video/mpeg',
|
81
81
|
)
|
82
82
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8))).call(res)
|
83
83
|
expect(res[1]['Content-Type']).to eq('video/mpeg')
|
@@ -92,7 +92,7 @@ describe Jpmobile::Filter do
|
|
92
92
|
'/',
|
93
93
|
'REQUEST_METHOD' => 'GET',
|
94
94
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
95
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
95
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
96
96
|
)
|
97
97
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8))).call(res)
|
98
98
|
expect(res[1]['Content-Type']).to eq('text/html; charset=Shift_JIS')
|
@@ -106,7 +106,7 @@ describe Jpmobile::Filter do
|
|
106
106
|
'/',
|
107
107
|
'REQUEST_METHOD' => 'GET',
|
108
108
|
'HTTP_USER_AGENT' => 'SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1',
|
109
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
109
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
110
110
|
)
|
111
111
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8))).call(res)
|
112
112
|
expect(res[1]['Content-Type']).to eq('text/html; charset=utf-8')
|
@@ -119,7 +119,7 @@ describe Jpmobile::Filter do
|
|
119
119
|
'/',
|
120
120
|
'REQUEST_METHOD' => 'GET',
|
121
121
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
122
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
122
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
123
123
|
)
|
124
124
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new('<input name="utf8" type="hidden" value="✓" />'))).call(req)
|
125
125
|
expect(res[1]['Content-Type']).to eq('text/html; charset=Shift_JIS')
|
@@ -135,7 +135,7 @@ describe Jpmobile::Filter do
|
|
135
135
|
'/',
|
136
136
|
'REQUEST_METHOD' => 'GET',
|
137
137
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
138
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
138
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
139
139
|
)
|
140
140
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new("<input name=\"utf8\" type=\"hidden\" value=\"#{[10003].pack("U")}\" />"))).call(req)
|
141
141
|
expect(res[1]['Content-Type']).to eq('text/html; charset=Shift_JIS')
|
@@ -169,7 +169,7 @@ describe Jpmobile::Filter do
|
|
169
169
|
'/',
|
170
170
|
'REQUEST_METHOD' => 'GET',
|
171
171
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
172
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
172
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
173
173
|
)
|
174
174
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_docomo_cr))).call(res)
|
175
175
|
expect(response_body(res)).to eq(@sjis + @docomo_emoji)
|
@@ -180,7 +180,7 @@ describe Jpmobile::Filter do
|
|
180
180
|
'/',
|
181
181
|
'REQUEST_METHOD' => 'GET',
|
182
182
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
183
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
183
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
184
184
|
)
|
185
185
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_docomo_utf8))).call(res)
|
186
186
|
expect(response_body(res)).to eq(@sjis + @docomo_emoji)
|
@@ -191,7 +191,7 @@ describe Jpmobile::Filter do
|
|
191
191
|
'/',
|
192
192
|
'REQUEST_METHOD' => 'GET',
|
193
193
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
194
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
194
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
195
195
|
)
|
196
196
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_au_utf8))).call(res)
|
197
197
|
expect(response_body(res)).to eq(@sjis + @docomo_emoji)
|
@@ -202,7 +202,7 @@ describe Jpmobile::Filter do
|
|
202
202
|
'/',
|
203
203
|
'REQUEST_METHOD' => 'GET',
|
204
204
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
205
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
205
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
206
206
|
)
|
207
207
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_softbank_utf8))).call(res)
|
208
208
|
expect(response_body(res)).to eq(@sjis + @docomo_emoji)
|
@@ -215,7 +215,7 @@ describe Jpmobile::Filter do
|
|
215
215
|
'/',
|
216
216
|
'REQUEST_METHOD' => 'GET',
|
217
217
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
218
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
218
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
219
219
|
)
|
220
220
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_au_cr))).call(res)
|
221
221
|
expect(response_body(res)).to eq(@sjis + @au_emoji)
|
@@ -226,7 +226,7 @@ describe Jpmobile::Filter do
|
|
226
226
|
'/',
|
227
227
|
'REQUEST_METHOD' => 'GET',
|
228
228
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
229
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
229
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
230
230
|
)
|
231
231
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_docomo_utf8))).call(res)
|
232
232
|
expect(response_body(res)).to eq(@sjis + @au_emoji)
|
@@ -237,7 +237,7 @@ describe Jpmobile::Filter do
|
|
237
237
|
'/',
|
238
238
|
'REQUEST_METHOD' => 'GET',
|
239
239
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
240
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
240
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
241
241
|
)
|
242
242
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_au_utf8))).call(res)
|
243
243
|
expect(response_body(res)).to eq(@sjis + @au_emoji)
|
@@ -248,7 +248,7 @@ describe Jpmobile::Filter do
|
|
248
248
|
'/',
|
249
249
|
'REQUEST_METHOD' => 'GET',
|
250
250
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
251
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
251
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
252
252
|
)
|
253
253
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_softbank_utf8))).call(res)
|
254
254
|
expect(response_body(res)).to eq(@sjis + @au_emoji)
|
@@ -261,7 +261,7 @@ describe Jpmobile::Filter do
|
|
261
261
|
'/',
|
262
262
|
'REQUEST_METHOD' => 'GET',
|
263
263
|
'HTTP_USER_AGENT' => 'SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1',
|
264
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
264
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
265
265
|
)
|
266
266
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_softbank_cr))).call(res)
|
267
267
|
expect(response_body(res)).to eq(@utf8 + @softbank_emoji)
|
@@ -272,7 +272,7 @@ describe Jpmobile::Filter do
|
|
272
272
|
'/',
|
273
273
|
'REQUEST_METHOD' => 'GET',
|
274
274
|
'HTTP_USER_AGENT' => 'SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1',
|
275
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
275
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
276
276
|
)
|
277
277
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_docomo_utf8))).call(res)
|
278
278
|
expect(response_body(res)).to eq(@utf8 + @softbank_emoji)
|
@@ -283,7 +283,7 @@ describe Jpmobile::Filter do
|
|
283
283
|
'/',
|
284
284
|
'REQUEST_METHOD' => 'GET',
|
285
285
|
'HTTP_USER_AGENT' => 'SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1',
|
286
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
286
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
287
287
|
)
|
288
288
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_au_utf8))).call(res)
|
289
289
|
expect(response_body(res)).to eq(@utf8 + @softbank_emoji)
|
@@ -294,7 +294,7 @@ describe Jpmobile::Filter do
|
|
294
294
|
'/',
|
295
295
|
'REQUEST_METHOD' => 'GET',
|
296
296
|
'HTTP_USER_AGENT' => 'SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1',
|
297
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
297
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
298
298
|
)
|
299
299
|
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_softbank_utf8))).call(res)
|
300
300
|
expect(response_body(res)).to eq(@utf8 + @softbank_emoji)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.join(
|
1
|
+
require File.join(__dir__, '../../rack_helper.rb')
|
2
2
|
|
3
3
|
describe Jpmobile::MobileCarrier, 'iphone' do
|
4
4
|
include Rack::Test::Methods
|
@@ -7,7 +7,7 @@ describe Jpmobile::MobileCarrier, 'iphone' do
|
|
7
7
|
it 'iPhone を判別できること' do
|
8
8
|
res = Rack::MockRequest.env_for(
|
9
9
|
'http://jpmobile-rails.org/',
|
10
|
-
'HTTP_USER_AGENT' => 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; ja-jp) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16'
|
10
|
+
'HTTP_USER_AGENT' => 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; ja-jp) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16',
|
11
11
|
)
|
12
12
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
13
13
|
|
@@ -23,7 +23,7 @@ describe Jpmobile::MobileCarrier, 'iphone' do
|
|
23
23
|
res = Rack::MockRequest.env_for(
|
24
24
|
'http://jpmobile-rails.org/',
|
25
25
|
'HTTP_USER_AGENT' => 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; ja-jp) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16',
|
26
|
-
'REMOTE_ADDR' => '202.179.204.1'
|
26
|
+
'REMOTE_ADDR' => '202.179.204.1',
|
27
27
|
)
|
28
28
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
29
29
|
|