jpmobile 4.2.5 → 5.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -2
  3. data/jpmobile.gemspec +1 -2
  4. data/lib/jpmobile.rb +17 -7
  5. data/lib/jpmobile/configuration.rb +1 -1
  6. data/lib/jpmobile/encoding.rb +13 -19
  7. data/lib/jpmobile/{hook_action_controller.rb → fallback_view_selector.rb} +4 -6
  8. data/lib/jpmobile/filter.rb +13 -10
  9. data/lib/jpmobile/mobile/abstract_mobile.rb +2 -2
  10. data/lib/jpmobile/mobile/google_emoticon.rb +2 -2
  11. data/lib/jpmobile/mobile/smart_phone.rb +2 -2
  12. data/lib/jpmobile/mobile/unicode_emoticon.rb +2 -2
  13. data/lib/jpmobile/rack/filter.rb +36 -38
  14. data/lib/jpmobile/rack/mobile_carrier.rb +8 -10
  15. data/lib/jpmobile/rack/params_filter.rb +32 -34
  16. data/lib/jpmobile/rails.rb +17 -4
  17. data/lib/jpmobile/resolver.rb +2 -3
  18. data/lib/jpmobile/trans_sid.rb +58 -78
  19. data/lib/jpmobile/util.rb +0 -17
  20. data/lib/jpmobile/version.rb +1 -1
  21. data/lib/tasks/jpmobile_tasks.rake +31 -37
  22. data/spec/rack/jpmobile/android_spec.rb +2 -2
  23. data/spec/rack/jpmobile/au_spec.rb +17 -17
  24. data/spec/rack/jpmobile/black_berry_spec.rb +2 -2
  25. data/spec/rack/jpmobile/docomo_spec.rb +15 -15
  26. data/spec/rack/jpmobile/emoticon_spec.rb +57 -57
  27. data/spec/rack/jpmobile/filter_spec.rb +25 -25
  28. data/spec/rack/jpmobile/iphone_spec.rb +3 -3
  29. data/spec/rack/jpmobile/mobile_by_ua_spec.rb +3 -3
  30. data/spec/rack/jpmobile/params_filter_spec.rb +10 -10
  31. data/spec/rack/jpmobile/softbank_spec.rb +9 -9
  32. data/spec/rack/jpmobile/willcom_spec.rb +6 -6
  33. data/spec/rack/jpmobile/windows_phone.rb +2 -2
  34. data/spec/rack_helper.rb +0 -1
  35. data/spec/unit/mail_spec.rb +1 -10
  36. data/spec/unit/util_spec.rb +42 -56
  37. data/test/rails/overrides/Gemfile.jpmobile +5 -3
  38. data/test/rails/overrides/app/controllers/filter_controller.rb +0 -1
  39. data/test/rails/overrides/app/controllers/filter_controller_base.rb +14 -9
  40. data/test/rails/overrides/app/controllers/hankaku_input_filter_controller.rb +2 -2
  41. data/test/rails/overrides/app/controllers/trans_sid_metal_controller.rb +0 -1
  42. data/test/rails/overrides/app/views/filter/text_template.html.erb +1 -0
  43. data/test/rails/overrides/spec/controllers/mobile_spec_controller_spec.rb +3 -3
  44. data/test/rails/overrides/spec/controllers/trans_sid_controller_spec.rb +2 -2
  45. data/test/rails/overrides/spec/features/filter_spec.rb +10 -9
  46. data/test/rails/overrides/spec/helpers/helpers_spec.rb +5 -3
  47. data/test/rails/overrides/spec/requests/docomo_spec.rb +6 -6
  48. data/test/rails/overrides/spec/requests/emobile_spec.rb +6 -6
  49. data/test/rails/overrides/spec/requests/pc_spec.rb +3 -3
  50. data/test/rails/overrides/spec/requests/softbank_emulator_spec.rb +4 -4
  51. data/test/rails/overrides/spec/requests/template_path_spec.rb +1 -1
  52. data/test/rails/overrides/spec/requests/trans_sid_spec.rb +7 -9
  53. metadata +12 -28
  54. data/lib/jpmobile/hook_action_dispatch.rb +0 -2
  55. data/lib/jpmobile/rack.rb +0 -14
@@ -3,18 +3,31 @@ ActiveSupport.on_load(:action_controller) do
3
3
  require 'jpmobile/docomo_guid'
