jpmobile 6.1.0 → 7.0.1
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/.circleci/config.yml +12 -4
- data/.onkcop-config.yml +0 -27
- data/.rubocop.yml +64 -1
- data/.ruby-version +1 -1
- data/Gemfile +4 -2
- data/Gemfile.lock +153 -141
- data/README.md +4 -20
- data/jpmobile.gemspec +5 -4
- data/lib/jpmobile/configuration.rb +7 -3
- data/lib/jpmobile/docomo_guid.rb +4 -4
- data/lib/jpmobile/email.rb +2 -4
- data/lib/jpmobile/emoticon.rb +10 -17
- data/lib/jpmobile/filter.rb +2 -2
- data/lib/jpmobile/hook_action_view.rb +3 -3
- data/lib/jpmobile/hook_template_details_requested.rb +12 -0
- data/lib/jpmobile/mail.rb +4 -4
- data/lib/jpmobile/mailer.rb +2 -2
- data/lib/jpmobile/mobile/abstract_mobile.rb +1 -1
- data/lib/jpmobile/mobile/android.rb +1 -1
- data/lib/jpmobile/mobile/android_tablet.rb +1 -1
- data/lib/jpmobile/mobile/au.rb +2 -2
- data/lib/jpmobile/mobile/black_berry.rb +1 -1
- data/lib/jpmobile/mobile/ddipocket.rb +1 -1
- data/lib/jpmobile/mobile/docomo.rb +6 -8
- data/lib/jpmobile/mobile/emobile.rb +2 -2
- data/lib/jpmobile/mobile/ipad.rb +1 -1
- data/lib/jpmobile/mobile/iphone.rb +1 -1
- data/lib/jpmobile/mobile/softbank.rb +2 -2
- data/lib/jpmobile/mobile/vodafone.rb +2 -2
- data/lib/jpmobile/mobile/willcom.rb +2 -2
- data/lib/jpmobile/mobile/windows_phone.rb +1 -1
- data/lib/jpmobile/path_set.rb +10 -36
- data/lib/jpmobile/rack/params_filter.rb +5 -4
- data/lib/jpmobile/rails.rb +3 -35
- data/lib/jpmobile/resolver.rb +44 -6
- data/lib/jpmobile/template_details.rb +38 -0
- data/lib/jpmobile/trans_sid.rb +1 -1
- data/lib/jpmobile/util.rb +3 -4
- data/lib/jpmobile/version.rb +1 -1
- data/lib/jpmobile/view_selector.rb +25 -0
- data/lib/jpmobile.rb +14 -0
- data/lib/tasks/jpmobile_tasks.rake +2 -1
- data/spec/rack/jpmobile/mobile_by_ua_spec.rb +1 -0
- data/spec/rack_helper.rb +0 -4
- data/spec/unit/email_spec.rb +1 -1
- data/spec/unit/receive_mail_spec.rb +1 -1
- data/test/rails/overrides/Gemfile.jpmobile +5 -1
- data/test/rails/overrides/app/controllers/mobile_spec_controller.rb +1 -1
- data/test/rails/overrides/app/controllers/template_path_controller.rb +3 -0
- data/test/rails/overrides/app/views/mobile_spec/mobile_not_exist.html.erb +3 -0
- data/test/rails/overrides/config/routes.rb +1 -1
- data/test/rails/overrides/spec/controllers/docomo_guid_spec.rb +2 -2
- data/test/rails/overrides/spec/controllers/mobile_spec_controller_spec.rb +3 -3
- data/test/rails/overrides/spec/rails_helper.rb +1 -1
- data/test/rails/overrides/spec/requests/filter_spec.rb +106 -0
- data/test/rails/overrides/spec/requests/template_path_spec.rb +1 -1
- data/test/rails/overrides/spec/requests/trans_sid_spec.rb +9 -9
- data/test/rails/overrides/spec/{features → system}/admin/top_spec.rb +2 -2
- data/test/rails/overrides/spec/{features → system}/filter_spec.rb +2 -7
- data/test/rails/overrides/spec/system/support/cuprite_setup.rb +14 -0
- data/test/rails/overrides/spec/system_helper.rb +3 -0
- metadata +26 -31
- data/test/rails/overrides/app/views/mobile_spec/no_mobile.html.erb +0 -3
data/lib/jpmobile/util.rb
CHANGED
@@ -255,9 +255,8 @@ module Jpmobile
|
|
255
255
|
SJIS
|
256
256
|
when ::Encoding::UTF_8
|
257
257
|
UTF8
|
258
|
-
when ::Encoding::ASCII_8BIT
|
259
|
-
BINARY
|
260
258
|
else
|
259
|
+
# 上記以外はすべて BINARY 扱い
|
261
260
|
BINARY
|
262
261
|
end
|
263
262
|
end
|
@@ -292,12 +291,12 @@ module Jpmobile
|
|
292
291
|
def split_text(str, size = 15)
|
293
292
|
return nil if str.nil? || (str == '')
|
294
293
|
|
295
|
-
[str[0..(size - 1)], str[size
|
294
|
+
[str[0..(size - 1)], str[size..]]
|
296
295
|
end
|
297
296
|
|
298
297
|
def invert_table(hash)
|
299
298
|
result = {}
|
300
|
-
hash.
|
299
|
+
hash.each_key do |key|
|
301
300
|
if result[hash[key]]
|
302
301
|
if !key.is_a?(Array) && !result[hash[key]].is_a?(Array) && result[hash[key]] > key
|
303
302
|
result[hash[key]] = key
|
data/lib/jpmobile/version.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
module Jpmobile
|
2
|
+
module ViewSelector
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
before_action :register_mobile
|
7
|
+
|
8
|
+
self.view_paths = Jpmobile::PathSet.new(self.view_paths.paths.map(&:path))
|
9
|
+
end
|
10
|
+
|
11
|
+
def register_mobile
|
12
|
+
if request.mobile
|
13
|
+
# register mobile
|
14
|
+
self.lookup_context.mobile = request.mobile.variants
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def disable_mobile_view!
|
19
|
+
self.lookup_context.mobile = []
|
20
|
+
end
|
21
|
+
|
22
|
+
private :register_mobile, :disable_mobile_view!
|
23
|
+
end
|
24
|
+
Rails::Application::Configuration.include Jpmobile::Configuration::RailsConfiguration
|
25
|
+
end
|
data/lib/jpmobile.rb
CHANGED
@@ -48,9 +48,19 @@ module Jpmobile
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def self.carriers=(ary)
|
51
|
+
@all_variants = nil
|
52
|
+
|
51
53
|
@carriers = ary
|
52
54
|
end
|
53
55
|
|
56
|
+
def self.all_variants
|
57
|
+
return @all_variants if @all_variants
|
58
|
+
|
59
|
+
@all_variants = carriers.map {|carrier|
|
60
|
+
Jpmobile::Mobile.const_get(carrier).new({}, {}).variants
|
61
|
+
}.flatten.uniq
|
62
|
+
end
|
63
|
+
|
54
64
|
require 'jpmobile/mobile/abstract_mobile'
|
55
65
|
end
|
56
66
|
|
@@ -63,6 +73,10 @@ module Jpmobile
|
|
63
73
|
autoload :Mailer, 'jpmobile/mailer'
|
64
74
|
autoload :Resolver, 'jpmobile/resolver'
|
65
75
|
|
76
|
+
autoload :PathSet, 'jpmobile/path_set'
|
77
|
+
autoload :TemplateDetails, 'jpmobile/template_details'
|
78
|
+
|
79
|
+
autoload :ViewSelector, 'jpmobile/view_selector'
|
66
80
|
autoload :FallbackViewSelector, 'jpmobile/fallback_view_selector'
|
67
81
|
|
68
82
|
autoload :ParamsOverCookie, 'jpmobile/trans_sid'
|
@@ -112,12 +112,13 @@ namespace :test do
|
|
112
112
|
|
113
113
|
system 'bundle install'
|
114
114
|
system 'bin/rails db:migrate RAILS_ENV=test' unless skip
|
115
|
-
system 'bin/rails spec'
|
115
|
+
system 'bin/rails spec', exception: true
|
116
116
|
|
117
117
|
ENV.replace(original_env)
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
121
|
+
|
121
122
|
desc 'Run sinatra on jpmobile tests'
|
122
123
|
Rake::TestTask.new(:sinatra) do |t|
|
123
124
|
t.libs << 'lib'
|
@@ -17,6 +17,7 @@ describe Jpmobile::MobileCarrier do
|
|
17
17
|
[Jpmobile::Mobile::Emobile, 'emobile/1.0.0 (H11T; like Gecko; Wireless) NetFront/3.4'],
|
18
18
|
[Jpmobile::Mobile::Iphone, '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'],
|
19
19
|
[Jpmobile::Mobile::Android, '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'],
|
20
|
+
[Jpmobile::Mobile::Android, 'Mozilla/5.0 (Linux; Android 9; ANE-LX2J Build/HUAWEIANE-LX2J; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/88.0.4324.93 Mobile Safari/537.36 Instagram 172.0.0.21.123 Android (28/9; 480dpi; 1080x2060; HUAWEI; ANE-LX2J; HWANE; hi6250; ja_JP; 269790805)'],
|
20
21
|
[Jpmobile::Mobile::WindowsPhone, 'Mozilla/4.0 (Compatible; MSIE 6.0; Windows NT 5.1 T-01A_6.5; Windows Phone 6.5)'],
|
21
22
|
[Jpmobile::Mobile::BlackBerry, 'BlackBerry9000/4.6.0.224 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/220'],
|
22
23
|
[Jpmobile::Mobile::Ipad, 'Mozilla/5.0 (iPad; U; CPU OS 4_3 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F191 Safari/6533.18.5'],
|
data/spec/rack_helper.rb
CHANGED
@@ -75,8 +75,6 @@ module Jpmobile::RackHelper
|
|
75
75
|
body = case res
|
76
76
|
when Array
|
77
77
|
res[2]
|
78
|
-
when String
|
79
|
-
res.body
|
80
78
|
else
|
81
79
|
res.body
|
82
80
|
end
|
@@ -84,8 +82,6 @@ module Jpmobile::RackHelper
|
|
84
82
|
case body
|
85
83
|
when Array
|
86
84
|
body.first
|
87
|
-
when String
|
88
|
-
body
|
89
85
|
else
|
90
86
|
body
|
91
87
|
end
|
data/spec/unit/email_spec.rb
CHANGED
@@ -56,7 +56,7 @@ describe 'Jpmobile::Email' do
|
|
56
56
|
|
57
57
|
describe 'japanese_mail_address_regexp' do
|
58
58
|
before do
|
59
|
-
Jpmobile::Email.japanese_mail_address_regexp = Regexp.new(/\.jp(?:[^a-zA-Z
|
59
|
+
Jpmobile::Email.japanese_mail_address_regexp = Regexp.new(/\.jp(?:[^a-zA-Z.\-]|$)/)
|
60
60
|
end
|
61
61
|
|
62
62
|
it '#detect_from_mail_header should return Jpmobile::Mobile::AbstractMobile when the header contains .jp address' do
|
@@ -7,7 +7,7 @@ describe 'Jpmobile::Mail#receive' do
|
|
7
7
|
|
8
8
|
before(:each) do
|
9
9
|
@to = 'info@jpmobile-rails.org'
|
10
|
-
Jpmobile::Email.japanese_mail_address_regexp = Regexp.new(/\.jp[^a-zA-Z
|
10
|
+
Jpmobile::Email.japanese_mail_address_regexp = Regexp.new(/\.jp[^a-zA-Z.\-]/)
|
11
11
|
end
|
12
12
|
|
13
13
|
describe 'PC mail' do
|
@@ -4,7 +4,7 @@ gem 'jpmobile', path: './vendor/jpmobile'
|
|
4
4
|
gem 'jpmobile-terminfo', path: './vendor/jpmobile-terminfo'
|
5
5
|
gem 'jpmobile-ipaddresses', path: './vendor/jpmobile-ipaddresses'
|
6
6
|
|
7
|
-
gem 'activerecord-session_store', '
|
7
|
+
gem 'activerecord-session_store', git: 'https://github.com/rails/activerecord-session_store.git', ref: 'f188efbc49a522123cc8acc805143824176d01c1'
|
8
8
|
|
9
9
|
gem 'pry'
|
10
10
|
gem 'pry-byebug'
|
@@ -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
|
@@ -6,7 +6,7 @@ shared_examples_for 'docomo_guid が起動しないとき' do
|
|
6
6
|
it 'で link_to の自動書き換えが行われない' do
|
7
7
|
get :link
|
8
8
|
|
9
|
-
expect(response.body).to match(%r{href
|
9
|
+
expect(response.body).to match(%r{href=".+/link"})
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -14,7 +14,7 @@ shared_examples_for 'docomo_guid が起動するとき' do
|
|
14
14
|
it 'で link_to の自動書き換えが行われる' do
|
15
15
|
get :link
|
16
16
|
|
17
|
-
expect(response.body).to match(%r{href
|
17
|
+
expect(response.body).to match(%r{href=".+/link\?guid=ON"})
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -52,7 +52,7 @@ describe MobileSpecController, type: :controller do
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
describe "GET '
|
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 '
|
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 '
|
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
|
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
|
@@ -27,12 +27,12 @@ describe 'trans_sid functional', type: :request do
|
|
27
27
|
it 'で link_to の自動書き換えが行われない' do
|
28
28
|
res = get_with_session(@controller, 'link', @user_agent)
|
29
29
|
|
30
|
-
expect(res.response.body).to match(%r{<a href
|
30
|
+
expect(res.response.body).to match(%r{<a href="/.+?/link">linkto</a>})
|
31
31
|
end
|
32
32
|
it 'で form の自動書き換えが行われない' do
|
33
33
|
res = get_with_session(@controller, 'form', @user_agent)
|
34
34
|
|
35
|
-
expect(res.response.body).to match(%r{<form.*action
|
35
|
+
expect(res.response.body).to match(%r{<form.*action="/.+?/form".*accept-charset="#{@charset}"})
|
36
36
|
end
|
37
37
|
it 'で redirect の自動書き換えが行われない' do
|
38
38
|
res = get_with_session(@controller, 'redirect', @user_agent)
|
@@ -45,16 +45,16 @@ describe 'trans_sid functional', type: :request do
|
|
45
45
|
it 'で link_to の自動書き換えが行われる' do
|
46
46
|
res = get_with_session(@controller, 'link', @user_agent)
|
47
47
|
|
48
|
-
expect(res.response.body).to match(%r{<a href
|
48
|
+
expect(res.response.body).to match(%r{<a href="/.+?/link\?_session_id=[a-zA-Z0-9]{32}">linkto</a>})
|
49
49
|
end
|
50
50
|
it 'で form内にhiddenが差し込まれる' do
|
51
51
|
res = get_with_session(@controller, 'form', @user_agent)
|
52
|
-
expect(res.response.body).to match(/<input type
|
52
|
+
expect(res.response.body).to match(/<input type="hidden" name=".+" value="[a-zA-Z0-9]{32}"/)
|
53
53
|
end
|
54
54
|
it 'で form の自動書き換えが行われる' do
|
55
55
|
res = get_with_session(@controller, 'form', @user_agent)
|
56
56
|
|
57
|
-
expect(res.response.body).to match(%r{<form.*action
|
57
|
+
expect(res.response.body).to match(%r{<form.*action="/.+?/form\?_session_id=[a-zA-Z0-9]{32}".*accept-charset="#{@charset}"})
|
58
58
|
end
|
59
59
|
it 'で redirect の自動書き換えが行われる' do
|
60
60
|
res = get_with_session(@controller, 'redirect', @user_agent)
|
@@ -66,12 +66,12 @@ describe 'trans_sid functional', type: :request do
|
|
66
66
|
it 'で @user の link_to の自動書き換えが行われる' do
|
67
67
|
res = get_with_session(@controller, 'link_path', @user_agent)
|
68
68
|
|
69
|
-
expect(res.response.body).to match(%r{<a href
|
69
|
+
expect(res.response.body).to match(%r{<a href="/users/1\?_session_id=[a-zA-Z0-9]{32}">linkto</a>})
|
70
70
|
end
|
71
71
|
it 'で @user の form の自動書き換えが行われる' do
|
72
72
|
res = get_with_session(@controller, 'form_path', @user_agent)
|
73
73
|
|
74
|
-
expect(res.response.body).to match(%r{<form.*action
|
74
|
+
expect(res.response.body).to match(%r{<form.*action="/users/1\?_session_id=[a-zA-Z0-9]{32}".*accept-charset="#{@charset}"})
|
75
75
|
end
|
76
76
|
it 'で @path の redirect の自動書き換えが行われる' do
|
77
77
|
res = get_with_session(@controller, 'redirect_path', @user_agent)
|
@@ -83,12 +83,12 @@ describe 'trans_sid functional', type: :request do
|
|
83
83
|
it 'で [:admin, @user] の link_to の自動書き換えが行われる' do
|
84
84
|
res = get_with_session(@controller, 'link_path_admin', @user_agent)
|
85
85
|
|
86
|
-
expect(res.response.body).to match(%r{<a href
|
86
|
+
expect(res.response.body).to match(%r{<a href="/admin/users/1\?_session_id=[a-zA-Z0-9]{32}">linkto</a>})
|
87
87
|
end
|
88
88
|
it 'で [:admin, @user] の form の自動書き換えが行われる' do
|
89
89
|
res = get_with_session(@controller, 'form_path_admin', @user_agent)
|
90
90
|
|
91
|
-
expect(res.response.body).to match(%r{<form.*action
|
91
|
+
expect(res.response.body).to match(%r{<form.*action="/admin/users/1\?_session_id=[a-zA-Z0-9]{32}".* accept-charset="#{@charset}"})
|
92
92
|
end
|
93
93
|
it 'で [:admin, @path] の redirect の自動書き換えが行われる' do
|
94
94
|
res = get_with_session(@controller, 'redirect_path_admin', @user_agent)
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require '
|
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.
|
6
|
+
page.driver.headers = { 'User-Agent' => user_agent }
|
7
7
|
end
|
8
8
|
|
9
9
|
context 'PCからのアクセスの場合' do
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require '
|
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.
|
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
|