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
@@ -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')
|
@@ -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 =
|
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
|
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>アブラ カダブラ</a>'.html_safe
|
38
46
|
render 'filter/text_template'
|
@@ -11,7 +11,7 @@ class TemplatePathController < ApplicationController
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def optioned_index
|
14
|
-
render :
|
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 :
|
6
|
+
render inline: %(<%= form_tag do %>Hello<% end %>)
|
8
7
|
end
|
8
|
+
|
9
9
|
def link
|
10
|
-
render :
|
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] =
|
17
|
-
@user = User.
|
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 :
|
26
|
+
render inline: %(<%= form_for @user do %>Hello<% end %>)
|
22
27
|
end
|
28
|
+
|
23
29
|
def form_path_admin
|
24
|
-
render :
|
30
|
+
render inline: %(<%= form_for [:admin, @user] do %>Hello<% end %>)
|
25
31
|
end
|
26
32
|
|
27
33
|
def link_path
|
28
|
-
render :
|
34
|
+
render inline: %(<%= link_to "linkto", @user -%>)
|
29
35
|
end
|
36
|
+
|
30
37
|
def link_path_admin
|
31
|
-
render :
|
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 :
|
50
|
+
redirect_to action: 'form'
|
43
51
|
end
|
44
52
|
end
|
@@ -1,11 +1,10 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
1
|
class DecoratedMailer < Jpmobile::Mailer::Base
|
3
|
-
default :
|
4
|
-
default :
|
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(:
|
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 :
|
4
|
-
default :
|
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(:
|
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(:
|
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(:
|
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 :
|
2
|
+
default from: 'info@jp.mobile'
|
4
3
|
|
5
4
|
def msg(to_mail, subject_text, text)
|
6
5
|
@text = text
|
7
|
-
mail(:
|
6
|
+
mail(to: to_mail, subject: subject_text)
|
8
7
|
end
|
9
8
|
end
|
@@ -1,2 +1,2 @@
|
|
1
|
-
Autotest.add_discovery {
|
2
|
-
Autotest.add_discovery {
|
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 :
|
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 :
|
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
|
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, :
|
4
|
+
t.string :session_id, null: false
|
5
5
|
t.text :data
|
6
6
|
|
7
7
|
t.timestamps null: false
|
@@ -1,56 +1,55 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
1
|
require 'rails_helper'
|
3
2
|
|
4
|
-
shared_examples_for
|
3
|
+
shared_examples_for 'docomo_guid が起動しないとき' do
|
5
4
|
render_views
|
6
5
|
|
7
|
-
it
|
6
|
+
it 'で link_to の自動書き換えが行われない' do
|
8
7
|
get :link
|
9
8
|
|
10
|
-
expect(response.body).to match(
|
9
|
+
expect(response.body).to match(%r{href=\".+/link\"})
|
11
10
|
end
|
12
11
|
end
|
13
12
|
|
14
|
-
shared_examples_for
|
15
|
-
it
|
13
|
+
shared_examples_for 'docomo_guid が起動するとき' do
|
14
|
+
it 'で link_to の自動書き換えが行われる' do
|
16
15
|
get :link
|
17
16
|
|
18
|
-
expect(response.body).to match(
|
17
|
+
expect(response.body).to match(%r{href=\".+/link\?guid=ON\"})
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
22
|
-
describe DocomoGuidBaseController, :
|
21
|
+
describe DocomoGuidBaseController, type: :controller do
|
23
22
|
before(:each) do
|
24
|
-
request.user_agent =
|
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
|
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
|
31
|
+
it_should_behave_like 'docomo_guid が起動しないとき'
|
33
32
|
end
|
34
33
|
|
35
|
-
describe DocomoGuidAlwaysController, :
|
34
|
+
describe DocomoGuidAlwaysController, type: :controller do
|
36
35
|
before(:each) do
|
37
|
-
request.user_agent =
|
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
|
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
|
44
|
+
it_should_behave_like 'docomo_guid が起動するとき'
|
46
45
|
end
|
47
46
|
|
48
|
-
describe DocomoGuidDocomoController, :
|
47
|
+
describe DocomoGuidDocomoController, type: :controller do
|
49
48
|
before(:each) do
|
50
|
-
request.user_agent =
|
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
|
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',
|
68
|
-
it_should_behave_like 'describe_mobile_with_ua',
|
69
|
-
it_should_behave_like 'describe_mobile_with_ua',
|
70
|
-
it_should_behave_like 'describe_mobile_with_ua',
|
71
|
-
it_should_behave_like 'describe_mobile_with_ua',
|
72
|
-
it_should_behave_like 'describe_mobile_with_ua',
|
73
|
-
it_should_behave_like 'describe_mobile_with_ua',
|
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
|