4
4
  require 'jpmobile/filter'
5
5
  require 'jpmobile/helpers'
6
- require 'jpmobile/hook_action_controller'
7
6
  require 'jpmobile/hook_action_view'
8
7
  require 'jpmobile/trans_sid'
9
8
  require 'jpmobile/hook_test_request'
9
+ ActionDispatch::Request.send :prepend, Jpmobile::Encoding
10
+ ActionDispatch::Request.send :include, Jpmobile::RequestWithMobile
11
+ ActionController::Base.send :prepend, Jpmobile::FallbackViewSelector
12
+ ActionController::Base.send :prepend, Jpmobile::TransSidRedirecting
10
13
  end
11
- ActiveSupport.on_load(:action_dispatch) do
12
- require 'jpmobile/hook_action_dispatch'
14
+
15
+ ActiveSupport.on_load(:after_initialize) do
16
+ case Rails.application.config.session_store.to_s
17
+ when "ActionDispatch::Session::MemCacheStore"
18
+ require 'jpmobile/session/mem_cache_store'
19
+ ActionDispatch::Session::MemCacheStore.send :prepend, Jpmobile::ParamsOverCookie
20
+ when "ActiveRecord::SessionStore"
21
+ require 'jpmobile/session/active_record_store'
22
+ ActionDispatch::Session::AbstractStore.send :prepend, Jpmobile::ParamsOverCookie
23
+ else
24
+ Rails.application.config.jpmobile.mount_session_store
25
+ end
13
26
  end
14
27
 
15
28
  ActiveSupport.on_load(:before_configuration) do
16
29
  # MobileCarrierのみデフォルトで有効
17
- config.middleware.insert_before ActionDispatch::ParamsParser, Jpmobile::Rack::MobileCarrier
30
+ config.middleware.insert_after ActionDispatch::Flash, ::Jpmobile::MobileCarrier
18
31
 
19
32
  module Rails
20
33
  class Application
@@ -1,7 +1,7 @@
1
1
  module Jpmobile
2
2
  class Resolver < ActionView::FileSystemResolver
3
3
  EXTENSIONS = [:locale, :formats, :handlers, :mobile]
4
- DEFAULT_PATTERN = ":prefix/:action{_:mobile,}{.:locale,}{.:formats,}{+:variants,}{.:handlers,}"
4
+ DEFAULT_PATTERN = ":prefix/:action{_:mobile,}{.:locale,}{.:formats,}{.:handlers,}"
5
5
 
6
6
  def initialize(path, pattern=nil)
7
7
  raise ArgumentError, "path already is a Resolver class" if path.is_a?(Resolver)
@@ -11,12 +11,11 @@ module Jpmobile
11
11
 
12
12
  private
13
13
 
14
- def query(path, details, formats, outside_app_allowed)
14
+ def query(path, details, formats)
15
15
  query = build_query(path, details)
16
16
 
17
17
  begin
18
18
  template_paths = find_template_paths query
19
- template_paths = reject_files_external_to_app(template_paths) unless outside_app_allowed
20
19
  rescue NoMethodError
21
20
  self.class_eval do
22
21
  def find_template_paths(query)
@@ -3,49 +3,69 @@
3
3
  require 'active_support/version'
4
4
 
5
5
  module Jpmobile
6
- module TransSid
7
- module ParamsOverCookie
8
- def self.included(base)
9
- base.class_eval do
10
- # cookie よりも params を先に見るパッチ
11
- def extract_session_id_with_jpmobile(env)
12
- request = ::Rack::Request.new(env)
13
- if request.params[@key] and !@cookie_only
14
- sid = request.params[@key]
15
- end
16
- sid ||= request.cookies[@key]
17
- sid
18
- end
19
- alias_method_chain :extract_session_id, :jpmobile
20
- end
6
+ module SessionID
7
+ require 'action_dispatch/middleware/session/abstract_store'
8
+ module_function
9
+
10
+ extend ActionDispatch::Session::Compatibility
11
+ end
12
+
13
+ module ParamsOverCookie
14
+ def extract_session_id(req)
15
+ if req.params[@key] and !@cookie_only
16
+ sid = req.params[@key]
21
17
  end
