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
@@ -0,0 +1,54 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) do |repo_name|
4
+ repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
5
+ "https://github.com/#{repo_name}.git"
6
+ end
7
+
8
+
9
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
10
+ gem 'rails', '~> 5.0.3'
11
+ # Use sqlite3 as the database for Active Record
12
+ gem 'sqlite3', '~> 1.3.6'
13
+ # Use Puma as the app server
14
+ gem 'puma', '~> 3.0'
15
+ # Use SCSS for stylesheets
16
+ gem 'sass-rails', '~> 5.0'
17
+ # Use Uglifier as compressor for JavaScript assets
18
+ gem 'uglifier', '>= 1.3.0'
19
+ # Use CoffeeScript for .coffee assets and views
20
+ gem 'coffee-rails', '~> 4.2'
21
+ # See https://github.com/rails/execjs#readme for more supported runtimes
22
+ # gem 'therubyracer', platforms: :ruby
23
+
24
+ # Use jquery as the JavaScript library
25
+ gem 'jquery-rails'
26
+ # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
27
+ gem 'turbolinks', '~> 5'
28
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
29
+ gem 'jbuilder', '~> 2.5'
30
+ # Use Redis adapter to run Action Cable in production
31
+ # gem 'redis', '~> 3.0'
32
+ # Use ActiveModel has_secure_password
33
+ # gem 'bcrypt', '~> 3.1.7'
34
+
35
+ # Use Capistrano for deployment
36
+ # gem 'capistrano-rails', group: :development
37
+
38
+ group :development, :test do
39
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
40
+ gem 'byebug', platform: :mri
41
+ end
42
+
43
+ group :development do
44
+ # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
45
+ gem 'web-console', '>= 3.3.0'
46
+ gem 'listen', '~> 3.0.5'
47
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
48
+ gem 'spring'
49
+ gem 'spring-watcher-listen', '~> 2.0.0'
50
+ end
51
+
52
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
53
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
54
+ instance_eval File.read(File.expand_path(__FILE__) + '.jpmobile')
@@ -11,8 +11,7 @@ gem 'pry-byebug'
11
11
 
12
12
  # Bundle gems for certain environments:
13
13
  group :development, :test do
14
- gem "rspec-rails", '3.5.0.beta4'
15
- gem 'capybara'
14
+ gem "rspec-rails"
16
15
  gem 'capybara-webkit'
17
16
  gem 'rails-controller-testing'
18
17
  end
@@ -1,5 +1,5 @@
1
1
  class Admin::TopController < ApplicationController
2
2
  def full_path
3
- render "/template_path/full_path_partial"
3
+ render '/template_path/full_path_partial'
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  class DocomoGuidBaseController < ApplicationController
2
2
  def link
3
- render :inline=>%{<%= link_to "linkto" %>}
3
+ render inline: %(<%= link_to "linkto" %>)
4
4
  end
5
5
  end
@@ -1,38 +1,46 @@
1
- # -*- coding: utf-8 -*-
2
1
  class FilterControllerBase < ApplicationController
3
2
  def abracadabra_utf8
4
- @text = "アブラカダブラ"
3
+ @text = 'アブラカダブラ'
5
4
  render 'filter/text_template'
6
5
  end
6
+
7
7
  def abracadabra_xhtml_utf8
8
- response.content_type = "application/xhtml+xml"
9
- @text = "アブラカダブラ"
8
+ response.content_type = 'application/xhtml+xml'
9
+ @text = 'アブラカダブラ'
10
10
  render 'filter/text_template'
11
11
  end
12
+
12
13
  def index
13
14
  @q = params[:q]
14
15
  render plain: @q
15
16
  end
17
+
16
18
  def index_hankaku
17
19
  render plain: 'アブラカダブラ' == params[:q]
18
20
  end
21
+
19
22
  def index_zenkaku
20
23
  render plain: 'アブラカダブラ' == params[:q]
21
24
  end
25
+
22
26
  def empty
23
- render plain: ""
27
+ render plain: ''
24
28
  end
29
+
25
30
  def rawdata
26
- send_data "アブラカダブラ", :type => 'application/octet-stream'
31
+ send_data 'アブラカダブラ', type: 'application/octet-stream'
27
32
  end
