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,33 +1,33 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe NormalMailer, :type => :mailer do
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 = ["outer@jp.mobile", "outer1@jp.mobile"]
10
- @subject = "日本語題名"
11
- @text = "日本語テキスト"
9
+ @to = ['outer@jp.mobile', 'outer1@jp.mobile']
10
+ @subject = '日本語題名'
11
+ @text = '日本語テキスト'
12
12
  end
13
13
 
14
- context "PC宛メール" do
15
- it "正常に送信できること" do
16
- email = NormalMailer.msg(@to, "題名", "本文").deliver_now
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 "UTF-8のままであること" do
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("=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))
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("The Rails environment is running in production mode!") if Rails.env.production?
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 "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)"}
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 "request.mobile? は true であるべき" do
10
- get "/mobile_spec/index", params: {}, env: {"HTTP_USER_AGENT" => "DoCoMo/2.0 SH902i(c100;TB;W24H12)"}
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 "DoCoMo SH902i からguid付きのアクセス", type: :request do
16
+ describe 'DoCoMo SH902i からguid付きのアクセス', type: :request do
17
17
  before(:each) do
18
- @headers = {"HTTP_USER_AGENT" => "DoCoMo/2.0 SH902i(c100;TB;W24H12)", 'HTTP_X_DCMGUID' => "000000a"}
18
+ @headers = { 'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH902i(c100;TB;W24H12)', 'HTTP_X_DCMGUID' => '000000a' }
19
19
  end
20
20
 
21
- it "guidを正しく取得できること" do
22
- get "/mobile_spec/index", params: {}, env: @headers
21
+ it 'guidを正しく取得できること' do
22
+ get '/mobile_spec/index', params: {}, env: @headers
23
23
 
24
- expect(request.mobile.guid).to eq("000000a")
24
+ expect(request.mobile.guid).to eq('000000a')
25
25
  end
26
- it "ident_subscriberでも正しく取得できること" do
27
- get "/mobile_spec/index", params: {}, env: @headers
26
+ it 'ident_subscriberでも正しく取得できること' do
27
+ get '/mobile_spec/index', params: {}, env: @headers
28
28
 
29
- expect(request.mobile.ident_subscriber).to eq("000000a")
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 "H11T モバイルブラウザからのアクセス" do
3
+ describe 'H11T モバイルブラウザからのアクセス' do
4
4
  before do
5
5
  @headers = {
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",
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 "request.mobile は Emobile のインスタンスであること" do
13
- get "/mobile_spec/index", params: {}, env: @headers
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 "request.mobile? は true であること" do
18
- get "/mobile_spec/index", params: {}, env: @headers
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 "のsubscribe番号を取得できること" do
23
- get "/mobile_spec/index", params: {}, env: @headers
22
+ it 'のsubscribe番号を取得できること' do
23
+ get '/mobile_spec/index', params: {}, env: @headers
24
24
 
25
- expect(request.mobile.ident_subscriber).to eq("u00000000000000000")
25
+ expect(request.mobile.ident_subscriber).to eq('u00000000000000000')
26
26
  end
27
- it "のIPアドレス空間を正しく検証できること" do
28
- get "/mobile_spec/index", params: {}, env: @headers
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 "S11HT からのアクセス" do
34
+ describe 'S11HT からのアクセス' do
35
35
  before do
36
36
  @headers = {
37
- "HTTP_USER_AGENT" => "Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.7) S11HT",
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 "request.mobile は Emobile のインスタンスであること" do
42
- get "/mobile_spec/index", params: {}, env: @headers
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 "request.mobile? は true であること" do
47
- get "/mobile_spec/index", params: {}, env: @headers
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 "PCからのアクセスの場合", type: :request do
3
+ describe 'PCからのアクセスの場合', type: :request do
4
4
  before do
5
5
  @headers = {
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)",
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 "request.mobile は nil であるべき" do
11
- get "/mobile_spec/index", params: {}, env: @headers
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 "request.mobile? は false であるべき" do
16
- get "/mobile_spec/index", params: {}, env: @headers
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 "Softbank Emulator からのアクセスのとき", type: :request do
4
- it "request.mobile は Softbank のインスタンスであること" do
5
- get "/mobile_spec/index", params: {}, env: {"HTTP_USER_AGENT" => "Semulator"}
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 "Vodafone Emulator からのアクセスのとき", type: :request do
13
- it "request.mobile は Vodafone のインスタンスであること" do
14
- get "/mobile_spec/index", params: {}, env: {"HTTP_USER_AGENT" => "Vemulator"}
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, "integrated_views", type: :request do
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 "index" do
9
- context "PCからのアクセスの場合" do
8
+ describe 'index' do
9
+ context 'PCからのアクセスの場合' do
10
10
  let(:user_agent) do
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)"
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 "/template_path/index"
14
+ visit '/template_path/index'
15
15
 
16
- expect(page).to have_content("index.html.erb")
16
+ expect(page).to have_content('index.html.erb')
17
17
  end
18
18
  end
19
19
 
20
- context "DoCoMoからのアクセスの場合" do
20
+ context 'DoCoMoからのアクセスの場合' do
21
21
  let(:user_agent) do
22
- "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
22
+ 'DoCoMo/2.0 SH902i(c100;TB;W24H12)'
23
23
  end
24
24
  it 'index_mobile_docomo.html.erbが使用されること' do
25
- visit "/template_path/index"
25
+ visit '/template_path/index'
26
26
 
27
- expect(page).to have_content("index_mobile_docomo.html.erb")
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 "/template_path/show"
31
+ visit '/template_path/show'
32
32
 
33
- expect(page).to have_content("show_mobile_docomo.html.erb")
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 "/template_path/index?pc=true"
37
+ visit '/template_path/index?pc=true'
38
38
 
39
- expect(page).to have_content("index.html.erb")
39
+ expect(page).to have_content('index.html.erb')
40
40
  end
41
41
  end
42
42
 
43
- context "SoftBankからのアクセスの場合" do
43
+ context 'SoftBankからのアクセスの場合' do
44
44
  let(:user_agent) do
45
- "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1"
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 "/template_path/index"
48
+ visit '/template_path/index'
49
49
 
50
- expect(page).to have_content("index_mobile.html.erb")
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 "/template_path/show"
54
+ visit '/template_path/show'
55
55
 
56
- expect(page).to have_content("show_mobile.html.erb")
56
+ expect(page).to have_content('show_mobile.html.erb')
57
57
  end
58
58
  end
59
59
 
60
- context "iPhoneからのアクセスの場合" do
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 "/template_path/index"
65
+ visit '/template_path/index'
66
66
 
67
- expect(page).to have_content("smart_phone_iphone.html.erb")
67
+ expect(page).to have_content('smart_phone_iphone.html.erb')
68
68
  end
69
69
  end
70
70
 
71
- context "Androidからのアクセスの場合" do
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 "/template_path/index"
76
+ visit '/template_path/index'
77
77
 
78
- expect(page).to have_content("smart_phone.html.erb")
78
+ expect(page).to have_content('smart_phone.html.erb')
79
79
  end
80
80
  end
81
81
 
82
- context "Windows Phoneからのアクセスの場合" do
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 "/template_path/index"
87
+ visit '/template_path/index'
88
88
 
89
- expect(page).to have_content("smart_phone.html.erb")
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 "partial" do
167
- context "PCからのアクセスの場合" do
166
+ context 'partial' do
167
+ context 'PCからのアクセスの場合' do
168
168
  let(:user_agent) do
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)"
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 "/template_path/partial"
172
+ visit '/template_path/partial'
173
173
 
