jpmobile 6.1.2 → 7.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +12 -4
  3. data/.rubocop.yml +104 -1
  4. data/.ruby-version +1 -1
  5. data/Gemfile +2 -0
  6. data/Gemfile.lock +157 -149
  7. data/README.md +5 -21
  8. data/Rakefile +1 -1
  9. data/jpmobile.gemspec +4 -4
  10. data/lib/jpmobile/datum_conv.rb +7 -7
  11. data/lib/jpmobile/docomo_guid.rb +2 -2
  12. data/lib/jpmobile/email.rb +2 -2
  13. data/lib/jpmobile/fallback_view_selector.rb +2 -2
  14. data/lib/jpmobile/filter.rb +3 -1
  15. data/lib/jpmobile/hook_action_view.rb +3 -3
  16. data/lib/jpmobile/hook_template_details_requested.rb +12 -0
  17. data/lib/jpmobile/mail.rb +2 -2
  18. data/lib/jpmobile/mailer.rb +2 -2
  19. data/lib/jpmobile/mobile/abstract_mobile.rb +1 -1
  20. data/lib/jpmobile/mobile/android_tablet.rb +1 -1
  21. data/lib/jpmobile/mobile/au.rb +4 -6
  22. data/lib/jpmobile/mobile/softbank.rb +3 -1
  23. data/lib/jpmobile/path_set.rb +10 -36
  24. data/lib/jpmobile/position.rb +2 -2
  25. data/lib/jpmobile/rails.rb +2 -0
  26. data/lib/jpmobile/resolver.rb +44 -6
  27. data/lib/jpmobile/template_details.rb +38 -0
  28. data/lib/jpmobile/trans_sid.rb +1 -1
  29. data/lib/jpmobile/util.rb +1 -1
  30. data/lib/jpmobile/version.rb +1 -1
  31. data/lib/jpmobile/view_selector.rb +5 -6
  32. data/lib/jpmobile.rb +13 -0
  33. data/lib/tasks/jpmobile_tasks.rake +4 -5
  34. data/spec/rack/jpmobile/mobile_by_ua_spec.rb +1 -0
  35. data/spec/unit/decorated_mail_spec.rb +1 -1
  36. data/spec/unit/mail_spec.rb +2 -2
  37. data/spec/unit/receive_mail_spec.rb +29 -29
  38. data/test/rails/overrides/Gemfile.jpmobile +4 -0
  39. data/test/rails/overrides/app/controllers/mobile_spec_controller.rb +1 -1
  40. data/test/rails/overrides/app/controllers/template_path_controller.rb +3 -0
  41. data/test/rails/overrides/app/mailers/decorated_mailer.rb +1 -1
  42. data/test/rails/overrides/app/views/mobile_spec/mobile_not_exist.html.erb +3 -0
  43. data/test/rails/overrides/config/routes.rb +3 -1
  44. data/test/rails/overrides/spec/controllers/mobile_spec_controller_spec.rb +3 -3
  45. data/test/rails/overrides/spec/rails_helper.rb +1 -1
  46. data/test/rails/overrides/spec/requests/filter_spec.rb +106 -0
  47. data/test/rails/overrides/spec/requests/template_path_spec.rb +1 -1
  48. data/test/rails/overrides/spec/{features → system}/admin/top_spec.rb +2 -2
  49. data/test/rails/overrides/spec/{features → system}/filter_spec.rb +2 -7
  50. data/test/rails/overrides/spec/system/support/cuprite_setup.rb +14 -0
  51. data/test/rails/overrides/spec/system_helper.rb +3 -0
  52. metadata +25 -30
  53. data/test/rails/overrides/app/views/mobile_spec/no_mobile.html.erb +0 -3
@@ -12,7 +12,7 @@ describe 'Jpmobile::Mail#receive' do
12
12
 
13
13
  describe 'PC mail' do
14
14
  before(:each) do
15
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/pc-mail-single.eml')).read)
15
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/pc-mail-single.eml')))
16
16
  end
17
17
 
18
18
  it 'subject should be parsed correctly' do
@@ -49,7 +49,7 @@ describe 'Jpmobile::Mail#receive' do
49
49
  describe 'multipart' do
