jpmobile 5.0.0 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -3
  3. data/.rubocop.yml +123 -0
  4. data/CONTRIBUTING.md +16 -14
  5. data/Gemfile +6 -0
  6. data/Gemfile.lock +198 -0
  7. data/README.md +409 -0
  8. data/Rakefile +9 -9
  9. data/circle.yml +14 -0
  10. data/jpmobile.gemspec +9 -10
  11. data/lib/jpmobile.rb +6 -5
  12. data/lib/jpmobile/datum_conv.rb +35 -35
  13. data/lib/jpmobile/docomo_guid.rb +7 -8
  14. data/lib/jpmobile/email.rb +12 -12
  15. data/lib/jpmobile/emoticon.rb +85 -76
  16. data/lib/jpmobile/emoticon/au.rb +1284 -1284
  17. data/lib/jpmobile/emoticon/conversion_table.rb +3905 -3906
  18. data/lib/jpmobile/emoticon/docomo.rb +252 -252
  19. data/lib/jpmobile/emoticon/google.rb +9 -9
  20. data/lib/jpmobile/emoticon/softbank.rb +471 -471
  21. data/lib/jpmobile/emoticon/unicode.rb +9 -9
  22. data/lib/jpmobile/emoticon/z_combine.rb +20 -23
  23. data/lib/jpmobile/encoding.rb +1 -1
  24. data/lib/jpmobile/fallback_view_selector.rb +2 -3
  25. data/lib/jpmobile/filter.rb +44 -47
  26. data/lib/jpmobile/helpers.rb +38 -38
  27. data/lib/jpmobile/hook_action_view.rb +7 -7
  28. data/lib/jpmobile/hook_test_request.rb +0 -1
  29. data/lib/jpmobile/lookup_context.rb +1 -2
  30. data/lib/jpmobile/mail.rb +156 -134
  31. data/lib/jpmobile/mailer.rb +4 -4
  32. data/lib/jpmobile/mobile/abstract_mobile.rb +62 -36
  33. data/lib/jpmobile/mobile/android.rb +0 -1
  34. data/lib/jpmobile/mobile/android_tablet.rb +0 -1
  35. data/lib/jpmobile/mobile/au.rb +40 -28
  36. data/lib/jpmobile/mobile/black_berry.rb +0 -1
  37. data/lib/jpmobile/mobile/ddipocket.rb +1 -2
  38. data/lib/jpmobile/mobile/docomo.rb +47 -36
  39. data/lib/jpmobile/mobile/emobile.rb +1 -2
  40. data/lib/jpmobile/mobile/google_emoticon.rb +1 -1
  41. data/lib/jpmobile/mobile/ipad.rb +0 -1
  42. data/lib/jpmobile/mobile/iphone.rb +0 -1
  43. data/lib/jpmobile/mobile/smart_phone.rb +0 -1
  44. data/lib/jpmobile/mobile/softbank.rb +24 -20
  45. data/lib/jpmobile/mobile/tablet.rb +0 -1
  46. data/lib/jpmobile/mobile/unicode_emoticon.rb +15 -15
  47. data/lib/jpmobile/mobile/vodafone.rb +0 -1
  48. data/lib/jpmobile/mobile/willcom.rb +7 -7
  49. data/lib/jpmobile/mobile/windows_phone.rb +0 -1
  50. data/lib/jpmobile/path_set.rb +1 -1
  51. data/lib/jpmobile/position.rb +30 -14
  52. data/lib/jpmobile/rack/filter.rb +4 -4
  53. data/lib/jpmobile/rack/mobile_carrier.rb +0 -1
  54. data/lib/jpmobile/rack/params_filter.rb +7 -6
  55. data/lib/jpmobile/rails.rb +3 -4
  56. data/lib/jpmobile/request_with_mobile.rb +9 -6
  57. data/lib/jpmobile/resolver.rb +23 -17
  58. data/lib/jpmobile/session/active_record_store.rb +7 -9
  59. data/lib/jpmobile/session/mem_cache_store.rb +7 -9
  60. data/lib/jpmobile/sinatra.rb +1 -1
  61. data/lib/jpmobile/trans_sid.rb +15 -20
  62. data/lib/jpmobile/util.rb +61 -77
  63. data/lib/jpmobile/version.rb +1 -1
  64. data/lib/tasks/jpmobile_tasks.rake +35 -28
  65. data/spec/rack/jpmobile/android_spec.rb +5 -5
  66. data/spec/rack/jpmobile/au_spec.rb +74 -59
  67. data/spec/rack/jpmobile/black_berry_spec.rb +5 -5
  68. data/spec/rack/jpmobile/docomo_spec.rb +77 -64
  69. data/spec/rack/jpmobile/emoticon_spec.rb +137 -121
  70. data/spec/rack/jpmobile/filter_spec.rb +149 -128
  71. data/spec/rack/jpmobile/iphone_spec.rb +9 -8
  72. data/spec/rack/jpmobile/mobile_by_ua_spec.rb +22 -21
  73. data/spec/rack/jpmobile/params_filter_spec.rb +104 -96
  74. data/spec/rack/jpmobile/softbank_spec.rb +49 -42
  75. data/spec/rack/jpmobile/willcom_spec.rb +22 -18
  76. data/spec/rack/jpmobile/windows_phone.rb +5 -5
  77. data/spec/rack_helper.rb +9 -8
  78. data/spec/spec_helper.rb +5 -6
  79. data/spec/unit/decorated_mail_spec.rb +8 -9
  80. data/spec/unit/email_spec.rb +44 -44
  81. data/spec/unit/emoticon_spec.rb +57 -58
  82. data/spec/unit/encoding_spec.rb +35 -36
  83. data/spec/unit/is_carrier_spec.rb +49 -49
  84. data/spec/unit/mail_spec.rb +153 -143
  85. data/spec/unit/mobile/iphone_spec.rb +6 -7
  86. data/spec/unit/receive_mail_spec.rb +172 -173
  87. data/spec/unit/spec_helper.rb +6 -6
  88. data/spec/unit/util_spec.rb +125 -46
  89. data/spec/unit/valid_ip_spec.rb +35 -35
  90. data/spec/unit/variants_spec.rb +18 -19
  91. data/test/rails/overrides/Gemfile +54 -0
  92. data/test/rails/overrides/Gemfile.jpmobile +1 -2
  93. data/test/rails/overrides/app/controllers/admin/top_controller.rb +1 -1
  94. data/test/rails/overrides/app/controllers/docomo_guid_base_controller.rb +1 -1
  95. data/test/rails/overrides/app/controllers/filter_controller_base.rb +14 -6
  96. data/test/rails/overrides/app/controllers/hankaku_input_filter_controller.rb +1 -1
  97. data/test/rails/overrides/app/controllers/mobile_spec_controller.rb +1 -1
  98. data/test/rails/overrides/app/controllers/template_path_controller.rb +1 -2
  99. data/test/rails/overrides/app/controllers/trans_sid_base_controller.rb +18 -10
  100. data/test/rails/overrides/app/controllers/trans_sid_metal_controller.rb +0 -1
  101. data/test/rails/overrides/app/mailers/decorated_mailer.rb +3 -4
  102. data/test/rails/overrides/app/mailers/mobile_mailer.rb +5 -6
  103. data/test/rails/overrides/app/mailers/normal_mailer.rb +2 -3
  104. data/test/rails/overrides/autotest/discover.rb +2 -2
  105. data/test/rails/overrides/config/initializers/jpmobile_generator.rb +2 -2
  106. data/test/rails/overrides/config/routes.rb +95 -2
  107. data/test/rails/overrides/db/migrate/001_add_sessions_table.rb +2 -2
  108. data/test/rails/overrides/db/migrate/20100824062306_create_users.rb +1 -1
  109. data/test/rails/overrides/spec/controllers/docomo_guid_spec.rb +24 -25
  110. data/test/rails/overrides/spec/controllers/helpers_spec.rb +88 -88
  111. data/test/rails/overrides/spec/controllers/mobile_spec_controller_spec.rb +9 -9
  112. data/test/rails/overrides/spec/controllers/template_path_spec.rb +19 -19
  113. data/test/rails/overrides/spec/features/admin/top_spec.rb +7 -7
  114. data/test/rails/overrides/spec/features/filter_spec.rb +101 -102
  115. data/test/rails/overrides/spec/helpers/helpers_spec.rb +4 -4
  116. data/test/rails/overrides/spec/mailers/decorated_mailer_spec.rb +12 -12
  117. data/test/rails/overrides/spec/mailers/mobile_mailer_spec.rb +209 -194
  118. data/test/rails/overrides/spec/mailers/normal_mailer_spec.rb +10 -10
  119. data/test/rails/overrides/spec/rails_helper.rb +1 -1
  120. data/test/rails/overrides/spec/requests/docomo_spec.rb +13 -13
  121. data/test/rails/overrides/spec/requests/emobile_spec.rb +19 -19
  122. data/test/rails/overrides/spec/requests/pc_spec.rb +6 -6
  123. data/test/rails/overrides/spec/requests/softbank_emulator_spec.rb +6 -6
  124. data/test/rails/overrides/spec/requests/template_path_spec.rb +60 -60
  125. data/test/rails/overrides/spec/requests/trans_sid_spec.rb +89 -89
  126. data/test/sinatra/test/filter_test.rb +10 -11
  127. data/tools/e4u_conv.rb +0 -1
  128. metadata +18 -14
  129. data/README +0 -0
  130. data/README.rdoc +0 -308