174
- expect(page).to have_content("_partial.html.erb")
174
+ expect(page).to have_content('_partial.html.erb')
175
175
  end
176
176
  end
177
177
 
178
- context "DoCoMoからのアクセスの場合" do
178
+ context 'DoCoMoからのアクセスの場合' do
179
179
  let(:user_agent) do
180
- "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
180
+ 'DoCoMo/2.0 SH902i(c100;TB;W24H12)'
181
181
  end
182
182
  it '_partial_mobile_docomo.html.erbが使用されること' do
183
- visit "/template_path/partial"
183
+ visit '/template_path/partial'
184
184
 
185
- expect(page).to have_content("_partial_mobile_docomo.html.erb")
185
+ expect(page).to have_content('_partial_mobile_docomo.html.erb')
186
186
  end
187
187
  end
188
188
 
189
- context "SoftBankからのアクセスの場合" do
189
+ context 'SoftBankからのアクセスの場合' do
190
190
  let(:user_agent) do
191
- "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1"
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 "/template_path/partial"
194
+ visit '/template_path/partial'
195
195
 
196
- expect(page).to have_content("_partial_mobile.html.erb")
196
+ expect(page).to have_content('_partial_mobile.html.erb')
197
197
  end
198
198
  end
199
199
 
200
- context "iPhoneからのアクセスの場合" do
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 "/template_path/partial"
205
+ visit '/template_path/partial'
206
206
 
207
- expect(page).to have_content("_partial_smart_phone_iphone.html.erb")
207
+ expect(page).to have_content('_partial_smart_phone_iphone.html.erb')
208
208
  end
209
209
  end
210
210
 
211
- context "Androidからのアクセスの場合" do
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 "/template_path/partial"
216
+ visit '/template_path/partial'
217
217
 
218
- expect(page).to have_content("_partial_smart_phone.html.erb")
218
+ expect(page).to have_content('_partial_smart_phone.html.erb')
219
219
  end
220
220
  end
221
221
 
222
- context "Windows Phoneからのアクセスの場合" do
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 "/template_path/partial"
227
+ visit '/template_path/partial'
228
228
 
229
- expect(page).to have_content("_partial_smart_phone.html.erb")
229
+ expect(page).to have_content('_partial_smart_phone.html.erb')
230
230
  end
231
231
  end
232
232
  end
233
233
 
234
- context "full_path_partial" do
235
- context "PCからのアクセスの場合" do
234
+ context 'full_path_partial' do
235
+ context 'PCからのアクセスの場合' do
236
236
  let(:user_agent) do
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)"
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 "/template_path/full_path_partial"
240
+ visit '/template_path/full_path_partial'
241
241
 
242
- expect(page).to have_content("_partial.html.erb")
242
+ expect(page).to have_content('_partial.html.erb')
243
243
  end
244
244
  end
245
245
 
246
- context "DoCoMoからのアクセスの場合" do
246
+ context 'DoCoMoからのアクセスの場合' do
247
247
  let(:user_agent) do
248
- "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
248
+ 'DoCoMo/2.0 SH902i(c100;TB;W24H12)'
249
249
  end
250
250
  it '_partial_mobile_docomo.html.erbが使用されること' do
251
- visit "/template_path/full_path_partial"
251
+ visit '/template_path/full_path_partial'
252
252
 
253
- expect(page).to have_content("_partial_mobile_docomo.html.erb")
253
+ expect(page).to have_content('_partial_mobile_docomo.html.erb')
254
254
  end
255
255
  end
256
256
  end