18
+ sid ||= req.cookies[@key]
19
+ sid
20
+ end
21
+ end
22
+
23
+ module TransSid
24
+ def self.included(controller)
25
+ controller.after_action(:append_session_id_parameter)
26
+ end
27
+
28
+ protected
29
+ # URLにsession_idを追加する。
30
+ def default_url_options
31
+ result = super || {}.with_indifferent_access
32
+ return result unless request # for test process
33
+ return result unless apply_trans_sid?
34
+ return result.merge({session_key.to_sym => jpmobile_session_id})
22
35
  end
23
36
 
24
- ActiveSupport.on_load(:after_initialize) do
25
- case Rails.application.config.session_store.to_s
26
- when "ActionDispatch::Session::MemCacheStore"
27
- require 'jpmobile/session/mem_cache_store'
28
- ActionDispatch::Session::MemCacheStore.send :include, ParamsOverCookie
29
- when "ActiveRecord::SessionStore"
30
- require 'jpmobile/session/active_record_store'
31
- ActionDispatch::Session::AbstractStore.send :include, ParamsOverCookie
32
- else
33
- Rails.application.config.jpmobile.mount_session_store
37
+ private
38
+ # session_keyを返す。
39
+ def session_key
40
+ unless key = Rails.application.config.session_options.merge(request.session_options || {})[:key]
41
+ key = ActionDispatch::Session::AbstractStore::DEFAULT_OPTIONS[:key]
34
42
  end
43
+ key
35
44
  end
36
- end
37
45
 
38
- module SessionID
39
- require 'action_dispatch/middleware/session/abstract_store'
40
- module_function
46
+ # session_idを返す
47
+ # rack 1.4 (rails3) request.session_options[:id]
48
+ # rack 1.5 (rails4) request.session.id
49
+ def jpmobile_session_id
50
+ request.session_options[:id] || request.session.id
51
+ end
41
52
 
42
- extend ActionDispatch::Session::Compatibility
53
+ # session_idを埋め込むためのhidden fieldを出力する。
54
+ def sid_hidden_field_tag
55
+ "<input type=\"hidden\" name=\"#{CGI::escapeHTML session_key}\" value=\"#{CGI::escapeHTML jpmobile_session_id}\" />"
56
+ end
57
+
58
+ # formにsession_idを追加する。
59
+ def append_session_id_parameter
60
+ return unless request # for test process
61
+ return unless apply_trans_sid?
62
+ return unless jpmobile_session_id
63
+ response.body = response.body.gsub(%r{(</form>)}i, sid_hidden_field_tag+'\1')
64
+ end
43
65
  end
44
- end
45
66
 
46
- module ActionController
47
- module Redirecting
48
- def redirect_to_with_jpmobile(options = {}, response_status = {})
67
+ module TransSidRedirecting
68
+ def redirect_to(options = {}, response_status = {})
49
69
  if apply_trans_sid? and jpmobile_session_id
50
70
  case options
51
71
  when %r{^\w[\w+.-]*:.*}
@@ -71,18 +91,19 @@ module ActionController
71
91
  end
72
92
  end
73
93
 
74
- redirect_to_without_jpmobile(options, response_status)
94
+ super(options, response_status)
75
95
  end
76
-
77
- alias_method_chain :redirect_to, :jpmobile
78
96
  end
97
+ end
79
98
 
99
+ module ActionController
80
100
  class Metal #:nodoc:
81
101
  class_attribute :trans_sid_mode
82
102
 
83
103
  class << self
84
104
  def trans_sid(mode = :mobile)
85
105
  include Jpmobile::TransSid
106
+
86
107
  self.trans_sid_mode = mode
87
108
  end
88
109
  end
@@ -108,44 +129,3 @@ module ActionController
108
129
  end
109
130
  end
110
131
  end