50
50
  describe 'PC mail' do
51
51
  before(:each) do
52
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/pc-mail-multi.eml')).read)
52
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/pc-mail-multi.eml')))
53
53
  end
54
54
 
55
55
  it 'subject should be parsed correctly' do
@@ -68,7 +68,7 @@ describe 'Jpmobile::Mail#receive' do
68
68
 
69
69
  describe 'PC mail without subject' do
70
70
  before(:each) do
71
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/pc-mail-attached-without-subject.eml')).read)
71
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/pc-mail-attached-without-subject.eml')))
72
72
  end
73
73
 
74
74
  it 'body should be parsed correctly' do
@@ -84,7 +84,7 @@ describe 'Jpmobile::Mail#receive' do
84
84
  describe 'Docomo' do
85
85
  context 'with sjis decomail' do
86
86
  before(:each) do
87
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/docomo-gmail-sjis.eml')).read)
87
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/docomo-gmail-sjis.eml')))
88
88
  end
89
89
 
90
90
  it 'subject should be parsed correctly' do
@@ -111,7 +111,7 @@ describe 'Jpmobile::Mail#receive' do
111
111
 
112
112
  context 'with jis decomail' do
113
113
  before(:each) do
114
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/docomo-decomail.eml')).read)
114
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/docomo-decomail.eml')))
115
115
  end
116
116
 
117
117
  it 'does not contain charset within multipart Content-Type' do
@@ -129,7 +129,7 @@ describe 'Jpmobile::Mail#receive' do
129
129
 
130
130
  describe 'Au' do
131
131
  before(:each) do
132
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/au-decomail.eml')).read)
132
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/au-decomail.eml')))
133
133
  end
134
134
 
135
135
  it 'subject should be parsed correctly' do
@@ -151,7 +151,7 @@ describe 'Jpmobile::Mail#receive' do
151
151
  describe 'Softbank' do
152
152
  context 'Shift_JIS' do
153
153
  before(:each) do
154
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/softbank-gmail-sjis.eml')).read)
154
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/softbank-gmail-sjis.eml')))
155
155
  end
156
156
 
157
157
  it 'subject should be parsed correctly' do
@@ -170,7 +170,7 @@ describe 'Jpmobile::Mail#receive' do
170
170
 
171
171
  context 'UTF-8' do
172
172
  before(:each) do
173
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/softbank-gmail-utf8.eml')).read)
173
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/softbank-gmail-utf8.eml')))
174
174
  end
175
175
 
176
176
  it 'subject should be parsed correctly' do
@@ -190,7 +190,7 @@ describe 'Jpmobile::Mail#receive' do
190
190
 
191
191
  context 'bounced mail' do
192
192
  it 'should parse sub-part charset correctly' do
193
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/bounce_with_utf8_part.eml')).read)
193
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/bounce_with_utf8_part.eml')))
194
194
  expect(@mail.parts.first.charset).to match(/iso-2022-jp/i)
195
195
  expect(@mail.parts.last.charset).to match(/utf-8/i)
196
196
  end
@@ -199,7 +199,7 @@ describe 'Jpmobile::Mail#receive' do
199
199
 
200
200
  describe 'Docomo' do
201
201
  before(:each) do
202
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/docomo-emoji.eml')).read)
202
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/docomo-emoji.eml')))
203
203
  end
204
204
 
205
205
  it 'subject should be parsed correctly' do
@@ -234,7 +234,7 @@ describe 'Jpmobile::Mail#receive' do
234
234
 
235
235
  context 'JIS mail' do
236
236
  before(:each) do
237
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/docomo-jis.eml')).read)
237
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/docomo-jis.eml')))
238
238
  end
239
239
 
240
240
  it 'subject should be parsed correctly' do
@@ -250,7 +250,7 @@ describe 'Jpmobile::Mail#receive' do
250
250
  describe 'Au' do
251
251
  context 'au-emoji.eml' do
252
252
  before(:each) do
253
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/au-emoji.eml')).read)
253
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/au-emoji.eml')))
254
254
  end
255
255
 
256
256
  it 'subject should be parsed correctly' do