@@ -1,6 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe LinksController, :type => :controller do
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)/"a").each do |link|
12
- path, query = link["href"].split(/\?/, 2)
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
- return results
16
+ results
17
17
  end
18
18
 
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)"
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 "docomo で" do
27
- it "get_position_link_to が正常に表示されること" do
28
- request.user_agent = "DoCoMo/2.0 SH903i(c100;TB;W24H16)"
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, attrs, path, params = links.first
34
- expect(text).to eq("STRING")
35
- expect(path).to eq("http://test.host/links/link")
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 "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)"
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, attrs, path, params = links.first
46
- expect(text).to eq("STRING")
47
- expect(path).to eq("http://test.host/links/docomo_utn")
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 "オープン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)"
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, attrs, 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")
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 "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)"
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, attrs, path, params = links.first
73
- expect(text).to eq("STRING")
74
- expect(path).to eq("http://test.host/links/docomo_foma_gps")
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 "au で" do
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 = "KDDI-SN26 UP.Browser/6.2.0.6.2 (GUI) MMP/2.0"
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, attrs, 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"])
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 = "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0"
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, attrs, 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"])
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 = "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)"
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, attrs, 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"])
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 = "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)"
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, attrs, 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"])
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 "softbank で" do
139
+ context 'softbank で' do
140
140
  # get_position_link_to(自動判別), Vodafone