111
-
112
- module Jpmobile::TransSid #:nodoc:
113
- def self.included(controller)
114
- controller.after_action(:append_session_id_parameter)
115
- end
116
-
117
- protected
118
- # URLにsession_idを追加する。
119
- def default_url_options
120
- result = super || {}.with_indifferent_access
121
- return result unless request # for test process
122
- return result unless apply_trans_sid?
123
- return result.merge({session_key.to_sym => jpmobile_session_id})
124
- end
125
-
126
- private
127
- # session_keyを返す。
128
- def session_key
129
- unless key = Rails.application.config.session_options.merge(request.session_options || {})[:key]
130
- key = ActionDispatch::Session::AbstractStore::DEFAULT_OPTIONS[:key]
131
- end
132
- key
133
- end
134
- # session_idを返す
135
- # rack 1.4 (rails3) request.session_options[:id]
136
- # rack 1.5 (rails4) request.session.id
137
- def jpmobile_session_id
138
- request.session_options[:id] || request.session.id
139
- end
140
- # session_idを埋め込むためのhidden fieldを出力する。
141
- def sid_hidden_field_tag
142
- "<input type=\"hidden\" name=\"#{CGI::escapeHTML session_key}\" value=\"#{CGI::escapeHTML jpmobile_session_id}\" />"
143
- end
144
- # formにsession_idを追加する。
145
- def append_session_id_parameter
146
- return unless request # for test process
147
- return unless apply_trans_sid?
148
- return unless jpmobile_session_id
149
- response.body = response.body.gsub(%r{(</form>)}i, sid_hidden_field_tag+'\1')
150
- end
151
- end
data/lib/jpmobile/util.rb CHANGED
@@ -24,23 +24,6 @@ module Jpmobile
24
24
  FULLWIDTH_HYPHEN_MINUS = [0xFF0D].pack("U")
25
25
 
26
26
  module_function
27
- def deep_apply(obj, &proc)
28
- case obj
29
- when Hash
30
- obj.each_pair do |key, value|
31
- obj[key] = deep_apply(value, &proc)
32
- end
33
- when Array
34
- obj.collect!{|value| deep_apply(value, &proc)}
35
- when String
36
- obj = obj.to_param if obj.respond_to?(:to_param)
37
- proc.call(obj)
38
- else
39
- # NilClass, TrueClass, FalseClass, Tempfile, StringIO, etc...
40
- return obj
41
- end
42
- end
43
-
44
27
  def deep_convert(obj, &proc)
45
28
  case obj
46
29
  when Hash
@@ -1,3 +1,3 @@
1
1
  module Jpmobile
2
- VERSION = "4.2.5"
2
+ VERSION = "5.0.0.beta1"
3
3
  end
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  # desc "Explaining what the task does"
2
3
  # task :jpmobile do
3
4
  # # Task goes here
@@ -18,28 +19,30 @@ begin
18
19
  end
19
20
  end
20
21
  rescue LoadError
21
- warn 'RSpec is not installed. Some tasks were skipped. please install rspec'
22
+ warn "RSpec is not installed. Some tasks were skipped. please install rspec"
22
23
  end
23
24
 
24
25
  namespace :test do
25
- desc 'Generate rails app and run jpmobile tests in the app'
26
- task :rails, [:skip] do |_, args|
27
- rails_root = 'test/rails/rails_root'
26
+ desc "Generate rails app and run jpmobile tests in the app"
27
+ task :rails, [:skip] do |t, args|
28
+ rails_root = "test/rails/rails_root"
29
+ relative_root = "../../../"
28
30
 
29
- puts 'Running tests in Rails'
30
- skip = args.skip == 'true'
31
+ puts "Running tests in Rails"
32
+ skip = args.skip == "true"
31
33
 
32
34
  unless skip
33
35
  # generate rails app
36
+ FileUtils.rm_rf("Gemfile.lock")
34
37
  FileUtils.rm_rf(rails_root)
35
38
  FileUtils.mkdir_p(rails_root)
36
- `rails new #{rails_root} --skip-bundle`
39
+ `rails _5.0.0.beta1_ new #{rails_root} --skip-bundle`
37
40
  end
38
41
 
39
42
  # setup jpmobile
40
43
  plugin_path = File.join(rails_root, 'vendor', 'jpmobile')
41
44
  FileUtils.mkdir_p(plugin_path)
42
- FileList['*'].exclude('test').exclude('spec').exclude('vendor').each do |file|
45
+ FileList["*"].exclude("test").exclude("spec").exclude('vendor').each do |file|
43
46
  FileUtils.cp_r(file, plugin_path)
44
47
  end
45
48
 
@@ -47,37 +50,37 @@ namespace :test do
47
50
  begin
48
51
  plugin_path = File.join(rails_root, 'vendor', 'jpmobile-ipaddresses')
49
52
  FileUtils.mkdir_p(plugin_path)
50
- FileList['vendor/jpmobile-ipaddresses/*'].exclude('test').each do |file|
53
+ FileList["vendor/jpmobile-ipaddresses/*"].exclude("test").each do |file|
51
54
  FileUtils.cp_r(file, plugin_path)
52
55
  end
53
56
  rescue LoadError