@@ -286,36 +286,36 @@ describe 'Jpmobile::Mail#receive' do
286
286
 
287
287
  it 'should not be raised when parsing incoming email #41' do
288
288
  expect {
289
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/au-email.eml')).read)
289
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/au-email.eml')))
290
290
  }.not_to raise_error
291
291
  end
292
292
 
293
293
  it 'should not be raised when parsing incoming email #45' do
294
294
  expect {
295
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/au-decomail2.eml')).read)
295
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/au-decomail2.eml')))
296
296
  }.not_to raise_error
297
297
  end
298
298
 
299
299
  it 'should not be raised when parsing incoming email - include kigou' do
300
300
  expect {
301
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/au-kigou.eml')).read)
301
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/au-kigou.eml')))
302
302
  }.not_to raise_error
303
303
  end
304
304
 
305
305
  context 'From au iPhone' do
306
306
  it 'charset should be UTF-8' do
307
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/iphone-message.eml')).read)
307
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/iphone-message.eml')))
308
308
  expect(@mail.mobile).to be_a(Jpmobile::Mobile::Au)
309
309
  expect(@mail.charset).to match(/utf-8/i)
310
310
  end
311
311
 
312
312
  it 'should be encoded correctly' do
313
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/iphone-message.eml')).read)
313
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/iphone-message.eml')))
314
314
  expect(@mail.encoded).to match(Regexp.escape("%[\e$B1`;yL>\e(B]%\e$B$N\e(B%[\e$BJ]8n<TL>\e(B]%"))
315
315
  end
316
316
 
317
317
  it 'should decode cp932-encoded mail correctly' do
318
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/iphone-cp932.eml')).read)
318
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/iphone-cp932.eml')))
319
319
  expect(@mail.subject).to eq 'Re: 【NKSC】test'
320
320
  expect(@mail.body.to_s).to eq 'テストです。㈱'
321
321
  end
@@ -323,20 +323,20 @@ describe 'Jpmobile::Mail#receive' do
323
323
 
324
324
  context 'From iPad' do
325
325
  it 'charset should be UTF-8' do
326
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/iphone-mail3.eml')).read)
326
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/iphone-mail3.eml')))
327
327
  expect(@mail.mobile).to be_a(Jpmobile::Mobile::AbstractMobile)
328
328
  expect(@mail.charset).to match(/utf-8/i)
329
329
  end
330
330
 
331
331
  it 'should be encoded correctly' do