33
+
28
34
  def textarea
29
35
  @text = '<textarea hoge="fuu">アブラカダブラ</textarea>'.html_safe
30
36
  render 'filter/text_template'
31
37
  end
38
+
32
39
  def input_tag
33
40
  @text = '<input hoge="fuu" value="アブラカダブラ" />'.html_safe
34
41
  render 'filter/text_template'
35
42
  end
43
+
36
44
  def nbsp_char
37
45
  @text = '<a>アブラ&nbsp;カダブラ</a>'.html_safe
38
46
  render 'filter/text_template'
@@ -2,7 +2,7 @@ class HankakuInputFilterController < FilterControllerBase
2
2
  hankaku_filter input: true
3
3
 
4
4
  def index_xhtml
5
- render "index_xhtml", layout: "xhtml"
5
+ render 'index_xhtml', layout: 'xhtml'
6
6
  end
7
7
 
8
8
  def with_charset
@@ -5,7 +5,7 @@ class MobileSpecController < ApplicationController
5
5
  end
6
6
 
7
7
  def file_render
8
- render :file => File.join(Rails.public_path, '422')
8
+ render file: File.join(Rails.public_path, '422')
9
9
  end
10
10
 
11
11
  def no_mobile
@@ -11,7 +11,7 @@ class TemplatePathController < ApplicationController
11
11
  end
12
12
 
13
13
  def optioned_index
14
- render :action => "index"
14
+ render action: 'index'
15
15
  end
16
16
 
17
17
  def full_path_partial
@@ -26,4 +26,3 @@ class TemplatePathController < ApplicationController
26
26
  def with_ipd
27
27
  end
28
28
  end
29
-
@@ -1,44 +1,52 @@
1
- # -*- coding: utf-8 -*-
2
1
  class TransSidBaseController < ApplicationController
3
2
  # 事前にセッションを作成しないと trans_sid が有効にならない
4
3
  before_action :session_init
5
4
 
6
5
  def form
7
- render :inline=>%{<%= form_tag do %>Hello<% end %>}
6
+ render inline: %(<%= form_tag do %>Hello<% end %>)
8
7
  end
8
+
9
9
  def link
10
- render :inline=>%{<%= link_to "linkto" %>}
10
+ render inline: %(<%= link_to "linkto" %>)
11
11
  end
12
+
12
13
  def redirect
13
14
  redirect_to('/')
14
15
  end
16
+
15
17
  def session_init
16
- session[:jpmobile] = "everyleaf"
17
- @user = User.find(1) rescue User.create(:id => 1, :name => "everyleaf")
18
+ session[:jpmobile] = 'everyleaf'
19
+ @user = User.find_by_id(1)
20
+ unless @user
21
+ @user = User.create(id: 1, name: 'everyleaf')
22
+ end
18
23
  end
19
24
 
20
25
  def form_path
21
- render :inline=>%{<%= form_for @user do %>Hello<% end %>}
26
+ render inline: %(<%= form_for @user do %>Hello<% end %>)
22
27
  end
28
+
23
29
  def form_path_admin
24
- render :inline=>%{<%= form_for [:admin, @user] do %>Hello<% end %>}
30
+ render inline: %(<%= form_for [:admin, @user] do %>Hello<% end %>)
25
31
  end
26
32
 
27
33
  def link_path
28
- render :inline => %{<%= link_to "linkto", @user -%>}
34
+ render inline: %(<%= link_to "linkto", @user -%>)
29
35
  end
36
+
30
37
  def link_path_admin
31
- render :inline => %{<%= link_to "linkto", [:admin, @user] -%>}
38
+ render inline: %(<%= link_to "linkto", [:admin, @user] -%>)
32
39
  end
33
40
 
34
41
  def redirect_path
35
42
  redirect_to @user
36
43
  end
44
+
37
45
  def redirect_path_admin
38
46
  redirect_to [:admin, @user]
39
47
  end
40
48
 
41
49
  def redirect_action
42
- redirect_to :action => "form"
50
+ redirect_to action: 'form'
43
51
  end
44
52
  end
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  class TransSidMetalController < ActionController::Metal
3
2
  include ActionController::UrlFor
4
3
  include ActionController::Redirecting
