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,33 +1,33 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe NormalMailer, :
|
3
|
+
describe NormalMailer, type: :mailer do
|
4
4
|
include Jpmobile::Util
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
ActionMailer::Base.deliveries = []
|
8
8
|
|
9
|
-
@to = [
|
10
|
-
@subject =
|
11
|
-
@text =
|
9
|
+
@to = ['outer@jp.mobile', 'outer1@jp.mobile']
|
10
|
+
@subject = '日本語題名'
|
11
|
+
@text = '日本語テキスト'
|
12
12
|
end
|
13
13
|
|
14
|
-
context
|
15
|
-
it
|
16
|
-
email = NormalMailer.msg(@to,
|
14
|
+
context 'PC宛メール' do
|
15
|
+
it '正常に送信できること' do
|
16
|
+
email = NormalMailer.msg(@to, '題名', '本文').deliver_now
|
17
17
|
|
18
18
|
expect(ActionMailer::Base.deliveries.size).to eq(1)
|
19
19
|
expect(email.to - @to).to be_empty
|
20
20
|
end
|
21
21
|
|
22
|
-
it
|
22
|
+
it 'UTF-8のままであること' do
|
23
23
|
email = NormalMailer.msg(@to, @subject, @text).deliver_now
|
24
24
|
|
25
25
|
expect(ActionMailer::Base.deliveries.size).to eq(1)
|
26
26
|
|
27
27
|
raw_mail = ascii_8bit(email.to_s)
|
28
28
|
expect(raw_mail).to match(/UTF-8/i)
|
29
|
-
expect(raw_mail).to match(Regexp.escape(
|
30
|
-
expect(raw_mail).to match(Regexp.escape([@text].pack(
|
29
|
+
expect(raw_mail).to match(Regexp.escape('=E6=97=A5=E6=9C=AC=E8=AA=9E=E9=A1=8C=E5=90=8D'))
|
30
|
+
expect(raw_mail).to match(Regexp.escape([@text].pack('m').strip))
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
ENV['RAILS_ENV'] ||= 'test'
|
3
3
|
require File.expand_path('../../config/environment', __FILE__)
|
4
4
|
# Prevent database truncation if the environment is production
|
5
|
-
abort(
|
5
|
+
abort('The Rails environment is running in production mode!') if Rails.env.production?
|
6
6
|
require 'spec_helper'
|
7
7
|
require 'rspec/rails'
|
8
8
|
# Add additional requires below this line. Rails is not loaded until this point!
|
@@ -1,31 +1,31 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
it
|
5
|
-
get
|
3
|
+
describe 'DoCoMo SH902i からのアクセス', type: :request do
|
4
|
+
it 'request.mobile は Docomo のインスタンスであるべき' do
|
5
|
+
get '/mobile_spec/index', params: {}, env: { 'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH902i(c100;TB;W24H12)' }
|
6
6
|
|
7
7
|
expect(request.mobile).to be_an_instance_of(Jpmobile::Mobile::Docomo)
|
8
8
|
end
|
9
|
-
it
|
10
|
-
get
|
9
|
+
it 'request.mobile? は true であるべき' do
|
10
|
+
get '/mobile_spec/index', params: {}, env: { 'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH902i(c100;TB;W24H12)' }
|
11
11
|
|
12
12
|
expect(request.mobile?).to be_truthy
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
describe
|
16
|
+
describe 'DoCoMo SH902i からguid付きのアクセス', type: :request do
|
17
17
|
before(:each) do
|
18
|
-
@headers = {
|
18
|
+
@headers = { 'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH902i(c100;TB;W24H12)', 'HTTP_X_DCMGUID' => '000000a' }
|
19
19
|
end
|
20
20
|
|
21
|
-
it
|
22
|
-
get
|
21
|
+
it 'guidを正しく取得できること' do
|
22
|
+
get '/mobile_spec/index', params: {}, env: @headers
|
23
23
|
|
24
|
-
expect(request.mobile.guid).to eq(
|
24
|
+
expect(request.mobile.guid).to eq('000000a')
|
25
25
|
end
|
26
|
-
it
|
27
|
-
get
|
26
|
+
it 'ident_subscriberでも正しく取得できること' do
|
27
|
+
get '/mobile_spec/index', params: {}, env: @headers
|
28
28
|
|
29
|
-
expect(request.mobile.ident_subscriber).to eq(
|
29
|
+
expect(request.mobile.ident_subscriber).to eq('000000a')
|
30
30
|
end
|
31
31
|
end
|
@@ -1,50 +1,50 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe 'H11T モバイルブラウザからのアクセス' do
|
4
4
|
before do
|
5
5
|
@headers = {
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
'HTTP_USER_AGENT' => 'emobile/1.0.0 (H11T; like Gecko; Wireless) NetFront/3.4',
|
7
|
+
'HTTP_X_EM_UID' => 'u00000000000000000',
|
8
|
+
'REMOTE_ADDR' => '117.55.1.232',
|
9
9
|
}
|
10
10
|
end
|
11
11
|
|
12
|
-
it
|
13
|
-
get
|
12
|
+
it 'request.mobile は Emobile のインスタンスであること' do
|
13
|
+
get '/mobile_spec/index', params: {}, env: @headers
|
14
14
|
|
15
15
|
expect(request.mobile).to be_an_instance_of(Jpmobile::Mobile::Emobile)
|
16
16
|
end
|
17
|
-
it
|
18
|
-
get
|
17
|
+
it 'request.mobile? は true であること' do
|
18
|
+
get '/mobile_spec/index', params: {}, env: @headers
|
19
19
|
|
20
20
|
expect(request.mobile?).to be_truthy
|
21
21
|
end
|
22
|
-
it
|
23
|
-
get
|
22
|
+
it 'のsubscribe番号を取得できること' do
|
23
|
+
get '/mobile_spec/index', params: {}, env: @headers
|
24
24
|
|
25
|
-
expect(request.mobile.ident_subscriber).to eq(
|
25
|
+
expect(request.mobile.ident_subscriber).to eq('u00000000000000000')
|
26
26
|
end
|
27
|
-
it
|
28
|
-
get
|
27
|
+
it 'のIPアドレス空間を正しく検証できること' do
|
28
|
+
get '/mobile_spec/index', params: {}, env: @headers
|
29
29
|
|
30
30
|
expect(request.mobile.valid_ip?).to be_truthy
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
describe
|
34
|
+
describe 'S11HT からのアクセス' do
|
35
35
|
before do
|
36
36
|
@headers = {
|
37
|
-
|
37
|
+
'HTTP_USER_AGENT' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.7) S11HT',
|
38
38
|
}
|
39
39
|
end
|
40
40
|
|
41
|
-
it
|
42
|
-
get
|
41
|
+
it 'request.mobile は Emobile のインスタンスであること' do
|
42
|
+
get '/mobile_spec/index', params: {}, env: @headers
|
43
43
|
|
44
44
|
expect(request.mobile).to be_an_instance_of(Jpmobile::Mobile::Emobile)
|
45
45
|
end
|
46
|
-
it
|
47
|
-
get
|
46
|
+
it 'request.mobile? は true であること' do
|
47
|
+
get '/mobile_spec/index', params: {}, env: @headers
|
48
48
|
|
49
49
|
expect(request.mobile?).to be_truthy
|
50
50
|
end
|
@@ -1,19 +1,19 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe 'PCからのアクセスの場合', type: :request do
|
4
4
|
before do
|
5
5
|
@headers = {
|
6
|
-
|
6
|
+
'HTTP_USER_AGENT' => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322)',
|
7
7
|
}
|
8
8
|
end
|
9
9
|
|
10
|
-
it
|
11
|
-
get
|
10
|
+
it 'request.mobile は nil であるべき' do
|
11
|
+
get '/mobile_spec/index', params: {}, env: @headers
|
12
12
|
|
13
13
|
expect(request.mobile).to be_nil
|
14
14
|
end
|
15
|
-
it
|
16
|
-
get
|
15
|
+
it 'request.mobile? は false であるべき' do
|
16
|
+
get '/mobile_spec/index', params: {}, env: @headers
|
17
17
|
|
18
18
|
expect(request.mobile?).to be_falsey
|
19
19
|
end
|
@@ -1,17 +1,17 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
it
|
5
|
-
get
|
3
|
+
describe 'Softbank Emulator からのアクセスのとき', type: :request do
|
4
|
+
it 'request.mobile は Softbank のインスタンスであること' do
|
5
|
+
get '/mobile_spec/index', params: {}, env: { 'HTTP_USER_AGENT' => 'Semulator' }
|
6
6
|
|
7
7
|
expect(request.mobile).to be_an_instance_of(Jpmobile::Mobile::Softbank)
|
8
8
|
expect(request.mobile?).to be_truthy
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
describe
|
13
|
-
it
|
14
|
-
get
|
12
|
+
describe 'Vodafone Emulator からのアクセスのとき', type: :request do
|
13
|
+
it 'request.mobile は Vodafone のインスタンスであること' do
|
14
|
+
get '/mobile_spec/index', params: {}, env: { 'HTTP_USER_AGENT' => 'Vemulator' }
|
15
15
|
|
16
16
|
expect(request.mobile).to be_an_instance_of(Jpmobile::Mobile::Vodafone)
|
17
17
|
expect(request.mobile?).to be_truthy
|
@@ -1,92 +1,92 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe TemplatePathController,
|
3
|
+
describe TemplatePathController, 'integrated_views', type: :request do
|
4
4
|
before do
|
5
5
|
page.driver.header('User-Agent', user_agent)
|
6
6
|
end
|
7
7
|
|
8
|
-
describe
|
9
|
-
context
|
8
|
+
describe 'index' do
|
9
|
+
context 'PCからのアクセスの場合' do
|
10
10
|
let(:user_agent) do
|
11
|
-
|
11
|
+
'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322)'
|
12
12
|
end
|
13
13
|
it 'index.html.erbが使用されること' do
|
14
|
-
visit
|
14
|
+
visit '/template_path/index'
|
15
15
|
|
16
|
-
expect(page).to have_content(
|
16
|
+
expect(page).to have_content('index.html.erb')
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
context
|
20
|
+
context 'DoCoMoからのアクセスの場合' do
|
21
21
|
let(:user_agent) do
|
22
|
-
|
22
|
+
'DoCoMo/2.0 SH902i(c100;TB;W24H12)'
|
23
23
|
end
|
24
24
|
it 'index_mobile_docomo.html.erbが使用されること' do
|
25
|
-
visit
|
25
|
+
visit '/template_path/index'
|
26
26
|
|
27
|
-
expect(page).to have_content(
|
27
|
+
expect(page).to have_content('index_mobile_docomo.html.erb')
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'show.html.erb がなくとも show_mobile_docomo.html.erbが使用されること' do
|
31
|
-
visit
|
31
|
+
visit '/template_path/show'
|
32
32
|
|
33
|
-
expect(page).to have_content(
|
33
|
+
expect(page).to have_content('show_mobile_docomo.html.erb')
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'disable_mobile_view! のときには index.html.erb が使用されること' do
|
37
|
-
visit
|
37
|
+
visit '/template_path/index?pc=true'
|
38
38
|
|
39
|
-
expect(page).to have_content(
|
39
|
+
expect(page).to have_content('index.html.erb')
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
context
|
43
|
+
context 'SoftBankからのアクセスの場合' do
|
44
44
|
let(:user_agent) do
|
45
|
-
|
45
|
+
'SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1'
|
46
46
|
end
|
47
47
|
it 'index_mobile.html.erbが使用されること' do
|
48
|
-
visit
|
48
|
+
visit '/template_path/index'
|
49
49
|
|
50
|
-
expect(page).to have_content(
|
50
|
+
expect(page).to have_content('index_mobile.html.erb')
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'show.html.erb がなくとも show_mobile.html.erbが使用されること' do
|
54
|
-
visit
|
54
|
+
visit '/template_path/show'
|
55
55
|
|
56
|
-
expect(page).to have_content(
|
56
|
+
expect(page).to have_content('show_mobile.html.erb')
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
context
|
60
|
+
context 'iPhoneからのアクセスの場合' do
|
61
61
|
let(:user_agent) do
|
62
62
|
'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'
|
63
63
|
end
|
64
64
|
it 'smart_phone_iphone.html.erbが使用されること' do
|
65
|
-
visit
|
65
|
+
visit '/template_path/index'
|
66
66
|
|
67
|
-
expect(page).to have_content(
|
67
|
+
expect(page).to have_content('smart_phone_iphone.html.erb')
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
context
|
71
|
+
context 'Androidからのアクセスの場合' do
|
72
72
|
let(:user_agent) do
|
73
73
|
'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'
|
74
74
|
end
|
75
75
|
it 'smart_phone.html.erbが使用されること' do
|
76
|
-
visit
|
76
|
+
visit '/template_path/index'
|
77
77
|
|
78
|
-
expect(page).to have_content(
|
78
|
+
expect(page).to have_content('smart_phone.html.erb')
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
context
|
82
|
+
context 'Windows Phoneからのアクセスの場合' do
|
83
83
|
let(:user_agent) do
|
84
84
|
'Mozilla/4.0 (Compatible; MSIE 6.0; Windows NT 5.1 T-01A_6.5; Windows Phone 6.5)'
|
85
85
|
end
|
86
86
|
it 'smart_phone.html.erbが使用されること' do
|
87
|
-
visit
|
87
|
+
visit '/template_path/index'
|
88
88
|
|
89
|
-
expect(page).to have_content(
|
89
|
+
expect(page).to have_content('smart_phone.html.erb')
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
@@ -163,94 +163,94 @@ describe TemplatePathController, "integrated_views", type: :request do
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
-
context
|
167
|
-
context
|
166
|
+
context 'partial' do
|
167
|
+
context 'PCからのアクセスの場合' do
|
168
168
|
let(:user_agent) do
|
169
|
-
|
169
|
+
'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322)'
|
170
170
|
end
|
171
171
|
it '_partial.html.erbが使用されること' do
|
172
|
-
visit
|
172
|
+
visit '/template_path/partial'
|
173
173
|
|
174
|
-
expect(page).to have_content(
|
174
|
+
expect(page).to have_content('_partial.html.erb')
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
178
|
-
context
|
178
|
+
context 'DoCoMoからのアクセスの場合' do
|
179
179
|
let(:user_agent) do
|
180
|
-
|
180
|
+
'DoCoMo/2.0 SH902i(c100;TB;W24H12)'
|
181
181
|
end
|
182
182
|
it '_partial_mobile_docomo.html.erbが使用されること' do
|
183
|
-
visit
|
183
|
+
visit '/template_path/partial'
|
184
184
|
|
185
|
-
expect(page).to have_content(
|
185
|
+
expect(page).to have_content('_partial_mobile_docomo.html.erb')
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
189
|
-
context
|
189
|
+
context 'SoftBankからのアクセスの場合' do
|
190
190
|
let(:user_agent) do
|
191
|
-
|
191
|
+
'SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1'
|
192
192
|
end
|
193
193
|
it '_partial_mobile.html.erbが使用されること' do
|
194
|
-
visit
|
194
|
+
visit '/template_path/partial'
|
195
195
|
|
196
|
-
expect(page).to have_content(
|
196
|
+
expect(page).to have_content('_partial_mobile.html.erb')
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
|
-
context
|
200
|
+
context 'iPhoneからのアクセスの場合' do
|
201
201
|
let(:user_agent) do
|
202
202
|
'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'
|
203
203
|
end
|
204
204
|
it '_partial_smart_phone_iphone.html.erbが使用されること' do
|
205
|
-
visit
|
205
|
+
visit '/template_path/partial'
|
206
206
|
|
207
|
-
expect(page).to have_content(
|
207
|
+
expect(page).to have_content('_partial_smart_phone_iphone.html.erb')
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
211
|
-
context
|
211
|
+
context 'Androidからのアクセスの場合' do
|
212
212
|
let(:user_agent) do
|
213
213
|
'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'
|
214
214
|
end
|
215
215
|
it '_partial_smart_phone.html.erbが使用されること' do
|
216
|
-
visit
|
216
|
+
visit '/template_path/partial'
|
217
217
|
|
218
|
-
expect(page).to have_content(
|
218
|
+
expect(page).to have_content('_partial_smart_phone.html.erb')
|
219
219
|
end
|
220
220
|
end
|
221
221
|
|
222
|
-
context
|
222
|
+
context 'Windows Phoneからのアクセスの場合' do
|
223
223
|
let(:user_agent) do
|
224
224
|
'Mozilla/4.0 (Compatible; MSIE 6.0; Windows NT 5.1 T-01A_6.5; Windows Phone 6.5)'
|
225
225
|
end
|
226
226
|
it '_partial_smart_phone.html.erbが使用されること' do
|
227
|
-
visit
|
227
|
+
visit '/template_path/partial'
|
228
228
|
|
229
|
-
expect(page).to have_content(
|
229
|
+
expect(page).to have_content('_partial_smart_phone.html.erb')
|
230
230
|
end
|
231
231
|
end
|
232
232
|
end
|
233
233
|
|
234
|
-
context
|
235
|
-
context
|
234
|
+
context 'full_path_partial' do
|
235
|
+
context 'PCからのアクセスの場合' do
|
236
236
|
let(:user_agent) do
|
237
|
-
|
237
|
+
'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322)'
|
238
238
|
end
|
239
239
|
it '_partial.html.erbが使用されること' do
|
240
|
-
visit
|
240
|
+
visit '/template_path/full_path_partial'
|
241
241
|
|
242
|
-
expect(page).to have_content(
|
242
|
+
expect(page).to have_content('_partial.html.erb')
|
243
243
|
end
|
244
244
|
end
|
245
245
|
|
246
|
-
context
|
246
|
+
context 'DoCoMoからのアクセスの場合' do
|
247
247
|
let(:user_agent) do
|
248
|
-
|
248
|
+
'DoCoMo/2.0 SH902i(c100;TB;W24H12)'
|
249
249
|
end
|
250
250
|
it '_partial_mobile_docomo.html.erbが使用されること' do
|
251
|
-
visit
|
251
|
+
visit '/template_path/full_path_partial'
|
252
252
|
|
253
|
-
expect(page).to have_content(
|
253
|
+
expect(page).to have_content('_partial_mobile_docomo.html.erb')
|
254
254
|
end
|
255
255
|
end
|
256
256
|
end
|