jpmobile 5.0.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -3
- data/.rubocop.yml +123 -0
- data/CONTRIBUTING.md +16 -14
- data/Gemfile +6 -0
- data/Gemfile.lock +198 -0
- data/README.md +409 -0
- data/Rakefile +9 -9
- data/circle.yml +14 -0
- data/jpmobile.gemspec +9 -10
- data/lib/jpmobile.rb +6 -5
- data/lib/jpmobile/datum_conv.rb +35 -35
- data/lib/jpmobile/docomo_guid.rb +7 -8
- data/lib/jpmobile/email.rb +12 -12
- data/lib/jpmobile/emoticon.rb +85 -76
- data/lib/jpmobile/emoticon/au.rb +1284 -1284
- data/lib/jpmobile/emoticon/conversion_table.rb +3905 -3906
- data/lib/jpmobile/emoticon/docomo.rb +252 -252
- data/lib/jpmobile/emoticon/google.rb +9 -9
- data/lib/jpmobile/emoticon/softbank.rb +471 -471
- data/lib/jpmobile/emoticon/unicode.rb +9 -9
- data/lib/jpmobile/emoticon/z_combine.rb +20 -23
- data/lib/jpmobile/encoding.rb +1 -1
- data/lib/jpmobile/fallback_view_selector.rb +2 -3
- data/lib/jpmobile/filter.rb +44 -47
- data/lib/jpmobile/helpers.rb +38 -38
- data/lib/jpmobile/hook_action_view.rb +7 -7
- data/lib/jpmobile/hook_test_request.rb +0 -1
- data/lib/jpmobile/lookup_context.rb +1 -2
- data/lib/jpmobile/mail.rb +156 -134
- data/lib/jpmobile/mailer.rb +4 -4
- data/lib/jpmobile/mobile/abstract_mobile.rb +62 -36
- data/lib/jpmobile/mobile/android.rb +0 -1
- data/lib/jpmobile/mobile/android_tablet.rb +0 -1
- data/lib/jpmobile/mobile/au.rb +40 -28
- data/lib/jpmobile/mobile/black_berry.rb +0 -1
- data/lib/jpmobile/mobile/ddipocket.rb +1 -2
- data/lib/jpmobile/mobile/docomo.rb +47 -36
- data/lib/jpmobile/mobile/emobile.rb +1 -2
- data/lib/jpmobile/mobile/google_emoticon.rb +1 -1
- data/lib/jpmobile/mobile/ipad.rb +0 -1
- data/lib/jpmobile/mobile/iphone.rb +0 -1
- data/lib/jpmobile/mobile/smart_phone.rb +0 -1
- data/lib/jpmobile/mobile/softbank.rb +24 -20
- data/lib/jpmobile/mobile/tablet.rb +0 -1
- data/lib/jpmobile/mobile/unicode_emoticon.rb +15 -15
- data/lib/jpmobile/mobile/vodafone.rb +0 -1
- data/lib/jpmobile/mobile/willcom.rb +7 -7
- data/lib/jpmobile/mobile/windows_phone.rb +0 -1
- data/lib/jpmobile/path_set.rb +1 -1
- data/lib/jpmobile/position.rb +30 -14
- data/lib/jpmobile/rack/filter.rb +4 -4
- data/lib/jpmobile/rack/mobile_carrier.rb +0 -1
- data/lib/jpmobile/rack/params_filter.rb +7 -6
- data/lib/jpmobile/rails.rb +3 -4
- data/lib/jpmobile/request_with_mobile.rb +9 -6
- data/lib/jpmobile/resolver.rb +23 -17
- data/lib/jpmobile/session/active_record_store.rb +7 -9
- data/lib/jpmobile/session/mem_cache_store.rb +7 -9
- data/lib/jpmobile/sinatra.rb +1 -1
- data/lib/jpmobile/trans_sid.rb +15 -20
- data/lib/jpmobile/util.rb +61 -77
- data/lib/jpmobile/version.rb +1 -1
- data/lib/tasks/jpmobile_tasks.rake +35 -28
- data/spec/rack/jpmobile/android_spec.rb +5 -5
- data/spec/rack/jpmobile/au_spec.rb +74 -59
- data/spec/rack/jpmobile/black_berry_spec.rb +5 -5
- data/spec/rack/jpmobile/docomo_spec.rb +77 -64
- data/spec/rack/jpmobile/emoticon_spec.rb +137 -121
- data/spec/rack/jpmobile/filter_spec.rb +149 -128
- data/spec/rack/jpmobile/iphone_spec.rb +9 -8
- data/spec/rack/jpmobile/mobile_by_ua_spec.rb +22 -21
- data/spec/rack/jpmobile/params_filter_spec.rb +104 -96
- data/spec/rack/jpmobile/softbank_spec.rb +49 -42
- data/spec/rack/jpmobile/willcom_spec.rb +22 -18
- data/spec/rack/jpmobile/windows_phone.rb +5 -5
- data/spec/rack_helper.rb +9 -8
- data/spec/spec_helper.rb +5 -6
- data/spec/unit/decorated_mail_spec.rb +8 -9
- data/spec/unit/email_spec.rb +44 -44
- data/spec/unit/emoticon_spec.rb +57 -58
- data/spec/unit/encoding_spec.rb +35 -36
- data/spec/unit/is_carrier_spec.rb +49 -49
- data/spec/unit/mail_spec.rb +153 -143
- data/spec/unit/mobile/iphone_spec.rb +6 -7
- data/spec/unit/receive_mail_spec.rb +172 -173
- data/spec/unit/spec_helper.rb +6 -6
- data/spec/unit/util_spec.rb +125 -46
- data/spec/unit/valid_ip_spec.rb +35 -35
- data/spec/unit/variants_spec.rb +18 -19
- data/test/rails/overrides/Gemfile +54 -0
- data/test/rails/overrides/Gemfile.jpmobile +1 -2
- data/test/rails/overrides/app/controllers/admin/top_controller.rb +1 -1
- data/test/rails/overrides/app/controllers/docomo_guid_base_controller.rb +1 -1
- data/test/rails/overrides/app/controllers/filter_controller_base.rb +14 -6
- data/test/rails/overrides/app/controllers/hankaku_input_filter_controller.rb +1 -1
- data/test/rails/overrides/app/controllers/mobile_spec_controller.rb +1 -1
- data/test/rails/overrides/app/controllers/template_path_controller.rb +1 -2
- data/test/rails/overrides/app/controllers/trans_sid_base_controller.rb +18 -10
- data/test/rails/overrides/app/controllers/trans_sid_metal_controller.rb +0 -1
- data/test/rails/overrides/app/mailers/decorated_mailer.rb +3 -4
- data/test/rails/overrides/app/mailers/mobile_mailer.rb +5 -6
- data/test/rails/overrides/app/mailers/normal_mailer.rb +2 -3
- data/test/rails/overrides/autotest/discover.rb +2 -2
- data/test/rails/overrides/config/initializers/jpmobile_generator.rb +2 -2
- data/test/rails/overrides/config/routes.rb +95 -2
- data/test/rails/overrides/db/migrate/001_add_sessions_table.rb +2 -2
- data/test/rails/overrides/db/migrate/20100824062306_create_users.rb +1 -1
- data/test/rails/overrides/spec/controllers/docomo_guid_spec.rb +24 -25
- data/test/rails/overrides/spec/controllers/helpers_spec.rb +88 -88
- data/test/rails/overrides/spec/controllers/mobile_spec_controller_spec.rb +9 -9
- data/test/rails/overrides/spec/controllers/template_path_spec.rb +19 -19
- data/test/rails/overrides/spec/features/admin/top_spec.rb +7 -7
- data/test/rails/overrides/spec/features/filter_spec.rb +101 -102
- data/test/rails/overrides/spec/helpers/helpers_spec.rb +4 -4
- data/test/rails/overrides/spec/mailers/decorated_mailer_spec.rb +12 -12
- data/test/rails/overrides/spec/mailers/mobile_mailer_spec.rb +209 -194
- data/test/rails/overrides/spec/mailers/normal_mailer_spec.rb +10 -10
- data/test/rails/overrides/spec/rails_helper.rb +1 -1
- data/test/rails/overrides/spec/requests/docomo_spec.rb +13 -13
- data/test/rails/overrides/spec/requests/emobile_spec.rb +19 -19
- data/test/rails/overrides/spec/requests/pc_spec.rb +6 -6
- data/test/rails/overrides/spec/requests/softbank_emulator_spec.rb +6 -6
- data/test/rails/overrides/spec/requests/template_path_spec.rb +60 -60
- data/test/rails/overrides/spec/requests/trans_sid_spec.rb +89 -89
- data/test/sinatra/test/filter_test.rb +10 -11
- data/tools/e4u_conv.rb +0 -1
- metadata +18 -14
- data/README +0 -0
- data/README.rdoc +0 -308
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe LinksController, :
|
3
|
+
describe LinksController, type: :controller do
|
4
4
|
render_views
|
5
5
|
|
6
6
|
# 文字列 +str+ 中に含まれるリンクについて、
|
@@ -8,194 +8,194 @@ describe LinksController, :type => :controller do
|
|
8
8
|
# の3要素からなる配列の配列で返す。
|
9
9
|
def get_href_and_texts(str)
|
10
10
|
results = []
|
11
|
-
(Nokogiri::HTML.parse(str)/
|
12
|
-
path, query = link[
|
11
|
+
(Nokogiri::HTML.parse(str) / 'a').each do |link|
|
12
|
+
path, query = link['href'].split(/\?/, 2)
|
13
13
|
params = query.nil? ? nil : Rack::Utils.parse_query(query)
|
14
14
|
results << [link.inner_html, link.attributes, path, params]
|
15
15
|
end
|
16
|
-
|
16
|
+
results
|
17
17
|
end
|
18
18
|
|
19
|
-
it
|
20
|
-
request.user_agent =
|
19
|
+
it 'get_position_link_to_がエラー無く終わるか' do
|
20
|
+
request.user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)'
|
21
21
|
expect {
|
22
22
|
get :show_all
|
23
23
|
}.not_to raise_error
|
24
24
|
end
|
25
25
|
|
26
|
-
context
|
27
|
-
it
|
28
|
-
request.user_agent =
|
26
|
+
context 'docomo で' do
|
27
|
+
it 'get_position_link_to が正常に表示されること' do
|
28
|
+
request.user_agent = 'DoCoMo/2.0 SH903i(c100;TB;W24H16)'
|
29
29
|
get :link
|
30
30
|
links = get_href_and_texts(response.body)
|
31
31
|
|
32
32
|
expect(links.size).to eq(1)
|
33
|
-
text,
|
34
|
-
expect(text).to eq(
|
35
|
-
expect(path).to eq(
|
33
|
+
text, _, path, = links.first
|
34
|
+
expect(text).to eq('STRING')
|
35
|
+
expect(path).to eq('http://test.host/links/link')
|
36
36
|
expect(response.body).to match(/lcs>/)
|
37
37
|
end
|
38
38
|
|
39
|
-
it
|
40
|
-
request.user_agent =
|
39
|
+
it 'docomo_utn_link_to が正しく出力されること' do
|
40
|
+
request.user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)'
|
41
41
|
get :docomo_utn
|
42
42
|
links = get_href_and_texts(response.body)
|
43
43
|
|
44
44
|
expect(links.size).to eq(1)
|
45
|
-
text,
|
46
|
-
expect(text).to eq(
|
47
|
-
expect(path).to eq(
|
45
|
+
text, _, path, = links.first
|
46
|
+
expect(text).to eq('STRING')
|
47
|
+
expect(path).to eq('http://test.host/links/docomo_utn')
|
48
48
|
expect(response.body).to match(/utn>/)
|
49
49
|
end
|
50
50
|
|
51
|
-
it
|
52
|
-
request.user_agent =
|
51
|
+
it 'オープンiエリア取得用のリンクが正しく出力されること' do
|
52
|
+
request.user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)'
|
53
53
|
get :docomo_openiarea
|
54
54
|
links = get_href_and_texts(response.body)
|
55
55
|
|
56
56
|
expect(links.size).to eq(1)
|
57
|
-
text,
|
58
|
-
expect(text).to eq(
|
59
|
-
expect(path).to eq(
|
60
|
-
expect(params[
|
61
|
-
expect(params[
|
62
|
-
expect(params[
|
63
|
-
expect(params[
|
57
|
+
text, _, path, params = links.first
|
58
|
+
expect(text).to eq('STRING')
|
59
|
+
expect(path).to eq('http://w1m.docomo.ne.jp/cp/iarea')
|
60
|
+
expect(params['ecode']).to eq('OPENAREACODE')
|
61
|
+
expect(params['msn']).to eq('OPENAREAKEY')
|
62
|
+
expect(params['posinfo']).to eq('1')
|
63
|
+
expect(params['nl']).to eq('http://test.host/links/docomo_openiarea')
|
64
64
|
end
|
65
65
|
|
66
|
-
it
|
67
|
-
request.user_agent =
|
66
|
+
it 'GPS取得用のリンクが正しく出力されること' do
|
67
|
+
request.user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)'
|
68
68
|
get :docomo_foma_gps
|
69
69
|
links = get_href_and_texts(response.body)
|
70
70
|
|
71
71
|
expect(links.size).to eq(1)
|
72
|
-
text,
|
73
|
-
expect(text).to eq(
|
74
|
-
expect(path).to eq(
|
72
|
+
text, _, path, = links.first
|
73
|
+
expect(text).to eq('STRING')
|
74
|
+
expect(path).to eq('http://test.host/links/docomo_foma_gps')
|
75
75
|
expect(response.body).to match(/lcs>/)
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
context
|
79
|
+
context 'au で' do
|
80
80
|
# get_position_link_to(自動判別), au, location only
|
81
81
|
def test_get_position_link_to_au_location_only
|
82
|
-
request.user_agent =
|
82
|
+
request.user_agent = 'KDDI-SN26 UP.Browser/6.2.0.6.2 (GUI) MMP/2.0'
|
83
83
|
get :link
|
84
84
|
links = get_href_and_texts(response.body)
|
85
85
|
assert_equal(1, links.size)
|
86
|
-
text,
|
87
|
-
assert_equal(
|
88
|
-
assert_equal(
|
89
|
-
assert_equal(
|
86
|
+
text, _, path, params = links.first
|
87
|
+
assert_equal('STRING', text)
|
88
|
+
assert_equal('device:location', path)
|
89
|
+
assert_equal('http://test.host/links/link', params['url'])
|
90
90
|
end
|
91
91
|
|
92
92
|
# get_position_link_to(自動判別), au, gps
|
93
93
|
def test_get_position_link_to_au_gps
|
94
|
-
request.user_agent =
|
94
|
+
request.user_agent = 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0'
|
95
95
|
get :link
|
96
96
|
links = get_href_and_texts(response.body)
|
97
97
|
assert_equal(1, links.size)
|
98
|
-
text,
|
99
|
-
assert_equal(
|
100
|
-
assert_equal(
|
101
|
-
assert_equal(
|
102
|
-
assert_equal(
|
103
|
-
assert_equal(
|
104
|
-
assert_equal(
|
105
|
-
assert_equal(
|
106
|
-
assert_equal(
|
98
|
+
text, _, path, params = links.first
|
99
|
+
assert_equal('STRING', text)
|
100
|
+
assert_equal('device:gpsone', path)
|
101
|
+
assert_equal('http://test.host/links/link', params['url'])
|
102
|
+
assert_equal('0', params['number'])
|
103
|
+
assert_equal('0', params['acry'])
|
104
|
+
assert_equal('1', params['ver'])
|
105
|
+
assert_equal('0', params['unit'])
|
106
|
+
assert_equal('0', params['datum'])
|
107
107
|
end
|
108
108
|
|
109
109
|
# au簡易位置情報取得用のリンクが正しく出力されるか。
|
110
110
|
def test_au_location_link_to
|
111
|
-
request.user_agent =
|
111
|
+
request.user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)'
|
112
112
|
get :au_location
|
113
113
|
links = get_href_and_texts(response.body)
|
114
114
|
assert_equal(1, links.size)
|
115
|
-
text,
|
116
|
-
assert_equal(
|
117
|
-
assert_equal(
|
118
|
-
assert_equal(
|
115
|
+
text, _, path, params = links.first
|
116
|
+
assert_equal('STRING', text)
|
117
|
+
assert_equal('device:location', path)
|
118
|
+
assert_equal('http://test.host/links/au_location', params['url'])
|
119
119
|
end
|
120
120
|
|
121
121
|
# au GPS位置情報取得用のリンクが正しく出力されるか。
|
122
122
|
def test_au_gps_link_to
|
123
|
-
request.user_agent =
|
123
|
+
request.user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)'
|
124
124
|
get :au_gps
|
125
125
|
links = get_href_and_texts(response.body)
|
126
126
|
assert_equal(1, links.size)
|
127
|
-
text,
|
128
|
-
assert_equal(
|
129
|
-
assert_equal(
|
130
|
-
assert_equal(
|
131
|
-
assert_equal(
|
132
|
-
assert_equal(
|
133
|
-
assert_equal(
|
134
|
-
assert_equal(
|
135
|
-
assert_equal(
|
127
|
+
text, _, path, params = links.first
|
128
|
+
assert_equal('STRING', text)
|
129
|
+
assert_equal('device:gpsone', path)
|
130
|
+
assert_equal('http://test.host/links/au_gps', params['url'])
|
131
|
+
assert_equal('0', params['number'])
|
132
|
+
assert_equal('0', params['acry'])
|
133
|
+
assert_equal('1', params['ver'])
|
134
|
+
assert_equal('0', params['unit'])
|
135
|
+
assert_equal('0', params['datum'])
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
-
context
|
139
|
+
context 'softbank で' do
|
140
140
|
# get_position_link_to(自動判別), Vodafone
|
141
141
|
def test_get_position_link_to_vodafone
|
142
|
-
request.user_agent =
|
142
|
+
request.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'
|
143
143
|
get :link
|
144
144
|
links = get_href_and_texts(response.body)
|
145
145
|
assert_equal(1, links.size)
|
146
|
-
text,
|
147
|
-
assert_equal(
|
148
|
-
assert_equal(
|
146
|
+
text, _, path, = links.first
|
147
|
+
assert_equal('STRING', text)
|
148
|
+
assert_equal('location:auto', path)
|
149
149
|
end
|
150
150
|
|
151
151
|
# get_position_link_to(自動判別), Softbank
|
152
152
|
def test_get_position_link_to_softbank
|
153
|
-
request.user_agent =
|
153
|
+
request.user_agent = 'SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1'
|
154
154
|
get :link
|
155
155
|
links = get_href_and_texts(response.body)
|
156
156
|
assert_equal(1, links.size)
|
157
|
-
text,
|
158
|
-
assert_equal(
|
159
|
-
assert_equal(
|
157
|
+
text, _, path, = links.first
|
158
|
+
assert_equal('STRING', text)
|
159
|
+
assert_equal('location:auto', path)
|
160
160
|
end
|
161
161
|
|
162
162
|
# Softbank 3G 位置情報取得用のリンクが正しく出力されるか。
|
163
163
|
def test_softbank_location_link_to
|
164
|
-
request.user_agent =
|
164
|
+
request.user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)'
|
165
165
|
get :softbank_location
|
166
166
|
links = get_href_and_texts(response.body)
|
167
167
|
assert_equal(1, links.size)
|
168
|
-
text,
|
169
|
-
assert_equal(
|
170
|
-
assert_equal(
|
168
|
+
text, _, path, = links.first
|
169
|
+
assert_equal('STRING', text)
|
170
|
+
assert_equal('location:auto', path)
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
174
|
-
context
|
174
|
+
context 'willcom で' do
|
175
175
|
# get_position_link_to(自動判別), Willcom
|
176
176
|
def test_get_position_link_to_willcom
|
177
|
-
request.user_agent =
|
177
|
+
request.user_agent = 'Mozilla/3.0(WILLCOM;KYOCERA/WX310K/2;1.2.2.16.000000/0.1/C100) Opera 7.0'
|
178
178
|
get :link
|
179
179
|
links = get_href_and_texts(response.body)
|
180
180
|
assert_equal(1, links.size)
|
181
|
-
text,
|
182
|
-
assert_equal(
|
183
|
-
assert_equal(
|
184
|
-
assert_equal(
|
185
|
-
assert_equal(
|
181
|
+
text, _, path, params = links.first
|
182
|
+
assert_equal('STRING', text)
|
183
|
+
assert_equal('http://location.request/dummy.cgi', path)
|
184
|
+
assert_equal('http://test.host/links/link', params['my'])
|
185
|
+
assert_equal('$location', params['pos'])
|
186
186
|
end
|
187
187
|
|
188
188
|
# Willcom 位置情報取得用のリンクが正しく出力されるか。
|
189
189
|
def test_willcom_location_link_to
|
190
|
-
request.user_agent =
|
190
|
+
request.user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)'
|
191
191
|
get :willcom_location
|
192
192
|
links = get_href_and_texts(response.body)
|
193
193
|
assert_equal(1, links.size)
|
194
|
-
text,
|
195
|
-
assert_equal(
|
196
|
-
assert_equal(
|
197
|
-
assert_equal(
|
198
|
-
assert_equal(
|
194
|
+
text, _, path, params = links.first
|
195
|
+
assert_equal('STRING', text)
|
196
|
+
assert_equal('http://location.request/dummy.cgi', path)
|
197
|
+
assert_equal('http://test.host/links/willcom_location', params['my'])
|
198
|
+
assert_equal('$location', params['pos'])
|
199
199
|
end
|
200
200
|
end
|
201
201
|
end
|
@@ -5,7 +5,7 @@ describe MobileSpecController, type: :controller do
|
|
5
5
|
|
6
6
|
describe "GET 'index'" do
|
7
7
|
context 'PC access' do
|
8
|
-
it
|
8
|
+
it 'should be successful' do
|
9
9
|
request.user_agent = 'Mozilla'
|
10
10
|
get 'index'
|
11
11
|
|
@@ -16,8 +16,8 @@ describe MobileSpecController, type: :controller do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
context 'mobile access' do
|
19
|
-
it
|
20
|
-
request.user_agent =
|
19
|
+
it 'should be successful' do
|
20
|
+
request.user_agent = 'DoCoMo/2.0 SH902i(c100;TB;W24H12)'
|
21
21
|
get 'index'
|
22
22
|
expect(response).to be_success
|
23
23
|
expect(response.body).to match(/RailsRoot mobile/)
|
@@ -29,7 +29,7 @@ describe MobileSpecController, type: :controller do
|
|
29
29
|
|
30
30
|
describe "GET 'file_render'" do
|
31
31
|
context 'PC access' do
|
32
|
-
it
|
32
|
+
it 'should be successful' do
|
33
33
|
request.user_agent = 'Mozilla'
|
34
34
|
get 'file_render'
|
35
35
|
|
@@ -40,8 +40,8 @@ describe MobileSpecController, type: :controller do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
context 'mobile access' do
|
43
|
-
it
|
44
|
-
request.user_agent =
|
43
|
+
it 'should be successful' do
|
44
|
+
request.user_agent = 'DoCoMo/2.0 SH902i(c100;TB;W24H12)'
|
45
45
|
get 'file_render'
|
46
46
|
|
47
47
|
expect(response).to be_success
|
@@ -63,7 +63,7 @@ describe MobileSpecController, type: :controller do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
context 'PC access' do
|
66
|
-
it
|
66
|
+
it 'should be successful' do
|
67
67
|
request.user_agent = 'Mozilla'
|
68
68
|
get 'no_mobile'
|
69
69
|
|
@@ -73,8 +73,8 @@ describe MobileSpecController, type: :controller do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
context 'mobile access' do
|
76
|
-
it
|
77
|
-
request.user_agent =
|
76
|
+
it 'should be successful' do
|
77
|
+
request.user_agent = 'DoCoMo/2.0 SH902i(c100;TB;W24H12)'
|
78
78
|
get 'no_mobile'
|
79
79
|
|
80
80
|
expect(response).to be_success
|
@@ -1,85 +1,85 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe TemplatePathController, :
|
3
|
+
describe TemplatePathController, type: :controller do
|
4
4
|
before do
|
5
5
|
request.user_agent = user_agent
|
6
6
|
end
|
7
7
|
|
8
|
-
describe
|
8
|
+
describe 'DoCoMo SH902i からのアクセス' do
|
9
9
|
let(:user_agent) do
|
10
|
-
|
10
|
+
'DoCoMo/2.0 SH902i(c100;TB;W24H12)'
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'テンプレートの探索順が正しいこと' do
|
14
14
|
get :index
|
15
15
|
|
16
|
-
expect(controller.lookup_context.mobile).to eq([
|
16
|
+
expect(controller.lookup_context.mobile).to eq(%w[mobile_docomo mobile])
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
describe
|
20
|
+
describe 'au CA32 からのアクセス' do
|
21
21
|
let(:user_agent) do
|
22
|
-
|
22
|
+
'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0'
|
23
23
|
end
|
24
24
|
it 'テンプレートの探索順が正しいこと' do
|
25
25
|
get :index
|
26
26
|
|
27
|
-
expect(controller.lookup_context.mobile).to eq([
|
27
|
+
expect(controller.lookup_context.mobile).to eq(%w[mobile_au mobile])
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
describe
|
31
|
+
describe 'Vodafone V903T からのアクセス' do
|
32
32
|
let(:user_agent) do
|
33
|
-
|
33
|
+
'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'
|
34
34
|
end
|
35
35
|
it 'テンプレートの探索順が正しいこと' do
|
36
36
|
get :index
|
37
37
|
|
38
|
-
expect(controller.lookup_context.mobile).to eq([
|
38
|
+
expect(controller.lookup_context.mobile).to eq(%w[mobile_vodafone mobile_softbank mobile])
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
describe
|
42
|
+
describe 'SoftBank 910T からのアクセス' do
|
43
43
|
let(:user_agent) do
|
44
|
-
|
44
|
+
'SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1'
|
45
45
|
end
|
46
46
|
it 'テンプレートの探索順が正しいこと' do
|
47
47
|
get :index
|
48
48
|
|
49
|
-
expect(controller.lookup_context.mobile).to eq([
|
49
|
+
expect(controller.lookup_context.mobile).to eq(%w[mobile_softbank mobile])
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
describe
|
53
|
+
describe 'iPhone からのアクセス' do
|
54
54
|
let(:user_agent) do
|
55
55
|
'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'
|
56
56
|
end
|
57
57
|
it 'テンプレートの探索順が正しいこと' do
|
58
58
|
get :index
|
59
59
|
|
60
|
-
expect(controller.lookup_context.mobile).to eq([
|
60
|
+
expect(controller.lookup_context.mobile).to eq(%w[smart_phone_iphone smart_phone])
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
describe
|
64
|
+
describe 'Android からのアクセス' do
|
65
65
|
let(:user_agent) do
|
66
66
|
'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'
|
67
67
|
end
|
68
68
|
it 'テンプレートの探索順が正しいこと' do
|
69
69
|
get :index
|
70
70
|
|
71
|
-
expect(controller.lookup_context.mobile).to eq([
|
71
|
+
expect(controller.lookup_context.mobile).to eq(%w[smart_phone_android smart_phone])
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
describe
|
75
|
+
describe 'Windows Phone からのアクセス' do
|
76
76
|
let(:user_agent) do
|
77
77
|
'Mozilla/4.0 (Compatible; MSIE 6.0; Windows NT 5.1 T-01A_6.5; Windows Phone 6.5)'
|
78
78
|
end
|
79
79
|
it 'テンプレートの探索順が正しいこと' do
|
80
80
|
get :index
|
81
81
|
|
82
|
-
expect(controller.lookup_context.mobile).to eq([
|
82
|
+
expect(controller.lookup_context.mobile).to eq(%w[smart_phone_windows_phone smart_phone])
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|