54
- puts 'IP Address test requires jpmobile-ipaddresses module'
57
+ puts "IP Address test requires jpmobile-ipaddresses module"
55
58
  end
56
59
 
57
60
  # setup jpmobile-terminfo
58
61
  begin
59
62
  plugin_path = File.join(rails_root, 'vendor', 'jpmobile-terminfo')
60
63
  FileUtils.mkdir_p(plugin_path)
61
- FileList['vendor/jpmobile-terminfo/*'].exclude('test').each do |file|
64
+ FileList["vendor/jpmobile-terminfo/*"].exclude("test").each do |file|
62
65
  FileUtils.cp_r(file, plugin_path)
63
66
  end
64
67
  rescue LoadError
65
- puts 'Terminal display information test requires jpmobile-terminfo module'
68
+ puts "Terminal display information test requires jpmobile-terminfo module"
66
69
  end
67
70
 
68
71
  # setup activerecord-session_store
69
72
  begin
70
73
  plugin_path = File.join(rails_root, 'vendor', 'activerecord-session_store')
71
74
  FileUtils.mkdir_p(plugin_path)
72
- FileList['../activerecord-session_store/*'].exclude('test').each do |file|
75
+ FileList["../activerecord-session_store/*"].exclude("test").each do |file|
73
76
  FileUtils.cp_r(file, plugin_path)
74
77
  end
75
78
  rescue LoadError
76
- puts 'Terminal display information test requires jpmobile-terminfo module'
79
+ puts "Terminal display information test requires jpmobile-terminfo module"
77
80
  end
78
81
 
79
82
  # setup tests
80
- FileList['test/rails/overrides/*'].each do |file|
83
+ FileList["test/rails/overrides/*"].each do |file|
81
84
  FileUtils.cp_r(file, rails_root)
82
85
  end
83
86
 
@@ -85,10 +88,10 @@ namespace :test do
85
88
  # for cookie_only option
86
89
  config_path = File.join(rails_root, 'config', 'initializers', 'session_store.rb')
87
90
  File.open(config_path, 'w') do |file|
88
- file.write <<-SESSION_CONFIG
89
- Rails.application.config.session_store :active_record_store, :key => '_session_id'
90
- Rails.application.config.session_options = { :cookie_only => false }
91
- SESSION_CONFIG
91
+ file.write <<-END
92
+ Rails.application.config.session_store :active_record_store, :key => '_session_id'
93
+ Rails.application.config.session_options = {:cookie_only => false}
94
+ END
92
95
  end
93
96
  end
94
97
 
@@ -96,29 +99,20 @@ namespace :test do
96
99
  # add gems for jpmobile spec
97
100
  config_path = File.join(rails_root, 'Gemfile')
98
101
  File.open(config_path, 'a+') do |file|
99
- file.write <<-GEMFILE
100
- instance_eval File.read(File.expand_path(__FILE__) + '.jpmobile')
101
- GEMFILE
102
+ file.write <<-END
103
+ instance_eval File.read(File.expand_path(__FILE__) + '.jpmobile')
104
+ END
102
105
  end
103
106
  end
104
107
 
105
108
  # run tests in rails
106
- Dir.chdir(rails_root) do
107
- Bundler.with_clean_env do
108
- original_env = ENV.to_hash
109
-
110
- ENV.update('RBENV_VERSION' => nil)
111
- ENV.update('RBENV_DIR' => nil)
112
-
113
- system 'bundle install'
114
- system 'bin/rake db:migrate RAILS_ENV=test' unless skip
115
- system 'bin/rake spec'
116
-
117
- ENV.replace(original_env)
118
- end
119
- end
109
+ cd rails_root
110
+ ruby "-S bundle install"
111
+ ruby "-S rake db:migrate RAILS_ENV=test" unless skip
112
+ ruby "-S rake spec"
113
+ # ruby "-S rspec -b --color spec/features/filter_spec.rb"
120
114
  end
121
- desc 'Run sinatra on jpmobile tests'
115
+ desc "Run sinatra on jpmobile tests"
122
116
  Rake::TestTask.new(:sinatra) do |t|
123
117
  t.libs << 'lib'
124
118
  t.libs << 'test/sinatra'
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require File.join(File.expand_path(File.dirname(__FILE__)), '../../rack_helper.rb')
3
3
 
4
- describe Jpmobile::Rack::MobileCarrier, "android" do
4
+ describe Jpmobile::MobileCarrier, "android" do
5
5
  include Rack::Test::Methods