@@ -1,11 +1,10 @@
1
- # -*- coding: utf-8 -*-
2
1
  class DecoratedMailer < Jpmobile::Mailer::Base
3
- default :from => "info@jp.mobile"
4
- default :to => "info@jp.mobile"
2
+ default from: 'info@jp.mobile'
3
+ default to: 'info@jp.mobile'
5
4
 
6
5
  def deco_mail(to_mail)
7
6
  attachments.inline['photo.jpg'] = open(File.join(Rails.root, 'spec/fixtures/mobile_mailer/photo.jpg')).read
8
7
 
9
- mail(:to => to_mail, :subject => '題名', :decorated => true)
8
+ mail(to: to_mail, subject: '題名', decorated: true)
10
9
  end
11
10
  end
@@ -1,11 +1,10 @@
1
- # -*- coding: utf-8 -*-
2
1
  class MobileMailer < Jpmobile::Mailer::Base
3
- default :from => "info@jp.mobile"
4
- default :to => "info@jp.mobile"
2
+ default from: 'info@jp.mobile'
3
+ default to: 'info@jp.mobile'
5
4
 
6
5
  def view_selection(to_mail, subject_text, text)
7
6
  @text = text
8
- mail(:to => to_mail, :subject => subject_text)
7
+ mail(to: to_mail, subject: subject_text)
9
8
  end
10
9
 
11
10
  def receive(email)
@@ -15,11 +14,11 @@ class MobileMailer < Jpmobile::Mailer::Base
15
14
  def multi_message(to_mail, subject_text, text, html)
16
15
  @html = html
17
16
  @text = text
18
- mail(:to => to_mail, :subject => subject_text)
17
+ mail(to: to_mail, subject: subject_text)
19
18
  end
20
19
 
21
20
  def default_to_mail(subject_text, text)
22
21
  @text = text
23
- mail(:subject => subject_text)
22
+ mail(subject: subject_text)
24
23
  end
25
24
  end
@@ -1,9 +1,8 @@
1
- # -*- coding: utf-8 -*-
2
1
  class NormalMailer < ActionMailer::Base
3
- default :from => "info@jp.mobile"
2
+ default from: 'info@jp.mobile'
4
3
 
5
4
  def msg(to_mail, subject_text, text)
6
5
  @text = text
7
- mail(:to => to_mail, :subject => subject_text)
6
+ mail(to: to_mail, subject: subject_text)
8
7
  end
9
8
  end
@@ -1,2 +1,2 @@
1
- Autotest.add_discovery { "rails" }
2
- Autotest.add_discovery { "rspec2" }
1
+ Autotest.add_discovery { 'rails' }
2
+ Autotest.add_discovery { 'rspec2' }
@@ -4,9 +4,9 @@ Rails.application.config.jpmobile.form_accept_charset_conversion = true
4
4
  Rails.application.config.jpmobile.session_store do
5
5
  # # MemCacheStore
6
6
  # require 'jpmobile/session/mem_cache_store'
7
- # ActionDispatch::Session::MemCacheStore.send :include, Jpmobile::TransSid::ParamsOverCookie
7
+ # ActionDispatch::Session::MemCacheStore.send :prepend, Jpmobile::TransSid::ParamsOverCookie
8
8
 
9
9
  # # ActiveRecordStore
10
10
  # require 'jpmobile/session/active_record_store'
11
- # ActionDispatch::Session::AbstractStore.send :include, Jpmobile::TransSid::ParamsOverCookie
11
+ # ActionDispatch::Session::AbstractStore.send :prepend, Jpmobile::TransSid::ParamsOverCookie
12
12
  end
@@ -4,8 +4,101 @@ RailsRoot::Application.routes.draw do
4
4
  resources :users
5
5
 
6
6
  controller :top do
