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
@@ -7,17 +7,17 @@ module Jpmobile
|
|
7
7
|
|
8
8
|
def call(env)
|
9
9
|
# 入力
|
10
|
-
if (mobile = env['rack.jpmobile']) && mobile.apply_params_filter?
|
10
|
+
if (@mobile = env['rack.jpmobile']) && @mobile.apply_params_filter?
|
11
11
|
# パラメータをkey, valueに分解
|
12
12
|
# form_params
|
13
13
|
unless env['REQUEST_METHOD'] == 'GET' || env['REQUEST_METHOD'] == 'HEAD'
|
14
|
-
unless env['CONTENT_TYPE']
|
15
|
-
env['rack.input'] = StringIO.new(parse_query(env['rack.input'].read
|
14
|
+
unless env['CONTENT_TYPE'].match?(%r{application/json|application/xml})
|
15
|
+
env['rack.input'] = StringIO.new(parse_query(env['rack.input'].read))
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
# query_params
|
20
|
-
env['QUERY_STRING'] = parse_query(env['QUERY_STRING']
|
20
|
+
env['QUERY_STRING'] = parse_query(env['QUERY_STRING'])
|
21
21
|
end
|
22
22
|
|
23
23
|
status, env, body = @app.call(env)
|
@@ -27,18 +27,18 @@ module Jpmobile
|
|
27
27
|
|
28
28
|
private
|
29
29
|
|
30
|
-
def to_internal(str
|
31
|
-
::Rack::Utils.escape(mobile.to_internal(::Rack::Utils.unescape(str)))
|
30
|
+
def to_internal(str)
|
31
|
+
::Rack::Utils.escape(@mobile.to_internal(::Rack::Utils.unescape(str)))
|
32
32
|
end
|
33
33
|
|
34
|
-
def parse_query(str
|
34
|
+
def parse_query(str)
|
35
35
|
return nil unless str
|
36
36
|
|
37
37
|
new_array = []
|
38
38
|
str.split('&').each do |param_pair|
|
39
39
|
k, v = param_pair.split('=')
|
40
|
-
k = to_internal(k
|
41
|
-
v = to_internal(v
|
40
|
+
k = to_internal(k) if k
|
41
|
+
v = to_internal(v) if v
|
42
42
|
new_array << "#{k}=#{v}" if k
|
43
43
|
end
|
44
44
|
|
data/lib/jpmobile/rails.rb
CHANGED
@@ -46,7 +46,7 @@ module Jpmobile
|
|
46
46
|
before_action :register_mobile
|
47
47
|
|
48
48
|
self._view_paths = self._view_paths.dup
|
49
|
-
self.view_paths.unshift(*self.view_paths.map {
|
49
|
+
self.view_paths.unshift(*self.view_paths.map {|resolver| Jpmobile::Resolver.new(resolver.to_path) })
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
data/lib/jpmobile/resolver.rb
CHANGED
@@ -5,6 +5,7 @@ module Jpmobile
|
|
5
5
|
|
6
6
|
def initialize(path, pattern = nil)
|
7
7
|
raise ArgumentError, 'path already is a Resolver class' if path.is_a?(Resolver)
|
8
|
+
|
8
9
|
super(path, pattern || DEFAULT_PATTERN)
|
9
10
|
@path = File.expand_path(path)
|
10
11
|
end
|
@@ -38,7 +39,7 @@ module Jpmobile
|
|
38
39
|
virtual_path: virtual_path,
|
39
40
|
format: format,
|
40
41
|
variant: variant,
|
41
|
-
updated_at: mtime(template)
|
42
|
+
updated_at: mtime(template),
|
42
43
|
)
|
43
44
|
end
|
44
45
|
end
|
data/lib/jpmobile/trans_sid.rb
CHANGED
@@ -5,8 +5,6 @@ module Jpmobile
|
|
5
5
|
module SessionID
|
6
6
|
require 'action_dispatch/middleware/session/abstract_store'
|
7
7
|
|
8
|
-
module_function
|
9
|
-
|
10
8
|
extend ActionDispatch::Session::Compatibility
|
11
9
|
end
|
12
10
|
|
@@ -32,6 +30,7 @@ module Jpmobile
|
|
32
30
|
result = super || {}.with_indifferent_access
|
33
31
|
return result unless request # for test process
|
34
32
|
return result unless apply_trans_sid?
|
33
|
+
|
35
34
|
result.merge({ session_key.to_sym => jpmobile_session_id })
|
36
35
|
end
|
37
36
|
|
@@ -60,6 +59,7 @@ module Jpmobile
|
|
60
59
|
return unless request # for test process
|
61
60
|
return unless apply_trans_sid?
|
62
61
|
return unless jpmobile_session_id
|
62
|
+
|
63
63
|
response.body = response.body.gsub(%r{(</form>)}i, sid_hidden_field_tag + '\1')
|
64
64
|
end
|
65
65
|
end
|
@@ -69,7 +69,7 @@ module Jpmobile
|
|
69
69
|
if apply_trans_sid? && jpmobile_session_id && options != :back && options !~ /^\w[\w+.-]*:.*/
|
70
70
|
case options
|
71
71
|
when String
|
72
|
-
unless options
|
72
|
+
unless options.match?(/#{session_key}/)
|
73
73
|
url = URI.parse(options)
|
74
74
|
if url.query
|
75
75
|
url.query += "&#{session_key}=#{jpmobile_session_id}"
|
data/lib/jpmobile/util.rb
CHANGED
@@ -206,7 +206,7 @@ module Jpmobile
|
|
206
206
|
s = str.dup
|
207
207
|
return str if detect_encoding(str) == to
|
208
208
|
|
209
|
-
to = SJIS if to
|
209
|
+
to = SJIS if to.match?(/shift_jis/i)
|
210
210
|
|
211
211
|
to_enc = ::Encoding.find(to)
|
212
212
|
return str if s.encoding == to_enc
|
@@ -228,7 +228,7 @@ module Jpmobile
|
|
228
228
|
end
|
229
229
|
|
230
230
|
def set_encoding(str, encoding)
|
231
|
-
encoding = SJIS if encoding
|
231
|
+
encoding = SJIS if encoding.match?(/shift_jis/i)
|
232
232
|
str.force_encoding(encoding)
|
233
233
|
|
234
234
|
str
|
data/lib/jpmobile/version.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
1
|
# desc "Explaining what the task does"
|
3
2
|
# task :jpmobile do
|
4
3
|
# # Task goes here
|
@@ -86,10 +85,10 @@ namespace :test do
|
|
86
85
|
# for cookie_only option
|
87
86
|
config_path = File.join(rails_root, 'config', 'initializers', 'session_store.rb')
|
88
87
|
File.open(config_path, 'w') do |file|
|
89
|
-
file.write
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
file.write <<-SESSION_CONFIG
|
89
|
+
Rails.application.config.session_store :active_record_store, :key => '_session_id'
|
90
|
+
Rails.application.config.session_options = { :cookie_only => false }
|
91
|
+
SESSION_CONFIG
|
93
92
|
end
|
94
93
|
end
|
95
94
|
|
@@ -97,9 +96,9 @@ END
|
|
97
96
|
# add gems for jpmobile spec
|
98
97
|
config_path = File.join(rails_root, 'Gemfile')
|
99
98
|
File.open(config_path, 'a+') do |file|
|
100
|
-
file.write
|
101
|
-
|
102
|
-
|
99
|
+
file.write <<-GEMFILE
|
100
|
+
instance_eval File.read(File.expand_path(__FILE__) + '.jpmobile')
|
101
|
+
GEMFILE
|
103
102
|
end
|
104
103
|
end
|
105
104
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.join(
|
1
|
+
require File.join(__dir__, '../../rack_helper.rb')
|
2
2
|
|
3
3
|
describe Jpmobile::MobileCarrier, 'android' do
|
4
4
|
include Rack::Test::Methods
|
@@ -7,7 +7,7 @@ describe Jpmobile::MobileCarrier, 'android' do
|
|
7
7
|
it 'Android を判別できること' do
|
8
8
|
res = Rack::MockRequest.env_for(
|
9
9
|
'http://jpmobile-rails.org/',
|
10
|
-
'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'
|
10
|
+
'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',
|
11
11
|
)
|
12
12
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
13
13
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.join(
|
1
|
+
require File.join(__dir__, '../../rack_helper.rb')
|
2
2
|
|
3
3
|
describe Jpmobile::MobileCarrier, 'au' do
|
4
4
|
include Rack::Test::Methods
|
@@ -8,7 +8,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
8
8
|
res = Rack::MockRequest.env_for(
|
9
9
|
'http://jpmobile-rails.org/',
|
10
10
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
11
|
-
'HTTP_X_UP_SUBNO' => '00000000000000_mj.ezweb.ne.jp'
|
11
|
+
'HTTP_X_UP_SUBNO' => '00000000000000_mj.ezweb.ne.jp',
|
12
12
|
)
|
13
13
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
14
14
|
|
@@ -24,7 +24,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
24
24
|
it 'TK22 で判別できること' do
|
25
25
|
res = Rack::MockRequest.env_for(
|
26
26
|
'http://jpmobile-rails.org/',
|
27
|
-
'HTTP_USER_AGENT' => 'UP.Browser/3.04-KCTA UP.Link/3.4.5.9'
|
27
|
+
'HTTP_USER_AGENT' => 'UP.Browser/3.04-KCTA UP.Link/3.4.5.9',
|
28
28
|
)
|
29
29
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
30
30
|
|
@@ -37,7 +37,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
37
37
|
res = Rack::MockRequest.env_for(
|
38
38
|
'http://jpmobile-rails.org/',
|
39
39
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
40
|
-
'QUERY_STRING' => 'ver=1&datum=0&unit=1&lat=%2b43.07772&lon=%2b141.34114&alt=64&time=20061016192415&smaj=69&smin=18&vert=21&majaa=115&fm=1'
|
40
|
+
'QUERY_STRING' => 'ver=1&datum=0&unit=1&lat=%2b43.07772&lon=%2b141.34114&alt=64&time=20061016192415&smaj=69&smin=18&vert=21&majaa=115&fm=1',
|
41
41
|
)
|
42
42
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
43
43
|
|
@@ -49,7 +49,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
49
49
|
res = Rack::MockRequest.env_for(
|
50
50
|
'http://jpmobile-rails.org/',
|
51
51
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
52
|
-
'QUERY_STRING' => 'ver=1&datum=0&unit=0&lat=%2b43.05.08.95&lon=%2b141.20.25.99&alt=155&time=20060521010328&smaj=76&smin=62&vert=65&majaa=49&fm=1'
|
52
|
+
'QUERY_STRING' => 'ver=1&datum=0&unit=0&lat=%2b43.05.08.95&lon=%2b141.20.25.99&alt=155&time=20060521010328&smaj=76&smin=62&vert=65&majaa=49&fm=1',
|
53
53
|
)
|
54
54
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
55
55
|
|
@@ -61,7 +61,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
61
61
|
res = Rack::MockRequest.env_for(
|
62
62
|
'http://jpmobile-rails.org/',
|
63
63
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
64
|
-
'QUERY_STRING' => 'ver=1&datum=1&unit=1&lat=%2b43.07475&lon=%2b141.34259&alt=8&time=20061017182825&smaj=113&smin=76&vert=72&majaa=108&fm=1'
|
64
|
+
'QUERY_STRING' => 'ver=1&datum=1&unit=1&lat=%2b43.07475&lon=%2b141.34259&alt=8&time=20061017182825&smaj=113&smin=76&vert=72&majaa=108&fm=1',
|
65
65
|
)
|
66
66
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
67
67
|
|
@@ -73,7 +73,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
73
73
|
res = Rack::MockRequest.env_for(
|
74
74
|
'http://jpmobile-rails.org/',
|
75
75
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
76
|
-
'QUERY_STRING' => 'ver=1&datum=1&unit=1&lat=%2b43.07475&lon=%2b141.34259&alt=8&time=20061017182825&smaj=113&smin=76&vert=72&majaa=108&fm=1'
|
76
|
+
'QUERY_STRING' => 'ver=1&datum=1&unit=1&lat=%2b43.07475&lon=%2b141.34259&alt=8&time=20061017182825&smaj=113&smin=76&vert=72&majaa=108&fm=1',
|
77
77
|
)
|
78
78
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
79
79
|
|
@@ -85,7 +85,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
85
85
|
res = Rack::MockRequest.env_for(
|
86
86
|
'http://jpmobile-rails.org/',
|
87
87
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
88
|
-
'QUERY_STRING' => 'datum=tokyo&unit=dms&lat=43.04.55.00&lon=141.20.50.75'
|
88
|
+
'QUERY_STRING' => 'datum=tokyo&unit=dms&lat=43.04.55.00&lon=141.20.50.75',
|
89
89
|
)
|
90
90
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
91
91
|
|
@@ -97,7 +97,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
97
97
|
res = Rack::MockRequest.env_for(
|
98
98
|
'http://jpmobile-rails.org/',
|
99
99
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
100
|
-
'QUERY_STRING' => 'datum=tokyo&unit=dms&lat=43.04.55.00&lon=141.20.50.75'
|
100
|
+
'QUERY_STRING' => 'datum=tokyo&unit=dms&lat=43.04.55.00&lon=141.20.50.75',
|
101
101
|
)
|
102
102
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
103
103
|
|
@@ -109,7 +109,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
109
109
|
res = Rack::MockRequest.env_for(
|
110
110
|
'http://jpmobile-rails.org/',
|
111
111
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
112
|
-
'QUERY_STRING' => 'ver=1&datum=0&unit=1&lat=%2b43.07772&lon=%2b141.34114&alt=64&time=20061016192415&smaj=69&smin=18&vert=21&majaa=115&fm=1'
|
112
|
+
'QUERY_STRING' => 'ver=1&datum=0&unit=1&lat=%2b43.07772&lon=%2b141.34114&alt=64&time=20061016192415&smaj=69&smin=18&vert=21&majaa=115&fm=1',
|
113
113
|
)
|
114
114
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
115
115
|
|
@@ -125,7 +125,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
125
125
|
it 'W31CA を判定できること' do
|
126
126
|
res = Rack::MockRequest.env_for(
|
127
127
|
'http://jpmobile-rails.org/',
|
128
|
-
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0'
|
128
|
+
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
129
129
|
)
|
130
130
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
131
131
|
|
@@ -137,7 +137,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
137
137
|
it 'A1402S を判定できること' do
|
138
138
|
res = Rack::MockRequest.env_for(
|
139
139
|
'http://jpmobile-rails.org/',
|
140
|
-
'HTTP_USER_AGENT' => 'KDDI-SN26 UP.Browser/6.2.0.6.2 (GUI) MMP/2.0'
|
140
|
+
'HTTP_USER_AGENT' => 'KDDI-SN26 UP.Browser/6.2.0.6.2 (GUI) MMP/2.0',
|
141
141
|
)
|
142
142
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
143
143
|
|
@@ -149,7 +149,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
149
149
|
it 'TK22 を判定できること' do
|
150
150
|
res = Rack::MockRequest.env_for(
|
151
151
|
'http://jpmobile-rails.org/',
|
152
|
-
'HTTP_USER_AGENT' => 'UP.Browser/3.04-KCTA UP.Link/3.4.5.9'
|
152
|
+
'HTTP_USER_AGENT' => 'UP.Browser/3.04-KCTA UP.Link/3.4.5.9',
|
153
153
|
)
|
154
154
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
155
155
|
|
@@ -165,7 +165,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
165
165
|
res = Rack::MockRequest.env_for(
|
166
166
|
'http://jpmobile-rails.org/',
|
167
167
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
168
|
-
'REMOTE_ADDR' => '210.230.128.225'
|
168
|
+
'REMOTE_ADDR' => '210.230.128.225',
|
169
169
|
)
|
170
170
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
171
171
|
|
@@ -176,7 +176,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
176
176
|
res = Rack::MockRequest.env_for(
|
177
177
|
'http://jpmobile-rails.org/',
|
178
178
|
'HTTP_USER_AGENT' => 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0',
|
179
|
-
'REMOTE_ADDR' => '127.0.0.1'
|
179
|
+
'REMOTE_ADDR' => '127.0.0.1',
|
180
180
|
)
|
181
181
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
182
182
|
|
@@ -191,7 +191,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
191
191
|
'HTTP_USER_AGENT' => 'KDDI-CA33 UP.Browser/6.2.0.10.4 (GUI) MMP/2.0',
|
192
192
|
'HTTP_X_UP_DEVCAP_SCREENDEPTH' => '16,RGB565',
|
193
193
|
'HTTP_X_UP_DEVCAP_SCREENPIXELS' => '240,346',
|
194
|
-
'HTTP_X_UP_DEVCAP_ISCOLOR' => '1'
|
194
|
+
'HTTP_X_UP_DEVCAP_ISCOLOR' => '1',
|
195
195
|
)
|
196
196
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
197
197
|
|
@@ -204,7 +204,7 @@ describe Jpmobile::MobileCarrier, 'au' do
|
|
204
204
|
it '端末の画面情報が渡ってない場合に正しく動作すること' do
|
205
205
|
res = Rack::MockRequest.env_for(
|
206
206
|
'http://jpmobile-rails.org/',
|
207
|
-
'HTTP_USER_AGENT' => 'KDDI-CA33 UP.Browser/6.2.0.10.4 (GUI) MMP/2.0'
|
207
|
+
'HTTP_USER_AGENT' => 'KDDI-CA33 UP.Browser/6.2.0.10.4 (GUI) MMP/2.0',
|
208
208
|
)
|
209
209
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
210
210
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.join(
|
1
|
+
require File.join(__dir__, '../../rack_helper.rb')
|
2
2
|
|
3
3
|
describe Jpmobile::MobileCarrier, 'Windows Phone' do
|
4
4
|
include Rack::Test::Methods
|
@@ -7,7 +7,7 @@ describe Jpmobile::MobileCarrier, 'Windows Phone' do
|
|
7
7
|
it 'BlackBerryを判別できること' do
|
8
8
|
res = Rack::MockRequest.env_for(
|
9
9
|
'http://jpmobile-rails.org/',
|
10
|
-
'HTTP_USER_AGENT' => 'BlackBerry9000/4.6.0.224 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/220'
|
10
|
+
'HTTP_USER_AGENT' => 'BlackBerry9000/4.6.0.224 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/220',
|
11
11
|
)
|
12
12
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
13
13
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.join(
|
1
|
+
require File.join(__dir__, '../../rack_helper.rb')
|
2
2
|
|
3
3
|
describe Jpmobile::MobileCarrier, 'docomo' do
|
4
4
|
include Rack::Test::Methods
|
@@ -7,7 +7,7 @@ describe Jpmobile::MobileCarrier, 'docomo' do
|
|
7
7
|
before(:each) do
|
8
8
|
res = Rack::MockRequest.env_for(
|
9
9
|
'http://jpmobile-rails.org/',
|
10
|
-
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH902i(c100;TB;W24H16)'
|
10
|
+
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH902i(c100;TB;W24H16)',
|
11
11
|
)
|
12
12
|
@env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
13
13
|
end
|
@@ -39,7 +39,7 @@ describe Jpmobile::MobileCarrier, 'docomo' do
|
|
39
39
|
before(:each) do
|
40
40
|
res = Rack::MockRequest.env_for(
|
41
41
|
'http://jpmobile-rails.org/',
|
42
|
-
'HTTP_USER_AGENT' => 'DoCoMo/1.0/SO506iC/c20/TB/W20H10'
|
42
|
+
'HTTP_USER_AGENT' => 'DoCoMo/1.0/SO506iC/c20/TB/W20H10',
|
43
43
|
)
|
44
44
|
@env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
45
45
|
end
|
@@ -71,7 +71,7 @@ describe Jpmobile::MobileCarrier, 'docomo' do
|
|
71
71
|
before(:each) do
|
72
72
|
res = Rack::MockRequest.env_for(
|
73
73
|
'http://jpmobile-rails.org/',
|
74
|
-
'HTTP_USER_AGENT' => 'DoCoMo/2.0 P09A3(c500;TB;W20H12)'
|
74
|
+
'HTTP_USER_AGENT' => 'DoCoMo/2.0 P09A3(c500;TB;W20H12)',
|
75
75
|
)
|
76
76
|
@env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
77
77
|
end
|
@@ -89,7 +89,7 @@ describe Jpmobile::MobileCarrier, 'docomo' do
|
|
89
89
|
before(:each) do
|
90
90
|
res = Rack::MockRequest.env_for(
|
91
91
|
'http://jpmobile-rails.org/',
|
92
|
-
'HTTP_USER_AGENT' => 'DoCoMo/2.0 P07A3(c500;TB;W24H15)'
|
92
|
+
'HTTP_USER_AGENT' => 'DoCoMo/2.0 P07A3(c500;TB;W24H15)',
|
93
93
|
)
|
94
94
|
@env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
95
95
|
end
|
@@ -107,7 +107,7 @@ describe Jpmobile::MobileCarrier, 'docomo' do
|
|
107
107
|
before(:each) do
|
108
108
|
res = Rack::MockRequest.env_for(
|
109
109
|
'http://jpmobile-rails.org/',
|
110
|
-
'HTTP_USER_AGENT' => 'DoCoMo/2.0 L01B(c500;TB;W40H10)'
|
110
|
+
'HTTP_USER_AGENT' => 'DoCoMo/2.0 L01B(c500;TB;W40H10)',
|
111
111
|
)
|
112
112
|
@env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
113
113
|
end
|
@@ -126,7 +126,7 @@ describe Jpmobile::MobileCarrier, 'docomo' do
|
|
126
126
|
res = Rack::MockRequest.env_for(
|
127
127
|
'http://jpmobile-rails.org/',
|
128
128
|
'HTTP_USER_AGENT' => 'DoCoMo/1.0/SO506iC/c20/TB/W20H10',
|
129
|
-
'QUERY_STRING' => 'AREACODE=00100&ACTN=OK'
|
129
|
+
'QUERY_STRING' => 'AREACODE=00100&ACTN=OK',
|
130
130
|
)
|
131
131
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
132
132
|
|
@@ -137,7 +137,7 @@ describe Jpmobile::MobileCarrier, 'docomo' do
|
|
137
137
|
res = Rack::MockRequest.env_for(
|
138
138
|
'http://jpmobile-rails.org/',
|
139
139
|
'HTTP_USER_AGENT' => 'DoCoMo/1.0/SO506iC/c20/TB/W20H10',
|
140
|
-
'QUERY_STRING' => 'LAT=%2B35.00.35.600&LON=%2B135.41.35.600&GEO=wgs84&POSINFO=2&AREACODE=00100&ACTN=OK'
|
140
|
+
'QUERY_STRING' => 'LAT=%2B35.00.35.600&LON=%2B135.41.35.600&GEO=wgs84&POSINFO=2&AREACODE=00100&ACTN=OK',
|
141
141
|
)
|
142
142
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
143
143
|
|
@@ -153,7 +153,7 @@ describe Jpmobile::MobileCarrier, 'docomo' do
|
|
153
153
|
res = Rack::MockRequest.env_for(
|
154
154
|
'http://jpmobile-rails.org/',
|
155
155
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SA702i(c100;TB;W30H15)',
|
156
|
-
'QUERY_STRING' => 'lat=%2B35.00.35.600&lon=%2B135.41.35.600&geo=wgs84&x-acc=3'
|
156
|
+
'QUERY_STRING' => 'lat=%2B35.00.35.600&lon=%2B135.41.35.600&geo=wgs84&x-acc=3',
|
157
157
|
)
|
158
158
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
159
159
|
|
@@ -168,7 +168,7 @@ describe Jpmobile::MobileCarrier, 'docomo' do
|
|
168
168
|
res = Rack::MockRequest.env_for(
|
169
169
|
'http://jpmobile-rails.org/',
|
170
170
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH903i(c100;TB;W24H16)',
|
171
|
-
'QUERY_STRING' => 'lat=%2B35.00.35.600&lon=%2B135.41.35.600&geo=WGS84&alt=%2B64.000&x-acc=1'
|
171
|
+
'QUERY_STRING' => 'lat=%2B35.00.35.600&lon=%2B135.41.35.600&geo=WGS84&alt=%2B64.000&x-acc=1',
|
172
172
|
)
|
173
173
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
174
174
|
|
@@ -181,7 +181,7 @@ describe Jpmobile::MobileCarrier, 'docomo' do
|
|
181
181
|
it 'mova で取得できること' do
|
182
182
|
res = Rack::MockRequest.env_for(
|
183
183
|
'http://jpmobile-rails.org/',
|
184
|
-
'HTTP_USER_AGENT' => 'DoCoMo/1.0/SO505iS/c20/TC/W30H16/serXXXXX000000'
|
184
|
+
'HTTP_USER_AGENT' => 'DoCoMo/1.0/SO505iS/c20/TC/W30H16/serXXXXX000000',
|
185
185
|
)
|
186
186
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
187
187
|
|
@@ -195,7 +195,7 @@ describe Jpmobile::MobileCarrier, 'docomo' do
|
|
195
195
|
it 'FOMA で取得できること' do
|
196
196
|
res = Rack::MockRequest.env_for(
|
197
197
|
'http://jpmobile-rails.org/',
|
198
|
-
'HTTP_USER_AGENT' => 'DoCoMo/2.0 D902i(c100;TB;W23H16;ser999999999999999;icc0000000000000000000f)'
|
198
|
+
'HTTP_USER_AGENT' => 'DoCoMo/2.0 D902i(c100;TB;W23H16;ser999999999999999;icc0000000000000000000f)',
|
199
199
|
)
|
200
200
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
201
201
|
|
@@ -212,7 +212,7 @@ describe Jpmobile::MobileCarrier, 'docomo' do
|
|
212
212
|
res = Rack::MockRequest.env_for(
|
213
213
|
'http://jpmobile-rails.org/',
|
214
214
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH902i(c100;TB;W24H12)',
|
215
|
-
'REMOTE_ADDR' => '210.153.84.1'
|
215
|
+
'REMOTE_ADDR' => '210.153.84.1',
|
216
216
|
)
|
217
217
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
218
218
|
|
@@ -223,7 +223,7 @@ describe Jpmobile::MobileCarrier, 'docomo' do
|
|
223
223
|
res = Rack::MockRequest.env_for(
|
224
224
|
'http://jpmobile-rails.org/',
|
225
225
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH902i(c100;TB;W24H12)',
|
226
|
-
'REMOTE_ADDR' => '127.0.0.1'
|
226
|
+
'REMOTE_ADDR' => '127.0.0.1',
|
227
227
|
)
|
228
228
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
229
229
|
|
@@ -235,7 +235,7 @@ describe Jpmobile::MobileCarrier, 'docomo' do
|
|
235
235
|
it 'SO506iCのサイズを適切に取得できること' do
|
236
236
|
res = Rack::MockRequest.env_for(
|
237
237
|
'http://jpmobile-rails.org/',
|
238
|
-
'HTTP_USER_AGENT' => 'DoCoMo/1.0/SO506iC/c20/TB/W20H10'
|
238
|
+
'HTTP_USER_AGENT' => 'DoCoMo/1.0/SO506iC/c20/TB/W20H10',
|
239
239
|
)
|
240
240
|
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
241
241
|
|