6
6
 
7
7
  context "端末種別で" do
@@ -9,7 +9,7 @@ describe Jpmobile::Rack::MobileCarrier, "android" do
9
9
  res = Rack::MockRequest.env_for(
10
10
  'http://jpmobile-rails.org/',
11
11
  'HTTP_USER_AGENT' => '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')
12
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
12
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
13
13
 
14
14
  expect(env['rack.jpmobile'].class).to eq(Jpmobile::Mobile::Android)
15
15
  expect(env['rack.jpmobile'].position).to be_nil
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require File.join(File.expand_path(File.dirname(__FILE__)), '../../rack_helper.rb')
3
3
 
4
- describe Jpmobile::Rack::MobileCarrier, "au" do
4
+ describe Jpmobile::MobileCarrier, "au" do
5
5
  include Rack::Test::Methods
6
6
 
7
7
  context "端末種別で" do
@@ -10,7 +10,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
10
10
  'http://jpmobile-rails.org/',
11
11
  'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
12
12
  "HTTP_X_UP_SUBNO" => "00000000000000_mj.ezweb.ne.jp")
13
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
13
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
14
14
 
15
15
  expect(env['rack.jpmobile'].class).to eq(Jpmobile::Mobile::Au)
16
16
  expect(env['rack.jpmobile'].subno).to eq("00000000000000_mj.ezweb.ne.jp")
@@ -25,7 +25,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
25
25
  res = Rack::MockRequest.env_for(
26
26
  'http://jpmobile-rails.org/',
27
27
  'HTTP_USER_AGENT' => "UP.Browser/3.04-KCTA UP.Link/3.4.5.9")
28
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
28
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
29
29
 
30
30
  expect(env['rack.jpmobile'].class).to eq(Jpmobile::Mobile::Au)
31
31
  end
@@ -37,7 +37,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
37
37
  'http://jpmobile-rails.org/',
38
38
  'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
39
39
  "QUERY_STRING" => "ver=1&datum=0&unit=1&lat=%2b43.07772&lon=%2b141.34114&alt=64&time=20061016192415&smaj=69&smin=18&vert=21&majaa=115&fm=1")
40
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
40
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
41
41
 
42
42
  expect(env['rack.jpmobile'].position.lat).to eq(43.07772)
43
43
  expect(env['rack.jpmobile'].position.lon).to eq(141.34114)
@@ -48,7 +48,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
48
48
  'http://jpmobile-rails.org/',
49
49
  'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
50
50
  "QUERY_STRING" => "ver=1&datum=0&unit=0&lat=%2b43.05.08.95&lon=%2b141.20.25.99&alt=155&time=20060521010328&smaj=76&smin=62&vert=65&majaa=49&fm=1")
51
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
51
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
52
52
 
53
53
  expect(env['rack.jpmobile'].position.lat).to be_within(1e-7).of(43.08581944)
54
54
  expect(env['rack.jpmobile'].position.lon).to be_within(1e-7).of(141.3405528)
@@ -59,7 +59,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
59
59
  'http://jpmobile-rails.org/',
60
60
  'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
61
61
  "QUERY_STRING" => "ver=1&datum=1&unit=1&lat=%2b43.07475&lon=%2b141.34259&alt=8&time=20061017182825&smaj=113&smin=76&vert=72&majaa=108&fm=1")
62
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
62
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
63
63
 
64
64
  expect(env['rack.jpmobile'].position.lat).to be_within(1e-4).of(43.07719289)
65
65
  expect(env['rack.jpmobile'].position.lon).to be_within(1e-4).of(141.3389013)
@@ -70,7 +70,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
70
70
  'http://jpmobile-rails.org/',
71
71
  'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
72
72
  "QUERY_STRING" => "ver=1&datum=1&unit=1&lat=%2b43.07475&lon=%2b141.34259&alt=8&time=20061017182825&smaj=113&smin=76&vert=72&majaa=108&fm=1")
73
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
73
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
74
74
 
75
75
  expect(env['rack.jpmobile'].position.lat).to be_within(1e-4).of(43.07719289)
76
76
  expect(env['rack.jpmobile'].position.lon).to be_within(1e-4).of(141.3389013)
@@ -81,7 +81,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
81
81
  'http://jpmobile-rails.org/',
82
82
  'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