7
- get 'top/:action'
7
+ get 'top/full_path', to: 'top#full_path'
8
+ end
9
+ end
10
+
11
+ # get ':controller(/:action(/:id(.:format)))'
12
+
13
+ get 'trans_sid_metal/redirect', to: 'trans_sid_metal#redirect'
14
+
15
+ %w[
16
+ trans_sid_base
17
+ trans_sid_always_and_session_off
18
+ trans_sid_always
19
+ trans_sid_metal
20
+ trans_sid_mobile
21
+ trans_sid_none
22
+ ].each do |c|
23
+ %w[
24
+ form
25
+ link
26
+ redirect
27
+ form_path
28
+ form_path_admin
29
+ link_path
30
+ link_path_admin
31
+ redirect_path
32
+ redirect_path_admin
33
+ redirect_action
34
+ ].each do |a|
35
+ get "#{c}/#{a}", to: "#{c}##{a}"
36
+ end
37
+ end
38
+
39
+ %w[
40
+ docomo_guid_base
41
+ docomo_guid_always
42
+ docomo_guid_docomo
43
+ ].each do |c|
44
+ get "#{c}/link", to: "#{c}#link"
45
+ end
46
+
47
+ %w[
48
+ show_all
49
+ link
50
+ docomo_utn
51
+ docomo_openiarea
52
+ docomo_foma_gps
53
+ au_location
54
+ au_gps
55
+ softbank_location
56
+ willcom_location
57
+ ].each do |a|
58
+ get "links/#{a}", to: "links##{a}"
59
+ end
60
+
61
+ %w[
62
+ index
63
+ file_render
64
+ no_mobile
65
+ ].each do |a|
66
+ get "mobile_spec/#{a}", to: "mobile_spec##{a}"
67
+ end
68
+
69
+ %w[
70
+ index
71
+ show
72
+ optioned_index
73
+ full_path_partial
74
+ smart_phone_only
75
+ with_tblt
76
+ with_ipd
77
+ partial
78
+ ].each do |a|
79
+ get "template_path/#{a}", to: "template_path##{a}"
80
+ end
81
+
82
+ %w[
83
+ filter
84
+ hankaku_filter
85
+ hankaku_input_filter
86
+ ].each do |c|
87
+ %w[
88
+ abracadabra_utf8
89
+ abracadabra_xhtml_utf8
90
+ index
91
+ index_hankaku
92
+ index_zenkaku
93
+ empty
94
+ rawdata
95
+ textarea
96
+ input_tag
97
+ nbsp_char
98
+ index_xhtml
99
+ with_charset
100
+ ].each do |a|
101
+ get "#{c}/#{a}", to: "#{c}##{a}"
8
102
  end
9
103
  end
10
- get ':controller(/:action(/:id(.:format)))'
11
104
  end
@@ -1,7 +1,7 @@
1
- class AddSessionsTable < ActiveRecord::Migration
1
+ class AddSessionsTable < ActiveRecord::Migration[5.0]
2
2
  def change
3
3
  create_table :sessions do |t|
4
- t.string :session_id, :null => false
4
+ t.string :session_id, null: false
5
5
  t.text :data
6
6
 
7
7
  t.timestamps null: false
@@ -1,4 +1,4 @@
1
- class CreateUsers < ActiveRecord::Migration
1
+ class CreateUsers < ActiveRecord::Migration[5.0]
2
2
  def change
3
3
  create_table :users do |t|
4
4
  t.string :name
@@ -1,56 +1,55 @@
1
- # -*- coding: utf-8 -*-
2
1
  require 'rails_helper'
3
2
 
4
- shared_examples_for "docomo_guid が起動しないとき" do
3
+ shared_examples_for 'docomo_guid が起動しないとき' do
5
4
  render_views
6
5
 
7
- it "で link_to の自動書き換えが行われない" do
6
+ it 'で link_to の自動書き換えが行われない' do
8
7
  get :link
9
8
 