141
141
  def test_get_position_link_to_vodafone
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"
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, attrs, path, params = links.first
147
- assert_equal("STRING", text)
148
- assert_equal("location:auto", path)
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 = "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1"
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, attrs, path, params = links.first
158
- assert_equal("STRING", text)
159
- assert_equal("location:auto", path)
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 = "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)"
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, attrs, path, params = links.first
169
- assert_equal("STRING", text)
170
- assert_equal("location:auto", path)
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 "willcom で" do
174
+ context 'willcom で' do
175
175
  # get_position_link_to(自動判別), Willcom
176
176
  def test_get_position_link_to_willcom
177
- request.user_agent = "Mozilla/3.0(WILLCOM;KYOCERA/WX310K/2;1.2.2.16.000000/0.1/C100) Opera 7.0"
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, attrs, 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"])
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 = "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)"
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, attrs, 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"])
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 "should be successful" do
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 "should be successful" do
20
- request.user_agent = "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
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 "should be successful" do
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 "should be successful" do
44
- request.user_agent = "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
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 "should be successful" do
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 "should be successful" do
77
- request.user_agent = "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
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, :type => :controller do
3
+ describe TemplatePathController, type: :controller do
4
4
  before do
5
5
  request.user_agent = user_agent
6
6
  end
7
7
 
8
- describe "DoCoMo SH902i からのアクセス" do
8
+ describe 'DoCoMo SH902i からのアクセス' do
9
9
  let(:user_agent) do
10
- "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
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([ 'mobile_docomo', 'mobile' ])
16
+ expect(controller.lookup_context.mobile).to eq(%w[mobile_docomo mobile])
17
17
  end
18
18
  end
19
19
 
20
- describe "au CA32 からのアクセス" do
20
+ describe 'au CA32 からのアクセス' do
21
21
  let(:user_agent) do
22
- "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0"
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([ 'mobile_au', 'mobile' ])
27
+ expect(controller.lookup_context.mobile).to eq(%w[mobile_au mobile])
28
28
  end
29
29
  end
30
30
 
31
- describe "Vodafone V903T からのアクセス" do
31
+ describe 'Vodafone V903T からのアクセス' do
32
32
  let(:user_agent) do
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"
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([ 'mobile_vodafone', 'mobile_softbank', 'mobile' ])
38
+ expect(controller.lookup_context.mobile).to eq(%w[mobile_vodafone mobile_softbank mobile])
39
39
  end
40
40
  end
41
41
 
42
- describe "SoftBank 910T からのアクセス" do
42
+ describe 'SoftBank 910T からのアクセス' do
43
43
  let(:user_agent) do
44
- "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1"
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([ 'mobile_softbank', 'mobile' ])
49
+ expect(controller.lookup_context.mobile).to eq(%w[mobile_softbank mobile])
50
50
  end
51
51
  end
52
52
 
53
- describe "iPhone からのアクセス" do
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([ 'smart_phone_iphone', 'smart_phone' ])
60
+ expect(controller.lookup_context.mobile).to eq(%w[smart_phone_iphone smart_phone])
61
61
  end
62
62
  end
63
63
 
64
- describe "Android からのアクセス" do
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([ 'smart_phone_android', 'smart_phone' ])
71
+ expect(controller.lookup_context.mobile).to eq(%w[smart_phone_android smart_phone])
72
72
  end
73
73
  end
74
74
 
75
- describe "Windows Phone からのアクセス" do
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([ 'smart_phone_windows_phone', 'smart_phone' ])
82
+ expect(controller.lookup_context.mobile).to eq(%w[smart_phone_windows_phone smart_phone])
83
83
  end
84
84
  end
85
85
  end