332
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/iphone-mail3.eml')).read)
332
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/iphone-mail3.eml')))
333
333
  expect(@mail.encoded).to match(/BK\\J82~9T\$J\$7!2#5#1#2J8;z!2/)
334
334
  end
335
335
  end
336
336
 
337
337
  it 'should not raise when parsing attached email' do
338
338
  expect {
339
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/au-attached.eml')).read)
339
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/au-attached.eml')))
340
340
  expect(@mail.encoded).to match('/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAPQAA')
341
341
  }.not_to raise_error
342
342
  end
@@ -344,7 +344,7 @@ describe 'Jpmobile::Mail#receive' do
344
344
 
345
345
  describe 'Softbank' do
346
346
  before(:each) do
347
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/softbank-emoji.eml')).read)
347
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/softbank-emoji.eml')))
348
348
  end
349
349
 
350
350
  it 'subject should be parsed correctly' do
@@ -379,7 +379,7 @@ describe 'Jpmobile::Mail#receive' do
379
379
 
380
380
  describe 'blank-mail' do
381
381
  before(:each) do
382
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/softbank-blank.eml')).read)
382
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/softbank-blank.eml')))
383
383
  end
384
384
 
385
385
  it 'subject should be parsed correctly' do
@@ -395,7 +395,7 @@ describe 'Jpmobile::Mail#receive' do
395
395
  describe 'iPhone' do
396
396
  context 'JIS mail' do
397
397
  before(:each) do
398
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/iphone-jis.eml')).read)
398
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/iphone-jis.eml')))
399
399
  end
400
400
 
401
401
  it 'body should be parsed correctly' do
@@ -405,7 +405,7 @@ describe 'Jpmobile::Mail#receive' do
405
405
 
406
406
  context 'when the mail contains UTF-8 emojis' do
407
407
  before(:each) do
408
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/iphone-unicode-emoji.eml')).read)
408
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/iphone-unicode-emoji.eml')))
409
409
  end
410
410
 
411
411
  it 'subject should be parsed correctly' do
@@ -419,7 +419,7 @@ describe 'Jpmobile::Mail#receive' do
419
419
 
420
420
  context 'when the mail contains circled-numbers' do
421
421
  before(:each) do
422
- @mail = Mail.new(File.open(File.join(__dir__, 'email-fixtures/iphone-circled-numbers-in-jis.eml')).read)
422
+ @mail = Mail.new(File.read(File.join(__dir__, 'email-fixtures/iphone-circled-numbers-in-jis.eml')))
423
423
  end
424
424
 
425
425
  it 'subject should be parsed correctly' do
@@ -435,7 +435,7 @@ describe 'Jpmobile::Mail#receive' do
435
435
  describe 'bounced mail' do
436
436
  context 'has jp address' do
437
437
  before(:each) do
438
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/bounced-jp.eml')).read)
438
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/bounced-jp.eml')))
439
439
  end
440
440
 
441
441
  it 'mobile should abstract mobile' do
@@ -447,7 +447,7 @@ describe 'Jpmobile::Mail#receive' do
447
447
  describe 'non-Japanese mail' do
448
448
  context 'us-ascii' do
449
449
  before(:each) do
450
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/non-jp.eml')).read)
450
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/non-jp.eml')))
451
451
  end
452
452
 
453
453
  it 'mobile should be nil' do
@@ -458,7 +458,7 @@ describe 'Jpmobile::Mail#receive' do
458
458
 
459
459
  context 'no From header' do
460
460
  before(:each) do
461
- @mail = Mail.new(File.open(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/no-from.eml')).read)
461
+ @mail = Mail.new(File.read(File.join(__dir__, '../../test/rails/overrides/spec/fixtures/files/mobile_mailer/no-from.eml')))
462
462
  end
463
463
 
464
464
  it 'mobile should be nil' do
@@ -14,3 +14,7 @@ group :development, :test do
14
14
  gem "rspec-rails"
15
15
  gem 'rails-controller-testing'
16
16
  end
17
+
18
+ group :test do
19
+ gem 'cuprite'
20
+ end
@@ -8,6 +8,6 @@ class MobileSpecController < ApplicationController
8
8
  render file: File.join(Rails.public_path, '422.html')
9
9
  end
10
10
 
11
- def no_mobile
11
+ def mobile_not_exist
12
12
  end
13
13
  end
@@ -10,6 +10,9 @@ class TemplatePathController < ApplicationController
10
10
  def show
11
11
  end
12
12
 
13
+ def partial
14
+ end
15
+
13
16
  def optioned_index
14
17
  render action: 'index'
15
18
  end
@@ -3,7 +3,7 @@ class DecoratedMailer < Jpmobile::Mailer::Base
3
3
  default to: 'info@jp.mobile'
4
4
 
5
5
  def deco_mail(to_mail)
6
- attachments.inline['photo.jpg'] = File.open(File.join(Rails.root, 'spec/fixtures/files/mobile_mailer/photo.jpg')).read
6
+ attachments.inline['photo.jpg'] = File.read(File.join(Rails.root, 'spec/fixtures/files/mobile_mailer/photo.jpg'))
7
7
 
8
8
  mail(to: to_mail, subject: '題名', decorated: true)
9
9
  end
@@ -0,0 +1,3 @@
1
+ PC mobile_not_exist
2
+
3
+ <%= render 'partial_view_sample' -%>
@@ -1,3 +1,4 @@
1
+ # rubocop:disable Performance/CollectionLiteralInLoop
1
2
  RailsRoot::Application.routes.draw do
2
3
  resources :users
3
4
  namespace :admin do
@@ -61,7 +62,7 @@ RailsRoot::Application.routes.draw do
61
62
  %w[
62
63
  index
63
64
  file_render
64
- no_mobile
65
+ mobile_not_exist
65
66
  ].each do |a|
66
67
  get "mobile_spec/#{a}", to: "mobile_spec##{a}"
67
68
  end
@@ -102,3 +103,4 @@ RailsRoot::Application.routes.draw do
102
103
  end
103
104
  end
104
105
  end
106
+ # rubocop:enable Performance/CollectionLiteralInLoop
@@ -52,7 +52,7 @@ describe MobileSpecController, type: :controller do
52
52
  end
53
53
  end
54
54
 
55
- describe "GET 'no_mobile'" do
55
+ describe "GET 'mobile_not_exist'" do
56
56
  around do |example|
57
57
  orig_value = Jpmobile.config.fallback_view_selector
58
58
  Jpmobile.config.fallback_view_selector = true
@@ -65,7 +65,7 @@ describe MobileSpecController, type: :controller do
65
65
  context 'PC access' do
66
66
  it 'should be successful' do
67
67
  request.user_agent = 'Mozilla'
68
- get 'no_mobile'
68
+ get 'mobile_not_exist'
69
69
 
70
70
  expect(response).to be_successful
71
71
  expect(response.body).not_to match('RailsRoot PC mobile')
@@ -75,7 +75,7 @@ describe MobileSpecController, type: :controller do
75
75
  context 'mobile access' do
76
76
  it 'should be successful' do
77
77
  request.user_agent = 'DoCoMo/2.0 SH902i(c100;TB;W24H12)'
78
- get 'no_mobile'
78
+ get 'mobile_not_exist'
79
79
 
80
80
  expect(response).to be_successful
81
81
  expect(response.body).not_to match('RailsRoot mobile')
@@ -48,7 +48,7 @@ RSpec.configure do |config|
48
48
  # # ...
49
49
  # end
50
50
  #
51
- # The different available types are documented in the features, such as in
51
+ # The different available types are documented in the system, such as in
52
52
  # https://relishapp.com/rspec/rspec-rails/docs
53
53
  config.infer_spec_type_from_file_location!
54
54
 
@@ -0,0 +1,106 @@
1
+ require 'system_helper'
2
+
3
+ describe 'jpmobile integration spec', type: :request do
4
+ include Jpmobile::Util
5
+
6
+ before do
7
+ page.driver.headers = { 'User-Agent' => user_agent }
8
+ end
9
+
10
+ shared_examples_for '文字コードフィルタが動作しているとき' do
11
+ it 'はhtml以外は変換しないこと' do
12
+ get "/#{controller}/rawdata", env: { 'HTTP_USER_AGENT' => user_agent }
13
+ expect(response.body.encode('UTF-8')).to eq('アブラカダブラ')
14
+ expect(response.headers['Content-Type']).not_to match(/charset/i)
15
+ end
16
+ end
17
+
18
+ #
19
+ # PCからのアクセス
20
+ #
21
+ describe FilterController do
22
+ let(:controller) { 'filter' }
23
+
24
+ describe 'PCからのアクセス' do
25
+ let(:user_agent) do
26
+ '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)'
27
+ end
28
+ it_should_behave_like '文字コードフィルタが動作しているとき'
29
+ end
30
+
31
+ describe 'DoCoMo SH902i からのアクセス' do
32
+ let(:user_agent) do
33
+ 'DoCoMo/2.0 SH902i(c100;TB;W24H12)'
34
+ end
35
+ it_should_behave_like '文字コードフィルタが動作しているとき'
36
+ end
37
+
38
+ describe 'au CA32 からのアクセス' do
39
+ let(:user_agent) do
40
+ 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0'
41
+ end
42
+ it_should_behave_like '文字コードフィルタが動作しているとき'
43
+ end
44
+
45
+ describe 'Vodafone V903T からのアクセス' do
46
+ let(:user_agent) do
47
+ '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'
48
+ end
49
+ it_should_behave_like '文字コードフィルタが動作しているとき'
50
+ end
51
+
52
+ describe 'SoftBank 910T からのアクセス' do
53
+ let(:user_agent) do
54
+ 'SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1'
55
+ end
56
+ it_should_behave_like '文字コードフィルタが動作しているとき'
57
+ end
58
+ end
59
+
60
+ describe HankakuFilterController do
61
+ let(:controller) { 'hankaku_filter' }
62
+
63
+ describe 'PCからのアクセス' do
64
+ let(:user_agent) do
65
+ '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
+ end
67
+ it_should_behave_like '文字コードフィルタが動作しているとき'
68
+ end
69
+
70
+ describe 'DoCoMo SH902i からのアクセス' do
71
+ let(:user_agent) do
72
+ 'DoCoMo/2.0 SH902i(c100;TB;W24H12)'
73
+ end
74
+
75
+ it_should_behave_like '文字コードフィルタが動作しているとき'
76
+ end
77
+
78
+ describe 'SoftBank 910T からのアクセス' do
79
+ let(:user_agent) do
80
+ 'SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1'
81
+ end
82
+
83
+ it_should_behave_like '文字コードフィルタが動作しているとき'
84
+ end
85
+ end
86
+
87
+ describe HankakuInputFilterController do
88
+ let(:controller) { 'hankaku_input_filter' }
89
+
90
+ describe 'DoCoMo SH902i からのアクセス' do
91
+ let(:user_agent) do
92
+ 'DoCoMo/2.0 SH902i(c100;TB;W24H12)'
93
+ end
94
+
95
+ it_should_behave_like '文字コードフィルタが動作しているとき'
96
+ end
97
+
98
+ describe 'SoftBank 910T からのアクセス' do
99
+ let(:user_agent) do
100
+ 'SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1'
101
+ end
102
+
103
+ it_should_behave_like '文字コードフィルタが動作しているとき'
104
+ end
105
+ end
106
+ end
@@ -2,7 +2,7 @@ require 'rails_helper'
2
2
 
3
3
  describe TemplatePathController, 'integrated_views', type: :request do
4
4
  before do
5
- page.driver.header('User-Agent', user_agent)
5
+ page.driver.headers = { 'User-Agent' => user_agent }
6
6
  end
7
7
 
8
8
  describe 'index' do
@@ -1,9 +1,9 @@
1
- require 'rails_helper'
1
+ require 'system_helper'
2
2
 
3
3
  describe Admin::TopController, type: :feature do
4
4
  describe "GET 'full_path'" do
5
5
  before do
6
- page.driver.header('user_agent', user_agent)
6
+ page.driver.headers = { 'User-Agent' => user_agent }
7
7
  end
8
8
 
9
9
  context 'PCからのアクセスの場合' do
@@ -1,10 +1,10 @@
1
- require 'rails_helper'
1
+ require 'system_helper'
2
2
 
3
3
  describe 'jpmobile integration spec', type: :feature do
4
4
  include Jpmobile::Util
5
5
 
6
6
  before do
7
- page.driver.header('User-Agent', user_agent)
7
+ page.driver.headers = { 'User-Agent' => user_agent }
8
8
  end
9
9
 
10
10
  shared_examples_for 'hankaku_filter input: true のとき' do
@@ -38,11 +38,6 @@ describe 'jpmobile integration spec', type: :feature do
38
38
  end
39
39
 
40
40
  shared_examples_for '文字コードフィルタが動作しているとき' do
41
- it 'はhtml以外は変換しないこと' do
42
- visit "/#{controller}/rawdata"
43
- expect(page.body.encode('UTF-8')).to have_content('アブラカダブラ')
44
- expect(page.response_headers['Content-Type']).not_to match(/charset/i)
45
- end
46
41
  it 'response.bodyが空のときは文字コードを変更しないこと' do
47
42
  visit "/#{controller}/empty"
48
43
  expect(page.response_headers['Content-Type']).to match(/utf-8/i)
@@ -0,0 +1,14 @@
1
+ require 'capybara/cuprite'
2
+
3
+ Capybara.register_driver(:cuprite) do |app|
4
+ Capybara::Cuprite::Driver.new(
5
+ app,
6
+ **{
7
+ window_size: [1200, 800],
8
+ browser_options: {},
9
+ inspector: true,
10
+ },
11
+ )
12
+ end
13
+
14
+ Capybara.default_driver = Capybara.javascript_driver = :cuprite
@@ -0,0 +1,3 @@
1
+ require 'rails_helper'
2
+
3
+ Dir[File.join(__dir__, 'system/support/**/*.rb')].sort.each {|file| require file }