10
- expect(response.body).to match(/href=\".+\/link\"/)
9
+ expect(response.body).to match(%r{href=\".+/link\"})
11
10
  end
12
11
  end
13
12
 
14
- shared_examples_for "docomo_guid が起動するとき" do
15
- it "で link_to の自動書き換えが行われる" do
13
+ shared_examples_for 'docomo_guid が起動するとき' do
14
+ it 'で link_to の自動書き換えが行われる' do
16
15
  get :link
17
16
 
18
- expect(response.body).to match(/href=\".+\/link\?guid=ON\"/)
17
+ expect(response.body).to match(%r{href=\".+/link\?guid=ON\"})
19
18
  end
20
19
  end
21
20
 
22
- describe DocomoGuidBaseController, :type => :controller do
21
+ describe DocomoGuidBaseController, type: :controller do
23
22
  before(:each) do
24
- 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)"
23
+ 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)'
25
24
  end
26
25
 
27
- it "の docomo_guid_mode は nil" do
26
+ it 'の docomo_guid_mode は nil' do
28
27
  get :link
29
28
 
30
29
  expect(controller.docomo_guid_mode).to be_nil
31
30
  end
32
- it_should_behave_like "docomo_guid が起動しないとき"
31
+ it_should_behave_like 'docomo_guid が起動しないとき'
33
32
  end
34
33
 
35
- describe DocomoGuidAlwaysController, :type => :controller do
34
+ describe DocomoGuidAlwaysController, type: :controller do
36
35
  before(:each) do
37
- 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)"
36
+ 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)'
38
37
  end
39
38
 
40
- it "の docomo_guid_always は :always" do
39
+ it 'の docomo_guid_always は :always' do
41
40
  get :link
42
41
 
43
42
  expect(controller.docomo_guid_mode).to eq(:always)
44
43
  end
45
- it_should_behave_like "docomo_guid が起動するとき"
44
+ it_should_behave_like 'docomo_guid が起動するとき'
46
45
  end
47
46
 
48
- describe DocomoGuidDocomoController, :type => :controller do
47
+ describe DocomoGuidDocomoController, type: :controller do
49
48
  before(:each) do
50
- 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)"
49
+ 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
50
  end
52
51
 
53
- it "の docomo_guid_mode は :docomo" do
52
+ it 'の docomo_guid_mode は :docomo' do
54
53
  get :link
55
54
 
56
55
  expect(controller.docomo_guid_mode).to eq(:docomo)
@@ -64,11 +63,11 @@ describe DocomoGuidDocomoController, :type => :controller do
64
63
  it_should_behave_like example_name
65
64
  end
66
65
 
67
- it_should_behave_like 'describe_mobile_with_ua', "DoCoMo/2.0 SH902i(c100;TB;W24H12)", "docomo_guid が起動するとき"
68
- it_should_behave_like 'describe_mobile_with_ua', "J-PHONE/3.0/V301D", "docomo_guid が起動しないとき"
69
- it_should_behave_like 'describe_mobile_with_ua', "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0", "docomo_guid が起動しないとき"
70
- it_should_behave_like 'describe_mobile_with_ua', "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1", "docomo_guid が起動しないとき"
71
- it_should_behave_like 'describe_mobile_with_ua', "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", "docomo_guid が起動しないとき"
72
- it_should_behave_like 'describe_mobile_with_ua', "DoCoMo/1.0/N505i/c20/TB/W20H10 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)", "docomo_guid が起動しないとき"
73
- it_should_behave_like 'describe_mobile_with_ua', "DoCoMo/2.0/SO502i (compatible; Y!J-SRD/1.0; http://help.yahoo.co.jp/help/jp/search/indexing/indexing-27.html)", "docomo_guid が起動しないとき"
66
+ it_should_behave_like 'describe_mobile_with_ua', 'DoCoMo/2.0 SH902i(c100;TB;W24H12)', 'docomo_guid が起動するとき'
67
+ it_should_behave_like 'describe_mobile_with_ua', 'J-PHONE/3.0/V301D', 'docomo_guid が起動しないとき'
68
+ it_should_behave_like 'describe_mobile_with_ua', 'KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0', 'docomo_guid が起動しないとき'
69
+ it_should_behave_like 'describe_mobile_with_ua', 'SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1', 'docomo_guid が起動しないとき'
70
+ it_should_behave_like 'describe_mobile_with_ua', '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', 'docomo_guid が起動しないとき'
71
+ it_should_behave_like 'describe_mobile_with_ua', 'DoCoMo/1.0/N505i/c20/TB/W20H10 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)', 'docomo_guid が起動しないとき'
72
+ it_should_behave_like 'describe_mobile_with_ua', 'DoCoMo/2.0/SO502i (compatible; Y!J-SRD/1.0; http://help.yahoo.co.jp/help/jp/search/indexing/indexing-27.html)', 'docomo_guid が起動しないとき'
74
73
  end