jpmobile 4.2.5 → 5.0.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -2
- data/jpmobile.gemspec +1 -2
- data/lib/jpmobile.rb +17 -7
- data/lib/jpmobile/configuration.rb +1 -1
- data/lib/jpmobile/encoding.rb +13 -19
- data/lib/jpmobile/{hook_action_controller.rb → fallback_view_selector.rb} +4 -6
- data/lib/jpmobile/filter.rb +13 -10
- data/lib/jpmobile/mobile/abstract_mobile.rb +2 -2
- data/lib/jpmobile/mobile/google_emoticon.rb +2 -2
- data/lib/jpmobile/mobile/smart_phone.rb +2 -2
- data/lib/jpmobile/mobile/unicode_emoticon.rb +2 -2
- data/lib/jpmobile/rack/filter.rb +36 -38
- data/lib/jpmobile/rack/mobile_carrier.rb +8 -10
- data/lib/jpmobile/rack/params_filter.rb +32 -34
- data/lib/jpmobile/rails.rb +17 -4
- data/lib/jpmobile/resolver.rb +2 -3
- data/lib/jpmobile/trans_sid.rb +58 -78
- data/lib/jpmobile/util.rb +0 -17
- data/lib/jpmobile/version.rb +1 -1
- data/lib/tasks/jpmobile_tasks.rake +31 -37
- 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 +57 -57
- data/spec/rack/jpmobile/filter_spec.rb +25 -25
- 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 +10 -10
- 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/rack_helper.rb +0 -1
- data/spec/unit/mail_spec.rb +1 -10
- data/spec/unit/util_spec.rb +42 -56
- data/test/rails/overrides/Gemfile.jpmobile +5 -3
- data/test/rails/overrides/app/controllers/filter_controller.rb +0 -1
- data/test/rails/overrides/app/controllers/filter_controller_base.rb +14 -9
- data/test/rails/overrides/app/controllers/hankaku_input_filter_controller.rb +2 -2
- data/test/rails/overrides/app/controllers/trans_sid_metal_controller.rb +0 -1
- data/test/rails/overrides/app/views/filter/text_template.html.erb +1 -0
- data/test/rails/overrides/spec/controllers/mobile_spec_controller_spec.rb +3 -3
- data/test/rails/overrides/spec/controllers/trans_sid_controller_spec.rb +2 -2
- data/test/rails/overrides/spec/features/filter_spec.rb +10 -9
- data/test/rails/overrides/spec/helpers/helpers_spec.rb +5 -3
- data/test/rails/overrides/spec/requests/docomo_spec.rb +6 -6
- data/test/rails/overrides/spec/requests/emobile_spec.rb +6 -6
- data/test/rails/overrides/spec/requests/pc_spec.rb +3 -3
- data/test/rails/overrides/spec/requests/softbank_emulator_spec.rb +4 -4
- data/test/rails/overrides/spec/requests/template_path_spec.rb +1 -1
- data/test/rails/overrides/spec/requests/trans_sid_spec.rb +7 -9
- metadata +12 -28
- data/lib/jpmobile/hook_action_dispatch.rb +0 -2
- data/lib/jpmobile/rack.rb +0 -14
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require File.join(File.expand_path(File.dirname(__FILE__)), '../../rack_helper.rb')
|
3
3
|
|
4
|
-
describe Jpmobile::
|
4
|
+
describe Jpmobile::Filter do
|
5
5
|
include Rack::Test::Methods
|
6
6
|
include Jpmobile::RackHelper
|
7
7
|
|
@@ -18,7 +18,7 @@ describe Jpmobile::Rack::Filter do
|
|
18
18
|
"REQUEST_METHOD" => "GET",
|
19
19
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
20
20
|
'Content-Type' => 'text/html; charset=utf-8')
|
21
|
-
res = Jpmobile::
|
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")
|
23
23
|
expect(response_body(res)).to eq(@sjis)
|
24
24
|
end
|
@@ -30,7 +30,7 @@ describe Jpmobile::Rack::Filter do
|
|
30
30
|
"REQUEST_METHOD" => "GET",
|
31
31
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
32
32
|
'Content-Type' => 'application/xhtml+xml; charset=utf-8')
|
33
|
-
res = Jpmobile::
|
33
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8))).call(res)
|
34
34
|
expect(res[1]['Content-Type']).to eq("application/xhtml+xml; charset=Shift_JIS")
|
35
35
|
expect(response_body(res)).to eq(@sjis)
|
36
36
|
end
|
@@ -41,7 +41,7 @@ describe Jpmobile::Rack::Filter do
|
|
41
41
|
"REQUEST_METHOD" => "GET",
|
42
42
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
43
43
|
'Content-Type' => 'application/xml; charset=utf-8')
|
44
|
-
res = Jpmobile::
|
44
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8))).call(res)
|
45
45
|
expect(res[1]['Content-Type']).to eq("application/xml; charset=utf-8")
|
46
46
|
expect(response_body(res)).to eq(@utf8)
|
47
47
|
end
|
@@ -52,7 +52,7 @@ describe Jpmobile::Rack::Filter do
|
|
52
52
|
"REQUEST_METHOD" => "GET",
|
53
53
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
54
54
|
'Content-Type' => 'image/jpeg')
|
55
|
-
res = Jpmobile::
|
55
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8))).call(res)
|
56
56
|
expect(res[1]['Content-Type']).to eq("image/jpeg")
|
57
57
|
expect(response_body(res)).to eq(@utf8)
|
58
58
|
end
|
@@ -63,7 +63,7 @@ describe Jpmobile::Rack::Filter do
|
|
63
63
|
"REQUEST_METHOD" => "GET",
|
64
64
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
65
65
|
'Content-Type' => 'application/octet-stream')
|
66
|
-
res = Jpmobile::
|
66
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8))).call(res)
|
67
67
|
expect(res[1]['Content-Type']).to eq("application/octet-stream")
|
68
68
|
expect(response_body(res)).to eq(@utf8)
|
69
69
|
end
|
@@ -74,7 +74,7 @@ describe Jpmobile::Rack::Filter do
|
|
74
74
|
"REQUEST_METHOD" => "GET",
|
75
75
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
76
76
|
'Content-Type' => 'video/mpeg')
|
77
|
-
res = Jpmobile::
|
77
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8))).call(res)
|
78
78
|
expect(res[1]['Content-Type']).to eq("video/mpeg")
|
79
79
|
expect(response_body(res)).to eq(@utf8)
|
80
80
|
end
|
@@ -88,7 +88,7 @@ describe Jpmobile::Rack::Filter do
|
|
88
88
|
"REQUEST_METHOD" => "GET",
|
89
89
|
'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
|
90
90
|
'Content-Type' => 'text/html; charset=utf-8')
|
91
|
-
res = Jpmobile::
|
91
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8))).call(res)
|
92
92
|
expect(res[1]['Content-Type']).to eq("text/html; charset=Shift_JIS")
|
93
93
|
expect(response_body(res)).to eq(@sjis)
|
94
94
|
end
|
@@ -101,7 +101,7 @@ describe Jpmobile::Rack::Filter do
|
|
101
101
|
"REQUEST_METHOD" => "GET",
|
102
102
|
'HTTP_USER_AGENT' => "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
|
103
103
|
'Content-Type' => 'text/html; charset=utf-8')
|
104
|
-
res = Jpmobile::
|
104
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8))).call(res)
|
105
105
|
expect(res[1]['Content-Type']).to eq("text/html; charset=utf-8")
|
106
106
|
expect(response_body(res)).to eq(@utf8)
|
107
107
|
end
|
@@ -113,11 +113,11 @@ describe Jpmobile::Rack::Filter do
|
|
113
113
|
"REQUEST_METHOD" => "GET",
|
114
114
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
115
115
|
'Content-Type' => 'text/html; charset=utf-8')
|
116
|
-
res = Jpmobile::
|
116
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new('<input name="utf8" type="hidden" value="✓" />'))).call(req)
|
117
117
|
expect(res[1]['Content-Type']).to eq("text/html; charset=Shift_JIS")
|
118
118
|
expect(response_body(res)).to eq(" ")
|
119
119
|
|
120
|
-
res = Jpmobile::
|
120
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new('<input name="utf8" type="hidden" value="✓">'))).call(req)
|
121
121
|
expect(res[1]['Content-Type']).to eq("text/html; charset=Shift_JIS")
|
122
122
|
expect(response_body(res)).to eq(" ")
|
123
123
|
end
|
@@ -128,11 +128,11 @@ describe Jpmobile::Rack::Filter do
|
|
128
128
|
"REQUEST_METHOD" => "GET",
|
129
129
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
130
130
|
'Content-Type' => 'text/html; charset=utf-8')
|
131
|
-
res = Jpmobile::
|
131
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new("<input name=\"utf8\" type=\"hidden\" value=\"#{[10003].pack("U")}\" />"))).call(req)
|
132
132
|
expect(res[1]['Content-Type']).to eq("text/html; charset=Shift_JIS")
|
133
133
|
expect(response_body(res)).to eq(" ")
|
134
134
|
|
135
|
-
res = Jpmobile::
|
135
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new("<input name=\"utf8\" type=\"hidden\" value=\"#{[10003].pack("U")}\">"))).call(req)
|
136
136
|
expect(res[1]['Content-Type']).to eq("text/html; charset=Shift_JIS")
|
137
137
|
expect(response_body(res)).to eq(" ")
|
138
138
|
end
|
@@ -161,7 +161,7 @@ describe Jpmobile::Rack::Filter do
|
|
161
161
|
"REQUEST_METHOD" => "GET",
|
162
162
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
163
163
|
'Content-Type' => 'text/html; charset=utf-8')
|
164
|
-
res = Jpmobile::
|
164
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_docomo_cr))).call(res)
|
165
165
|
expect(response_body(res)).to eq(@sjis + @docomo_emoji)
|
166
166
|
end
|
167
167
|
|
@@ -171,7 +171,7 @@ describe Jpmobile::Rack::Filter do
|
|
171
171
|
"REQUEST_METHOD" => "GET",
|
172
172
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
173
173
|
'Content-Type' => 'text/html; charset=utf-8')
|
174
|
-
res = Jpmobile::
|
174
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_docomo_utf8))).call(res)
|
175
175
|
expect(response_body(res)).to eq(@sjis + @docomo_emoji)
|
176
176
|
end
|
177
177
|
|
@@ -181,7 +181,7 @@ describe Jpmobile::Rack::Filter do
|
|
181
181
|
"REQUEST_METHOD" => "GET",
|
182
182
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
183
183
|
'Content-Type' => 'text/html; charset=utf-8')
|
184
|
-
res = Jpmobile::
|
184
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_au_utf8))).call(res)
|
185
185
|
expect(response_body(res)).to eq(@sjis + @docomo_emoji)
|
186
186
|
end
|
187
187
|
|
@@ -191,7 +191,7 @@ describe Jpmobile::Rack::Filter do
|
|
191
191
|
"REQUEST_METHOD" => "GET",
|
192
192
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
193
193
|
'Content-Type' => 'text/html; charset=utf-8')
|
194
|
-
res = Jpmobile::
|
194
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_softbank_utf8))).call(res)
|
195
195
|
expect(response_body(res)).to eq(@sjis + @docomo_emoji)
|
196
196
|
end
|
197
197
|
end
|
@@ -203,7 +203,7 @@ describe Jpmobile::Rack::Filter do
|
|
203
203
|
"REQUEST_METHOD" => "GET",
|
204
204
|
'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
|
205
205
|
'Content-Type' => 'text/html; charset=utf-8')
|
206
|
-
res = Jpmobile::
|
206
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_au_cr))).call(res)
|
207
207
|
expect(response_body(res)).to eq(@sjis + @au_emoji)
|
208
208
|
end
|
209
209
|
|
@@ -213,7 +213,7 @@ describe Jpmobile::Rack::Filter do
|
|
213
213
|
"REQUEST_METHOD" => "GET",
|
214
214
|
'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
|
215
215
|
'Content-Type' => 'text/html; charset=utf-8')
|
216
|
-
res = Jpmobile::
|
216
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_docomo_utf8))).call(res)
|
217
217
|
expect(response_body(res)).to eq(@sjis + @au_emoji)
|
218
218
|
end
|
219
219
|
|
@@ -223,7 +223,7 @@ describe Jpmobile::Rack::Filter do
|
|
223
223
|
"REQUEST_METHOD" => "GET",
|
224
224
|
'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
|
225
225
|
'Content-Type' => 'text/html; charset=utf-8')
|
226
|
-
res = Jpmobile::
|
226
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_au_utf8))).call(res)
|
227
227
|
expect(response_body(res)).to eq(@sjis + @au_emoji)
|
228
228
|
end
|
229
229
|
|
@@ -233,7 +233,7 @@ describe Jpmobile::Rack::Filter do
|
|
233
233
|
"REQUEST_METHOD" => "GET",
|
234
234
|
'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
|
235
235
|
'Content-Type' => 'text/html; charset=utf-8')
|
236
|
-
res = Jpmobile::
|
236
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_softbank_utf8))).call(res)
|
237
237
|
expect(response_body(res)).to eq(@sjis + @au_emoji)
|
238
238
|
end
|
239
239
|
end
|
@@ -245,7 +245,7 @@ describe Jpmobile::Rack::Filter do
|
|
245
245
|
"REQUEST_METHOD" => "GET",
|
246
246
|
'HTTP_USER_AGENT' => "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
|
247
247
|
'Content-Type' => 'text/html; charset=utf-8')
|
248
|
-
res = Jpmobile::
|
248
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_softbank_cr))).call(res)
|
249
249
|
expect(response_body(res)).to eq(@utf8 + @softbank_emoji)
|
250
250
|
end
|
251
251
|
|
@@ -255,7 +255,7 @@ describe Jpmobile::Rack::Filter do
|
|
255
255
|
"REQUEST_METHOD" => "GET",
|
256
256
|
'HTTP_USER_AGENT' => "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
|
257
257
|
'Content-Type' => 'text/html; charset=utf-8')
|
258
|
-
res = Jpmobile::
|
258
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_docomo_utf8))).call(res)
|
259
259
|
expect(response_body(res)).to eq(@utf8 + @softbank_emoji)
|
260
260
|
end
|
261
261
|
|
@@ -265,7 +265,7 @@ describe Jpmobile::Rack::Filter do
|
|
265
265
|
"REQUEST_METHOD" => "GET",
|
266
266
|
'HTTP_USER_AGENT' => "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
|
267
267
|
'Content-Type' => 'text/html; charset=utf-8')
|
268
|
-
res = Jpmobile::
|
268
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_au_utf8))).call(res)
|
269
269
|
expect(response_body(res)).to eq(@utf8 + @softbank_emoji)
|
270
270
|
end
|
271
271
|
|
@@ -275,7 +275,7 @@ describe Jpmobile::Rack::Filter do
|
|
275
275
|
"REQUEST_METHOD" => "GET",
|
276
276
|
'HTTP_USER_AGENT' => "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
|
277
277
|
'Content-Type' => 'text/html; charset=utf-8')
|
278
|
-
res = Jpmobile::
|
278
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::Filter.new(UnitApplication.new(@utf8 + @emoji_softbank_utf8))).call(res)
|
279
279
|
expect(response_body(res)).to eq(@utf8 + @softbank_emoji)
|
280
280
|
end
|
281
281
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require File.join(File.expand_path(File.dirname(__FILE__)), '../../rack_helper.rb')
|
3
3
|
|
4
|
-
describe Jpmobile::
|
4
|
+
describe Jpmobile::MobileCarrier, "iphone" do
|
5
5
|
include Rack::Test::Methods
|
6
6
|
|
7
7
|
context "端末種別で" do
|
@@ -9,7 +9,7 @@ describe Jpmobile::Rack::MobileCarrier, "iphone" do
|
|
9
9
|
res = Rack::MockRequest.env_for(
|
10
10
|
'http://jpmobile-rails.org/',
|
11
11
|
'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')
|
12
|
-
env = Jpmobile::
|
12
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
13
13
|
|
14
14
|
expect(env['rack.jpmobile'].class).to eq(Jpmobile::Mobile::Iphone)
|
15
15
|
expect(env['rack.jpmobile'].position).to be_nil
|
@@ -24,7 +24,7 @@ describe Jpmobile::Rack::MobileCarrier, "iphone" do
|
|
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
26
|
"REMOTE_ADDR"=>"202.179.204.1")
|
27
|
-
env = Jpmobile::
|
27
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
28
28
|
|
29
29
|
expect(env['rack.jpmobile'].valid_ip?).to be_falsey
|
30
30
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require File.join(File.expand_path(File.dirname(__FILE__)), '../../rack_helper.rb')
|
3
3
|
|
4
|
-
describe Jpmobile::
|
4
|
+
describe Jpmobile::MobileCarrier do
|
5
5
|
include Rack::Test::Methods
|
6
6
|
|
7
7
|
[
|
@@ -28,7 +28,7 @@ describe Jpmobile::Rack::MobileCarrier do
|
|
28
28
|
res = Rack::MockRequest.env_for(
|
29
29
|
'http://jpmobile-rails.org/',
|
30
30
|
'HTTP_USER_AGENT' => user_agent)
|
31
|
-
env = Jpmobile::
|
31
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
32
32
|
expect(env['rack.jpmobile'].class).to eq(carrier)
|
33
33
|
end
|
34
34
|
end
|
@@ -37,7 +37,7 @@ describe Jpmobile::Rack::MobileCarrier do
|
|
37
37
|
res = Rack::MockRequest.env_for(
|
38
38
|
'http://jpmobile-rails.org/',
|
39
39
|
'HTTP_USER_AGENT' => 'Googlebot')
|
40
|
-
env = Jpmobile::
|
40
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
41
41
|
expect(env['rack.jpmobile']).to be_nil
|
42
42
|
end
|
43
43
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require File.join(File.expand_path(File.dirname(__FILE__)), '../../rack_helper.rb')
|
3
3
|
|
4
|
-
describe Jpmobile::
|
4
|
+
describe Jpmobile::ParamsFilter do
|
5
5
|
include Rack::Test::Methods
|
6
6
|
include Jpmobile::RackHelper
|
7
7
|
include Jpmobile::Util
|
@@ -37,7 +37,7 @@ describe Jpmobile::Rack::ParamsFilter do
|
|
37
37
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
38
38
|
:input => @form_string)
|
39
39
|
|
40
|
-
res = Jpmobile::
|
40
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(UnitApplication.new)).call(res)
|
41
41
|
req = Rack::Request.new(res[1])
|
42
42
|
expect(req.params.size).to eq(4)
|
43
43
|
|
@@ -58,7 +58,7 @@ describe Jpmobile::Rack::ParamsFilter do
|
|
58
58
|
'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
|
59
59
|
:input => @form_string)
|
60
60
|
|
61
|
-
res = Jpmobile::
|
61
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(UnitApplication.new)).call(res)
|
62
62
|
req = Rack::Request.new(res[1])
|
63
63
|
expect(req.params.size).to eq(4)
|
64
64
|
|
@@ -90,7 +90,7 @@ describe Jpmobile::Rack::ParamsFilter do
|
|
90
90
|
'HTTP_USER_AGENT' => "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
|
91
91
|
:input => @form_string)
|
92
92
|
|
93
|
-
res = Jpmobile::
|
93
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(UnitApplication.new)).call(res)
|
94
94
|
req = Rack::Request.new(res[1])
|
95
95
|
expect(req.params.size).to eq(4)
|
96
96
|
|
@@ -117,7 +117,7 @@ describe Jpmobile::Rack::ParamsFilter do
|
|
117
117
|
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
|
118
118
|
:input => form_string)
|
119
119
|
|
120
|
-
res = Jpmobile::
|
120
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(UnitApplication.new)).call(res)
|
121
121
|
req = Rack::Request.new(res[1])
|
122
122
|
expect(req.params.size).to eq(2)
|
123
123
|
|
@@ -138,7 +138,7 @@ describe Jpmobile::Rack::ParamsFilter do
|
|
138
138
|
'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
|
139
139
|
:input => form_string)
|
140
140
|
|
141
|
-
res = Jpmobile::
|
141
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(UnitApplication.new)).call(res)
|
142
142
|
req = Rack::Request.new(res[1])
|
143
143
|
expect(req.params.size).to eq(2)
|
144
144
|
|
@@ -159,7 +159,7 @@ describe Jpmobile::Rack::ParamsFilter do
|
|
159
159
|
'HTTP_USER_AGENT' => "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
|
160
160
|
:input => form_string)
|
161
161
|
|
162
|
-
res = Jpmobile::
|
162
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(UnitApplication.new)).call(res)
|
163
163
|
req = Rack::Request.new(res[1])
|
164
164
|
expect(req.params.size).to eq(2)
|
165
165
|
|
@@ -182,7 +182,7 @@ describe Jpmobile::Rack::ParamsFilter do
|
|
182
182
|
'HTTP_USER_AGENT' => "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
|
183
183
|
:input => form_string)
|
184
184
|
|
185
|
-
res = Jpmobile::
|
185
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(UnitApplication.new)).call(res)
|
186
186
|
req = Rack::Request.new(res[1])
|
187
187
|
expect(req.params.size).to eq(1)
|
188
188
|
|
@@ -203,7 +203,7 @@ describe Jpmobile::Rack::ParamsFilter do
|
|
203
203
|
'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
|
204
204
|
:input => form_string)
|
205
205
|
|
206
|
-
res = Jpmobile::
|
206
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(UnitApplication.new)).call(res)
|
207
207
|
req = Rack::Request.new(res[1])
|
208
208
|
expect(req.params.size).to eq(0)
|
209
209
|
|
@@ -224,7 +224,7 @@ describe Jpmobile::Rack::ParamsFilter do
|
|
224
224
|
'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
|
225
225
|
:input => form_string)
|
226
226
|
|
227
|
-
res = Jpmobile::
|
227
|
+
res = Jpmobile::MobileCarrier.new(Jpmobile::ParamsFilter.new(UnitApplication.new)).call(res)
|
228
228
|
req = Rack::Request.new(res[1])
|
229
229
|
expect(req.params.size).to eq(0)
|
230
230
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require File.join(File.expand_path(File.dirname(__FILE__)), '../../rack_helper.rb')
|
3
3
|
|
4
|
-
describe Jpmobile::
|
4
|
+
describe Jpmobile::MobileCarrier, "softbank" do
|
5
5
|
include Rack::Test::Methods
|
6
6
|
|
7
7
|
context "端末種別で" do
|
@@ -9,7 +9,7 @@ describe Jpmobile::Rack::MobileCarrier, "softbank" do
|
|
9
9
|
res = Rack::MockRequest.env_for(
|
10
10
|
'http://jpmobile-rails.org/',
|
11
11
|
'HTTP_USER_AGENT' => "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1")
|
12
|
-
env = Jpmobile::
|
12
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
13
13
|
|
14
14
|
expect(env['rack.jpmobile'].class).to eq(Jpmobile::Mobile::Softbank)
|
15
15
|
expect(env['rack.jpmobile'].position).to be_nil
|
@@ -26,7 +26,7 @@ describe Jpmobile::Rack::MobileCarrier, "softbank" do
|
|
26
26
|
'http://jpmobile-rails.org/',
|
27
27
|
'HTTP_USER_AGENT' => "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
|
28
28
|
"HTTP_X_JPHONE_UID" => "aaaaaaaaaaaaaaaa")
|
29
|
-
env = Jpmobile::
|
29
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
30
30
|
|
31
31
|
expect(env['rack.jpmobile'].serial_number).to eq("000000000000000")
|
32
32
|
expect(env['rack.jpmobile'].x_jphone_uid).to eq("aaaaaaaaaaaaaaaa")
|
@@ -40,7 +40,7 @@ describe Jpmobile::Rack::MobileCarrier, "softbank" do
|
|
40
40
|
res = Rack::MockRequest.env_for(
|
41
41
|
'http://jpmobile-rails.org/',
|
42
42
|
'HTTP_USER_AGENT' => "Vodafone/1.0/V903T/TJ001 Browser/VF-Browser/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 Ext-J-Profile/JSCL-1.2.2 Ext-V-Profile/VSCL-2.0.0")
|
43
|
-
env = Jpmobile::
|
43
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
44
44
|
|
45
45
|
expect(env['rack.jpmobile'].class).to eq(Jpmobile::Mobile::Vodafone)
|
46
46
|
expect(env['rack.jpmobile'].position).to be_nil
|
@@ -55,7 +55,7 @@ describe Jpmobile::Rack::MobileCarrier, "softbank" do
|
|
55
55
|
'http://jpmobile-rails.org/',
|
56
56
|
'HTTP_USER_AGENT' => "Vodafone/1.0/V903T/TJ001 Browser/VF-Browser/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 Ext-J-Profile/JSCL-1.2.2 Ext-V-Profile/VSCL-2.0.0",
|
57
57
|
"QUERY_STRING" => "pos=N43.3.18.42E141.21.1.88&geo=wgs84&x-acr=1")
|
58
|
-
env = Jpmobile::
|
58
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
59
59
|
|
60
60
|
expect(env['rack.jpmobile'].position.lat).to be_within(1e-7).of(43.05511667)
|
61
61
|
expect(env['rack.jpmobile'].position.lon).to be_within(1e-7).of(141.3505222)
|
@@ -71,7 +71,7 @@ describe Jpmobile::Rack::MobileCarrier, "softbank" do
|
|
71
71
|
'http://jpmobile-rails.org/',
|
72
72
|
'HTTP_USER_AGENT' => "Vodafone/1.0/V903T/TJ001 Browser/VF-Browser/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 Ext-J-Profile/JSCL-1.2.2 Ext-V-Profile/VSCL-2.0.0",
|
73
73
|
"REMOTE_ADDR"=>"210.146.7.199")
|
74
|
-
env = Jpmobile::
|
74
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
75
75
|
|
76
76
|
expect(env['rack.jpmobile'].valid_ip?).to be_truthy
|
77
77
|
end
|
@@ -81,7 +81,7 @@ describe Jpmobile::Rack::MobileCarrier, "softbank" do
|
|
81
81
|
'http://jpmobile-rails.org/',
|
82
82
|
'HTTP_USER_AGENT' => "Vodafone/1.0/V903T/TJ001 Browser/VF-Browser/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 Ext-J-Profile/JSCL-1.2.2 Ext-V-Profile/VSCL-2.0.0",
|
83
83
|
"REMOTE_ADDR"=>"127.0.0.1")
|
84
|
-
env = Jpmobile::
|
84
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
85
85
|
|
86
86
|
expect(env['rack.jpmobile'].valid_ip?).to be_falsey
|
87
87
|
end
|
@@ -94,7 +94,7 @@ describe Jpmobile::Rack::MobileCarrier, "softbank" do
|
|
94
94
|
'HTTP_USER_AGENT' => "Vodafone/1.0/V903T/TJ001 Browser/VF-Browser/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 Ext-J-Profile/JSCL-1.2.2 Ext-V-Profile/VSCL-2.0.0",
|
95
95
|
"HTTP_X_JPHONE_DISPLAY"=>"240*320",
|
96
96
|
"HTTP_X_JPHONE_COLOR"=>"C262144")
|
97
|
-
env = Jpmobile::
|
97
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
98
98
|
|
99
99
|
expect(env['rack.jpmobile'].display.width).to eq(240)
|
100
100
|
expect(env['rack.jpmobile'].display.height).to eq(320)
|
@@ -108,7 +108,7 @@ describe Jpmobile::Rack::MobileCarrier, "softbank" do
|
|
108
108
|
res = Rack::MockRequest.env_for(
|
109
109
|
'http://jpmobile-rails.org/',
|
110
110
|
'HTTP_USER_AGENT' => "Vodafone/1.0/V903T/TJ001 Browser/VF-Browser/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 Ext-J-Profile/JSCL-1.2.2 Ext-V-Profile/VSCL-2.0.0")
|
111
|
-
env = Jpmobile::
|
111
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
112
112
|
|
113
113
|
expect(env['rack.jpmobile'].display.width).to be_nil
|
114
114
|
expect(env['rack.jpmobile'].display.height).to be_nil
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require File.join(File.expand_path(File.dirname(__FILE__)), '../../rack_helper.rb')
|
3
3
|
|
4
|
-
describe Jpmobile::
|
4
|
+
describe Jpmobile::MobileCarrier, "willcom" do
|
5
5
|
include Rack::Test::Methods
|
6
6
|
|
7
7
|
context "端末種別で" do
|
@@ -9,7 +9,7 @@ describe Jpmobile::Rack::MobileCarrier, "willcom" do
|
|
9
9
|
res = Rack::MockRequest.env_for(
|
10
10
|
'http://jpmobile-rails.org/',
|
11
11
|
'HTTP_USER_AGENT' => "Mozilla/3.0(WILLCOM;KYOCERA/WX310K/2;1.2.2.16.000000/0.1/C100) Opera 7.0")
|
12
|
-
env = Jpmobile::
|
12
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
13
13
|
|
14
14
|
expect(env['rack.jpmobile'].class).to eq(Jpmobile::Mobile::Willcom)
|
15
15
|
expect(env['rack.jpmobile'].position).to be_nil
|
@@ -21,7 +21,7 @@ describe Jpmobile::Rack::MobileCarrier, "willcom" do
|
|
21
21
|
res = Rack::MockRequest.env_for(
|
22
22
|
'http://jpmobile-rails.org/',
|
23
23
|
'HTTP_USER_AGENT' => "Mozilla/3.0(DDIPOCKET;KYOCERA/AH-K3001V/1.8.2.71.000000/0.1/C100) Opera 7.0")
|
24
|
-
env = Jpmobile::
|
24
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
25
25
|
|
26
26
|
expect(env['rack.jpmobile'].class).to eq(Jpmobile::Mobile::Ddipocket)
|
27
27
|
expect(env['rack.jpmobile'].position).to be_nil
|
@@ -36,7 +36,7 @@ describe Jpmobile::Rack::MobileCarrier, "willcom" do
|
|
36
36
|
'http://jpmobile-rails.org/',
|
37
37
|
'HTTP_USER_AGENT' => "Mozilla/3.0(WILLCOM;KYOCERA/WX310K/2;1.2.2.16.000000/0.1/C100) Opera 7.0",
|
38
38
|
"QUERY_STRING" => "pos=N43.04.34.049E141.21.03.279")
|
39
|
-
env = Jpmobile::
|
39
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
40
40
|
|
41
41
|
expect(env['rack.jpmobile'].position.lat).to be_within(1e-4).of(43.078568)
|
42
42
|
expect(env['rack.jpmobile'].position.lon).to be_within(1e-4).of(141.347223)
|
@@ -49,7 +49,7 @@ describe Jpmobile::Rack::MobileCarrier, "willcom" do
|
|
49
49
|
'http://jpmobile-rails.org/',
|
50
50
|
'HTTP_USER_AGENT' => "Mozilla/3.0(WILLCOM;KYOCERA/WX310K/2;1.2.2.16.000000/0.1/C100) Opera 7.0",
|
51
51
|
"REMOTE_ADDR" => "61.198.142.1")
|
52
|
-
env = Jpmobile::
|
52
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
53
53
|
|
54
54
|
expect(env['rack.jpmobile'].valid_ip?).to be_truthy
|
55
55
|
end
|
@@ -59,7 +59,7 @@ describe Jpmobile::Rack::MobileCarrier, "willcom" do
|
|
59
59
|
'http://jpmobile-rails.org/',
|
60
60
|
'HTTP_USER_AGENT' => "Mozilla/3.0(WILLCOM;KYOCERA/WX310K/2;1.2.2.16.000000/0.1/C100) Opera 7.0",
|
61
61
|
"REMOTE_ADDR" => "127.0.0.1")
|
62
|
-
env = Jpmobile::
|
62
|
+
env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
|
63
63
|
|
64
64
|
expect(env['rack.jpmobile'].valid_ip?).to be_falsey
|
65
65
|
end
|