83
83
  "QUERY_STRING" => "datum=tokyo&unit=dms&lat=43.04.55.00&lon=141.20.50.75")
84
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
84
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
85
85
 
86
86
  expect(env['rack.jpmobile'].position.lat).to be_within(1e-7).of(43.08194444)
87
87
  expect(env['rack.jpmobile'].position.lon).to be_within(1e-7).of(141.3474306)
@@ -92,7 +92,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
92
92
  'http://jpmobile-rails.org/',
93
93
  'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
94
94
  "QUERY_STRING" => "datum=tokyo&unit=dms&lat=43.04.55.00&lon=141.20.50.75")
95
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
95
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
96
96
 
97
97
  expect(env['rack.jpmobile'].position.lat).to be_within(1e-7).of(43.08194444)
98
98
  expect(env['rack.jpmobile'].position.lon).to be_within(1e-7).of(141.3474306)
@@ -103,7 +103,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
103
103
  'http://jpmobile-rails.org/',
104
104
  'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
105
105
  "QUERY_STRING" => "ver=1&datum=0&unit=1&lat=%2b43.07772&lon=%2b141.34114&alt=64&time=20061016192415&smaj=69&smin=18&vert=21&majaa=115&fm=1")
106
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
106
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
107
107
 
108
108
  expect(env['rack.jpmobile'].position.lat).to eq(43.07772)
109
109
  expect(env['rack.jpmobile'].position.lon).to eq(141.34114)
@@ -118,7 +118,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
118
118
  res = Rack::MockRequest.env_for(
119
119
  'http://jpmobile-rails.org/',
120
120
  'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0")
121
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
121
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
122
122
 
123
123
  expect(env['rack.jpmobile'].device_id).to eq("CA32")
124
124
  expect(env['rack.jpmobile'].supports_location?).to be_truthy
@@ -129,7 +129,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
129
129
  res = Rack::MockRequest.env_for(
130
130
  'http://jpmobile-rails.org/',
131
131
  'HTTP_USER_AGENT' => "KDDI-SN26 UP.Browser/6.2.0.6.2 (GUI) MMP/2.0")
132
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
132
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
133
133
 
134
134
  expect(env['rack.jpmobile'].device_id).to eq("SN26")
135
135
  expect(env['rack.jpmobile'].supports_location?).to be_truthy
@@ -140,7 +140,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
140
140
  res = Rack::MockRequest.env_for(
141
141
  'http://jpmobile-rails.org/',
142
142
  'HTTP_USER_AGENT' => "UP.Browser/3.04-KCTA UP.Link/3.4.5.9")
143
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
143
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
144
144
 
145
145
  expect(env['rack.jpmobile'].device_id).to eq("KCTA")
146
146
  expect(env['rack.jpmobile'].supports_location?).to be_falsey
@@ -155,7 +155,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
155
155
  'http://jpmobile-rails.org/',
156
156
  'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
157
157
  "REMOTE_ADDR" => "210.230.128.225")
158
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
158
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
159
159
 
160
160
  expect(env['rack.jpmobile'].valid_ip?).to be_truthy
161
161
  end
@@ -165,7 +165,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
165
165
  'http://jpmobile-rails.org/',
166
166
  'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",
167
167
  "REMOTE_ADDR" => "127.0.0.1")
168
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
168
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
169
169
 
170
170
  expect(env['rack.jpmobile'].valid_ip?).to be_falsey
171
171
  end
@@ -179,7 +179,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
179
179
  "HTTP_X_UP_DEVCAP_SCREENDEPTH" => "16,RGB565",
180
180
  "HTTP_X_UP_DEVCAP_SCREENPIXELS" => "240,346",
181
181
  "HTTP_X_UP_DEVCAP_ISCOLOR" => "1")
182
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
182
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
183
183
 
184
184
  expect(env['rack.jpmobile'].display.width).to eq(240)
185
185
  expect(env['rack.jpmobile'].display.height).to eq(346)
@@ -191,7 +191,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
191
191
  res = Rack::MockRequest.env_for(
192
192
  'http://jpmobile-rails.org/',
193
193
  'HTTP_USER_AGENT' => "KDDI-CA33 UP.Browser/6.2.0.10.4 (GUI) MMP/2.0")
194
- env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
194
+ env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1]
195
195
 
196
196
  expect(env['rack.jpmobile'].display.width).to be_nil
197
197
  expect(env['rack.jpmobile'].display.height).to be_nil