jpmobile 4.1.1 → 4.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/jpmobile.gemspec +2 -0
  3. data/lib/jpmobile/emoticon.rb +3 -3
  4. data/lib/jpmobile/filter.rb +1 -1
  5. data/lib/jpmobile/mail.rb +3 -3
  6. data/lib/jpmobile/mobile/abstract_mobile.rb +5 -2
  7. data/lib/jpmobile/resolver.rb +17 -1
  8. data/lib/jpmobile/version.rb +1 -1
  9. data/lib/tasks/jpmobile_tasks.rake +5 -11
  10. data/spec/rack/jpmobile/android_spec.rb +4 -4
  11. data/spec/rack/jpmobile/au_spec.rb +46 -46
  12. data/spec/rack/jpmobile/black_berry_spec.rb +4 -4
  13. data/spec/rack/jpmobile/docomo_spec.rb +52 -52
  14. data/spec/rack/jpmobile/emoticon_spec.rb +67 -67
  15. data/spec/rack/jpmobile/filter_spec.rb +36 -36
  16. data/spec/rack/jpmobile/iphone_spec.rb +5 -5
  17. data/spec/rack/jpmobile/mobile_by_ua_spec.rb +2 -2
  18. data/spec/rack/jpmobile/params_filter_spec.rb +30 -30
  19. data/spec/rack/jpmobile/softbank_spec.rb +39 -39
  20. data/spec/rack/jpmobile/willcom_spec.rb +12 -12
  21. data/spec/rack/jpmobile/windows_phone.rb +4 -4
  22. data/spec/unit/decorated_mail_spec.rb +3 -3
  23. data/spec/unit/email_spec.rb +6 -6
  24. data/spec/unit/emoticon_spec.rb +33 -33
  25. data/spec/unit/encoding_spec.rb +14 -14
  26. data/spec/unit/is_carrier_spec.rb +1 -1
  27. data/spec/unit/mail_spec.rb +63 -63
  28. data/spec/unit/mobile/iphone_spec.rb +6 -6
  29. data/spec/unit/receive_mail_spec.rb +75 -75
  30. data/spec/unit/util_spec.rb +34 -34
  31. data/spec/unit/valid_ip_spec.rb +2 -2
  32. data/spec/unit/variants_spec.rb +40 -10
  33. data/test/rails/overrides/Gemfile +3 -3
  34. data/test/rails/overrides/spec/controllers/docomo_guid_spec.rb +6 -6
  35. data/test/rails/overrides/spec/controllers/helpers_spec.rb +22 -22
  36. data/test/rails/overrides/spec/controllers/mobile_spec_controller_spec.rb +19 -19
  37. data/test/rails/overrides/spec/controllers/template_path_spec.rb +8 -8
  38. data/test/rails/overrides/spec/controllers/trans_sid_controller_spec.rb +2 -2
  39. data/test/rails/overrides/spec/features/admin/top_spec.rb +3 -3
  40. data/test/rails/overrides/spec/features/filter_spec.rb +32 -32
  41. data/test/rails/overrides/spec/helpers/helpers_spec.rb +3 -3
  42. data/test/rails/overrides/spec/mailers/decorated_mailer_spec.rb +3 -3
  43. data/test/rails/overrides/spec/mailers/mobile_mailer_spec.rb +179 -179
  44. data/test/rails/overrides/spec/mailers/normal_mailer_spec.rb +7 -7
  45. data/test/rails/overrides/spec/requests/docomo_spec.rb +6 -6
  46. data/test/rails/overrides/spec/requests/emobile_spec.rb +6 -6
  47. data/test/rails/overrides/spec/requests/pc_spec.rb +3 -3
  48. data/test/rails/overrides/spec/requests/softbank_emulator_spec.rb +6 -6
  49. data/test/rails/overrides/spec/requests/template_path_spec.rb +24 -24
  50. data/test/rails/overrides/spec/requests/trans_sid_spec.rb +16 -16
  51. metadata +39 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f83dece3c3b1f70371b5aca9bcba8b1ded28abe
4
- data.tar.gz: 28d2542170610c2d2fe9af4728c3b2b04301dc73
3
+ metadata.gz: c3144787e76be4d863f9196009d1e41b898d3562
4
+ data.tar.gz: 7b8a4479c9a57eefdba5c167ba322d6e23a8d8d7
5
5
  SHA512:
6
- metadata.gz: bbba29855f49366f51dd5a172578181d1c9c887dd8e8d1c2a3211f8faf18e3f68868236d0fc11d7ba64f22062f600e6218938abf1a68ff6673a87ce1e0add9df
7
- data.tar.gz: 01147d7316262342db4fc75a3aa74c4ea165592b1542bcd738f687098fb7987e00212ac7d477949d48ff3564372657f3d5e9667c6e880af6211cc657cf666dbb
6
+ metadata.gz: e028586f34450a8da47dfd7292886b2dab4b1d4745a2d49cdd7bf9a9f81891bd82572e15018968d0a2540d7c23429e92e471eab2558b543cc62fbf034f2dd659
7
+ data.tar.gz: cfcb93bb0eb1b8ba9dc4e73bbd77943c2d2eab47249c18afd1a15bffb9908df9c4c7bf81bf692c71c349a53210ccbf832f015fa8c88478d0e3ee22e120a0093d
data/jpmobile.gemspec CHANGED
@@ -25,4 +25,6 @@ Gem::Specification.new do |gem|
25
25
  gem.add_development_dependency 'sqlite3-ruby'
26
26
  gem.add_development_dependency 'hpricot'
27
27
  gem.add_development_dependency 'git'
28
+
29
+ gem.add_dependency 'rails', '~> 4.1.0'
28
30
  end
@@ -159,11 +159,11 @@ module Jpmobile
159
159
  # 変換先がUnicodeで指定されている。つまり対応する絵文字がある。
160
160
  if sjis = UNICODE_TO_SJIS[converted]
161
161
  if to_sjis
162
- sjis_emotion = Jpmobile::Util.sjis([sjis].pack('n'))
162
+ Jpmobile::Util.sjis([sjis].pack('n'))
163
163
  else
164
164
  [converted].pack("U")
165
165
  end
166
- elsif webcode = SOFTBANK_UNICODE_TO_WEBCODE[converted-0x1000]
166
+ elsif SOFTBANK_UNICODE_TO_WEBCODE[converted-0x1000]
167
167
  [converted-0x1000].pack('U')
168
168
  elsif converted == GETA_CODE
169
169
  # PCで〓を表示する場合
@@ -295,7 +295,7 @@ module Jpmobile
295
295
  @@pc_emoticon_image_path.chop if @@pc_emoticon_image_path.match(/\/$/)
296
296
 
297
297
  return true
298
- rescue => ex
298
+ rescue
299
299
  end
300
300
  else
301
301
  return true
@@ -157,7 +157,7 @@ module Jpmobile
157
157
  end
158
158
  elsif element.node_name == "input" and ["submit", "reset", "button"].include?(element["type"])
159
159
  # テキスト以外でもボタンの value は変換
160
- element["value"] = filter(:zenkaku, element["value"])
160
+ element["value"] = filter(:hankaku, element["value"])
161
161
  elsif element.children.any?
162
162
  # 子要素があれば再帰的に変換
163
163
  element = convert_text_content(element)
data/lib/jpmobile/mail.rb CHANGED
@@ -4,7 +4,7 @@ require 'mail'
4
4
  module Mail
5
5
  # encoding patch
6
6
  Ruby19.class_eval do
7
- def self.b_value_decode(str)
7
+ def self.b_value_decode(str, encoding = nil)
8
8
  match = str.match(/\=\?(.+)?\?[Bb]\?(.+)?\?\=/m)
9
9
  if match
10
10
  encoding = match[1]
@@ -17,7 +17,7 @@ module Mail
17
17
  end
18
18
 
19
19
  # change encoding
20
- def self.b_value_encode(str, encoding)
20
+ def self.b_value_encode(str, encoding = nil)
21
21
  str = Jpmobile::Util.encode(str, encoding.to_s)
22
22
  [Ruby19.encode_base64(str), encoding]
23
23
  end
@@ -542,7 +542,7 @@ module Mail
542
542
  rescue NoMethodError => ex
543
543
  if ex.message.match(/undefined method `gsub' for nil:NilClass/)
544
544
  name = unquote(tree.display_name.text_value.strip.to_s)
545
- str = strip_all_comments(name.to_s)
545
+ strip_all_comments(name.to_s)
546
546
  else
547
547
  raise ex
548
548
  end
@@ -8,8 +8,11 @@ module Jpmobile::Mobile
8
8
  MAIL_CHARSET = "ISO-2022-JP"
9
9
 
10
10
  def initialize(env, request)
11
- @env = env
12
- @request = request
11
+ @env = env
12
+ @request = request
13
+ @_variants = nil
14
+ @_mail_variants = nil
15
+ @decorated = nil
13
16
  end
14
17
 
15
18
  # 対応するuser-agentの正規表現
@@ -14,7 +14,23 @@ module Jpmobile
14
14
  def query(path, details, formats)
15
15
  query = build_query(path, details)
16
16
 
17
- template_paths = find_template_paths query
17
+ begin
18
+ template_paths = find_template_paths query
19
+ rescue NoMethodError
20
+ self.class_eval do
21
+ def find_template_paths(query)
22
+ # deals with case-insensitive file systems.
23
+ sanitizer = Hash.new { |h,dir| h[dir] = Dir["#{dir}/*"] }
24
+
25
+ Dir[query].reject { |filename|
26
+ File.directory?(filename) ||
27
+ !sanitizer[File.dirname(filename)].include?(filename)
28
+ }
29
+ end
30
+ end
31
+
32
+ retry
33
+ end
18
34
 
19
35
  template_paths.map { |template|
20
36
  handler, format, variant = extract_handler_and_format_and_variant(template, formats)
@@ -1,3 +1,3 @@
1
1
  module Jpmobile
2
- VERSION = "4.1.1"
2
+ VERSION = "4.1.4"
3
3
  end
@@ -10,18 +10,12 @@ begin
10
10
  namespace :spec do
11
11
  desc 'run unit testing (core test)'
12
12
  RSpec::Core::RakeTask.new(:unit) do |t|
13
- spec_dir = File.join(File.dirname(__FILE__), '../../', 'spec')
14
- # t.spec_opts = File.read(File.join(spec_dir, 'spec.opts')).split
15
- # t.spec_files = FileList[File.join(spec_dir, 'unit', '**', '*_spec.rb')]
16
- t.pattern = "#{spec_dir}/unit/*_spec.rb"
13
+ t.pattern = 'spec/unit/**/*_spec.rb'
17
14
  end
18
15
 
19
16
  desc 'run rack testing'
20
17
  RSpec::Core::RakeTask.new(:rack) do |t|
21
- spec_dir = File.join(File.dirname(__FILE__), '../../', 'spec')
22
- # t.spec_opts = File.read(File.join(spec_dir, 'spec.opts')).split
23
- # t.spec_files = FileList[File.join(spec_dir, 'rack', '**', '*_spec.rb')]
24
- t.pattern = "#{spec_dir}/rack/**/*_spec.rb"
18
+ t.pattern = 'spec/rack/**/*_spec.rb'
25
19
  end
26
20
  end
27
21
  rescue LoadError
@@ -46,7 +40,7 @@ namespace :test do
46
40
  end
47
41
 
48
42
  # setup jpmobile
49
- plugin_path = File.join(rails_root, 'lib', 'jpmobile')
43
+ plugin_path = File.join(rails_root, 'vendor', 'jpmobile')
50
44
  FileUtils.mkdir_p(plugin_path)
51
45
  FileList["*"].exclude("test").exclude("spec").exclude('vendor').each do |file|
52
46
  FileUtils.cp_r(file, plugin_path)
@@ -54,7 +48,7 @@ namespace :test do
54
48
 
55
49
  # setup jpmobile-ipaddresses
56
50
  begin
57
- plugin_path = File.join(rails_root, 'lib', 'jpmobile-ipaddresses')
51
+ plugin_path = File.join(rails_root, 'vendor', 'jpmobile-ipaddresses')
58
52
  FileUtils.mkdir_p(plugin_path)
59
53
  FileList["vendor/jpmobile-ipaddresses/*"].exclude("test").each do |file|
60
54
  FileUtils.cp_r(file, plugin_path)
@@ -65,7 +59,7 @@ namespace :test do
65
59
 
66
60
  # setup jpmobile-terminfo
67
61
  begin
68
- plugin_path = File.join(rails_root, 'lib', 'jpmobile-terminfo')
62
+ plugin_path = File.join(rails_root, 'vendor', 'jpmobile-terminfo')
69
63
  FileUtils.mkdir_p(plugin_path)
70
64
  FileList["vendor/jpmobile-terminfo/*"].exclude("test").each do |file|
71
65
  FileUtils.cp_r(file, plugin_path)
@@ -11,10 +11,10 @@ describe Jpmobile::Rack::MobileCarrier, "android" do
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
12
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
13
13
 
14
- env['rack.jpmobile'].class.should == Jpmobile::Mobile::Android
15
- env['rack.jpmobile'].position.should be_nil
16
- env['rack.jpmobile'].smart_phone?.should be_truthy
17
- env['rack.jpmobile'].supports_cookie?.should be_truthy
14
+ expect(env['rack.jpmobile'].class).to eq(Jpmobile::Mobile::Android)
15
+ expect(env['rack.jpmobile'].position).to be_nil
16
+ expect(env['rack.jpmobile'].smart_phone?).to be_truthy
17
+ expect(env['rack.jpmobile'].supports_cookie?).to be_truthy
18
18
  end
19
19
  end
20
20
  end
@@ -12,13 +12,13 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
12
12
  "HTTP_X_UP_SUBNO" => "00000000000000_mj.ezweb.ne.jp")
13
13
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
14
14
 
15
- env['rack.jpmobile'].class.should == Jpmobile::Mobile::Au
16
- env['rack.jpmobile'].subno.should == "00000000000000_mj.ezweb.ne.jp"
17
- env['rack.jpmobile'].ident.should == "00000000000000_mj.ezweb.ne.jp"
18
- env['rack.jpmobile'].ident_subscriber.should == "00000000000000_mj.ezweb.ne.jp"
15
+ expect(env['rack.jpmobile'].class).to eq(Jpmobile::Mobile::Au)
16
+ expect(env['rack.jpmobile'].subno).to eq("00000000000000_mj.ezweb.ne.jp")
17
+ expect(env['rack.jpmobile'].ident).to eq("00000000000000_mj.ezweb.ne.jp")
18
+ expect(env['rack.jpmobile'].ident_subscriber).to eq("00000000000000_mj.ezweb.ne.jp")
19
19
 
20
- env['rack.jpmobile'].position.should be_nil
21
- env['rack.jpmobile'].supports_cookie?.should be_truthy
20
+ expect(env['rack.jpmobile'].position).to be_nil
21
+ expect(env['rack.jpmobile'].supports_cookie?).to be_truthy
22
22
  end
23
23
 
24
24
  it "TK22 で判別できること" do
@@ -27,7 +27,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
27
27
  'HTTP_USER_AGENT' => "UP.Browser/3.04-KCTA UP.Link/3.4.5.9")
28
28
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
29
29
 
30
- env['rack.jpmobile'].class.should == Jpmobile::Mobile::Au
30
+ expect(env['rack.jpmobile'].class).to eq(Jpmobile::Mobile::Au)
31
31
  end
32
32
  end
33
33
 
@@ -39,8 +39,8 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
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
40
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
41
41
 
42
- env['rack.jpmobile'].position.lat.should == 43.07772
43
- env['rack.jpmobile'].position.lon.should == 141.34114
42
+ expect(env['rack.jpmobile'].position.lat).to eq(43.07772)
43
+ expect(env['rack.jpmobile'].position.lon).to eq(141.34114)
44
44
  end
45
45
 
46
46
  it "緯度経度を取得できること(dms)" do
@@ -50,8 +50,8 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
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
51
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
52
52
 
53
- env['rack.jpmobile'].position.lat.should be_within(1e-7).of(43.08581944)
54
- env['rack.jpmobile'].position.lon.should be_within(1e-7).of(141.3405528)
53
+ expect(env['rack.jpmobile'].position.lat).to be_within(1e-7).of(43.08581944)
54
+ expect(env['rack.jpmobile'].position.lon).to be_within(1e-7).of(141.3405528)
55
55
  end
56
56
 
57
57
  it "緯度経度を取得できること(dgree_tokyo)" do
@@ -61,8 +61,8 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
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
62
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
63
63
 
64
- env['rack.jpmobile'].position.lat.should be_within(1e-4).of(43.07719289)
65
- env['rack.jpmobile'].position.lon.should be_within(1e-4).of(141.3389013)
64
+ expect(env['rack.jpmobile'].position.lat).to be_within(1e-4).of(43.07719289)
65
+ expect(env['rack.jpmobile'].position.lon).to be_within(1e-4).of(141.3389013)
66
66
  end
67
67
 
68
68
  it "緯度経度を取得できること(dgree_tokyo)" do
@@ -72,8 +72,8 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
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
73
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
74
74
 
75
- env['rack.jpmobile'].position.lat.should be_within(1e-4).of(43.07719289)
76
- env['rack.jpmobile'].position.lon.should be_within(1e-4).of(141.3389013)
75
+ expect(env['rack.jpmobile'].position.lat).to be_within(1e-4).of(43.07719289)
76
+ expect(env['rack.jpmobile'].position.lon).to be_within(1e-4).of(141.3389013)
77
77
  end
78
78
 
79
79
  it "緯度経度を取得できること(dms_tokyo)" do
@@ -83,8 +83,8 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
83
83
  "QUERY_STRING" => "datum=tokyo&unit=dms&lat=43.04.55.00&lon=141.20.50.75")
84
84
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
85
85
 
86
- env['rack.jpmobile'].position.lat.should be_within(1e-7).of(43.08194444)
87
- env['rack.jpmobile'].position.lon.should be_within(1e-7).of(141.3474306)
86
+ expect(env['rack.jpmobile'].position.lat).to be_within(1e-7).of(43.08194444)
87
+ expect(env['rack.jpmobile'].position.lon).to be_within(1e-7).of(141.3474306)
88
88
  end
89
89
 
90
90
  it "緯度経度を取得できること(antenna)" do
@@ -94,8 +94,8 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
94
94
  "QUERY_STRING" => "datum=tokyo&unit=dms&lat=43.04.55.00&lon=141.20.50.75")
95
95
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
96
96
 
97
- env['rack.jpmobile'].position.lat.should be_within(1e-7).of(43.08194444)
98
- env['rack.jpmobile'].position.lon.should be_within(1e-7).of(141.3474306)
97
+ expect(env['rack.jpmobile'].position.lat).to be_within(1e-7).of(43.08194444)
98
+ expect(env['rack.jpmobile'].position.lon).to be_within(1e-7).of(141.3474306)
99
99
  end
100
100
 
101
101
  it "GeoKit がある場合に取得できること" do
@@ -105,11 +105,11 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
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
106
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
107
107
 
108
- env['rack.jpmobile'].position.lat.should == 43.07772
109
- env['rack.jpmobile'].position.lon.should == 141.34114
110
- env['rack.jpmobile'].position.ll.should == "43.07772,141.34114"
108
+ expect(env['rack.jpmobile'].position.lat).to eq(43.07772)
109
+ expect(env['rack.jpmobile'].position.lon).to eq(141.34114)
110
+ expect(env['rack.jpmobile'].position.ll).to eq("43.07772,141.34114")
111
111
  if env['rack.jpmobile'].position.respond_to?(:distance_to) # GeoKit method
112
- env['rack.jpmobile'].position.distance_to(env['rack.jpmobile'].position).should == 0
112
+ expect(env['rack.jpmobile'].position.distance_to(env['rack.jpmobile'].position)).to eq(0)
113
113
  end
114
114
  end
115
115
 
@@ -120,9 +120,9 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
120
120
  'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0")
121
121
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
122
122
 
123
- env['rack.jpmobile'].device_id.should == "CA32"
124
- env['rack.jpmobile'].supports_location?.should be_truthy
125
- env['rack.jpmobile'].supports_gps?.should be_truthy
123
+ expect(env['rack.jpmobile'].device_id).to eq("CA32")
124
+ expect(env['rack.jpmobile'].supports_location?).to be_truthy
125
+ expect(env['rack.jpmobile'].supports_gps?).to be_truthy
126
126
  end
127
127
 
128
128
  it "A1402S を判定できること" do
@@ -131,9 +131,9 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
131
131
  'HTTP_USER_AGENT' => "KDDI-SN26 UP.Browser/6.2.0.6.2 (GUI) MMP/2.0")
132
132
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
133
133
 
134
- env['rack.jpmobile'].device_id.should == "SN26"
135
- env['rack.jpmobile'].supports_location?.should be_truthy
136
- env['rack.jpmobile'].supports_gps?.should be_falsey
134
+ expect(env['rack.jpmobile'].device_id).to eq("SN26")
135
+ expect(env['rack.jpmobile'].supports_location?).to be_truthy
136
+ expect(env['rack.jpmobile'].supports_gps?).to be_falsey
137
137
  end
138
138
 
139
139
  it "TK22 を判定できること" do
@@ -142,9 +142,9 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
142
142
  'HTTP_USER_AGENT' => "UP.Browser/3.04-KCTA UP.Link/3.4.5.9")
143
143
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
144
144
 
145
- env['rack.jpmobile'].device_id.should == "KCTA"
146
- env['rack.jpmobile'].supports_location?.should be_falsey
147
- env['rack.jpmobile'].supports_gps?.should be_falsey
145
+ expect(env['rack.jpmobile'].device_id).to eq("KCTA")
146
+ expect(env['rack.jpmobile'].supports_location?).to be_falsey
147
+ expect(env['rack.jpmobile'].supports_gps?).to be_falsey
148
148
  end
149
149
  end
150
150
  end
@@ -157,7 +157,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
157
157
  "REMOTE_ADDR" => "210.230.128.225")
158
158
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
159
159
 
160
- env['rack.jpmobile'].valid_ip?.should be_truthy
160
+ expect(env['rack.jpmobile'].valid_ip?).to be_truthy
161
161
  end
162
162
 
163
163
  it "正しくないIPアドレス空間からのアクセスを判断できること" do
@@ -167,7 +167,7 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
167
167
  "REMOTE_ADDR" => "127.0.0.1")
168
168
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
169
169
 
170
- env['rack.jpmobile'].valid_ip?.should be_falsey
170
+ expect(env['rack.jpmobile'].valid_ip?).to be_falsey
171
171
  end
172
172
  end
173
173
 
@@ -181,10 +181,10 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
181
181
  "HTTP_X_UP_DEVCAP_ISCOLOR" => "1")
182
182
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
183
183
 
184
- env['rack.jpmobile'].display.width.should == 240
185
- env['rack.jpmobile'].display.height.should == 346
186
- env['rack.jpmobile'].display.color?.should be_truthy
187
- env['rack.jpmobile'].display.colors.should == 65536
184
+ expect(env['rack.jpmobile'].display.width).to eq(240)
185
+ expect(env['rack.jpmobile'].display.height).to eq(346)
186
+ expect(env['rack.jpmobile'].display.color?).to be_truthy
187
+ expect(env['rack.jpmobile'].display.colors).to eq(65536)
188
188
  end
189
189
 
190
190
  it "端末の画面情報が渡ってない場合に正しく動作すること" do
@@ -193,14 +193,14 @@ describe Jpmobile::Rack::MobileCarrier, "au" do
193
193
  'HTTP_USER_AGENT' => "KDDI-CA33 UP.Browser/6.2.0.10.4 (GUI) MMP/2.0")
194
194
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
195
195
 
196
- env['rack.jpmobile'].display.width.should be_nil
197
- env['rack.jpmobile'].display.height.should be_nil
198
- env['rack.jpmobile'].display.browser_width.should be_nil
199
- env['rack.jpmobile'].display.browser_height.should be_nil
200
- env['rack.jpmobile'].display.physical_width.should be_nil
201
- env['rack.jpmobile'].display.physical_height.should be_nil
202
- env['rack.jpmobile'].display.color?.should be_nil
203
- env['rack.jpmobile'].display.colors.should be_nil
196
+ expect(env['rack.jpmobile'].display.width).to be_nil
197
+ expect(env['rack.jpmobile'].display.height).to be_nil
198
+ expect(env['rack.jpmobile'].display.browser_width).to be_nil
199
+ expect(env['rack.jpmobile'].display.browser_height).to be_nil
200
+ expect(env['rack.jpmobile'].display.physical_width).to be_nil
201
+ expect(env['rack.jpmobile'].display.physical_height).to be_nil
202
+ expect(env['rack.jpmobile'].display.color?).to be_nil
203
+ expect(env['rack.jpmobile'].display.colors).to be_nil
204
204
  end
205
205
  end
206
206
  end
@@ -11,10 +11,10 @@ describe Jpmobile::Rack::MobileCarrier, "Windows Phone" do
11
11
  'HTTP_USER_AGENT' => 'BlackBerry9000/4.6.0.224 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/220')
12
12
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
13
13
 
14
- env['rack.jpmobile'].class.should == Jpmobile::Mobile::BlackBerry
15
- env['rack.jpmobile'].position.should be_nil
16
- env['rack.jpmobile'].smart_phone?.should be_truthy
17
- env['rack.jpmobile'].supports_cookie?.should be_truthy
14
+ expect(env['rack.jpmobile'].class).to eq(Jpmobile::Mobile::BlackBerry)
15
+ expect(env['rack.jpmobile'].position).to be_nil
16
+ expect(env['rack.jpmobile'].smart_phone?).to be_truthy
17
+ expect(env['rack.jpmobile'].supports_cookie?).to be_truthy
18
18
  end
19
19
  end
20
20
  end
@@ -13,25 +13,25 @@ describe Jpmobile::Rack::MobileCarrier, "docomo" do
13
13
  end
14
14
 
15
15
  it "Jpmobile::Mobile::Docomo のインスタンスが env['rack.mobile'] にあること" do
16
- @env['rack.jpmobile'].class.should == Jpmobile::Mobile::Docomo
16
+ expect(@env['rack.jpmobile'].class).to eq(Jpmobile::Mobile::Docomo)
17
17
  end
18
18
 
19
19
  it "#position などが nil になること" do
20
- @env['rack.jpmobile'].position.should be_nil
21
- @env['rack.jpmobile'].areacode.should be_nil
22
- @env['rack.jpmobile'].serial_number.should be_nil
23
- @env['rack.jpmobile'].icc.should be_nil
24
- @env['rack.jpmobile'].ident.should be_nil
25
- @env['rack.jpmobile'].ident_device.should be_nil
26
- @env['rack.jpmobile'].ident_subscriber.should be_nil
20
+ expect(@env['rack.jpmobile'].position).to be_nil
21
+ expect(@env['rack.jpmobile'].areacode).to be_nil
22
+ expect(@env['rack.jpmobile'].serial_number).to be_nil
23
+ expect(@env['rack.jpmobile'].icc).to be_nil
24
+ expect(@env['rack.jpmobile'].ident).to be_nil
25
+ expect(@env['rack.jpmobile'].ident_device).to be_nil
26
+ expect(@env['rack.jpmobile'].ident_subscriber).to be_nil
27
27
  end
28
28
 
29
29
  it "#supports_cookie? などが false になること" do
30
- @env['rack.jpmobile'].supports_cookie?.should be_falsey
30
+ expect(@env['rack.jpmobile'].supports_cookie?).to be_falsey
31
31
  end
32
32
 
33
33
  it "#imode_browser_versionが1.0になること" do
34
- @env['rack.jpmobile'].imode_browser_version.should == '1.0'
34
+ expect(@env['rack.jpmobile'].imode_browser_version).to eq('1.0')
35
35
  end
36
36
  end
37
37
 
@@ -44,25 +44,25 @@ describe Jpmobile::Rack::MobileCarrier, "docomo" do
44
44
  end
45
45
 
46
46
  it "Jpmobile::Mobile::Docomo のインスタンスが env['rack.mobile'] にあること" do
47
- @env['rack.jpmobile'].class.should == Jpmobile::Mobile::Docomo
47
+ expect(@env['rack.jpmobile'].class).to eq(Jpmobile::Mobile::Docomo)
48
48
  end
49
49
 
50
50
  it "#position などが nil になること" do
51
- @env['rack.jpmobile'].position.should be_nil
52
- @env['rack.jpmobile'].areacode.should be_nil
53
- @env['rack.jpmobile'].serial_number.should be_nil
54
- @env['rack.jpmobile'].icc.should be_nil
55
- @env['rack.jpmobile'].ident.should be_nil
56
- @env['rack.jpmobile'].ident_device.should be_nil
57
- @env['rack.jpmobile'].ident_subscriber.should be_nil
51
+ expect(@env['rack.jpmobile'].position).to be_nil
52
+ expect(@env['rack.jpmobile'].areacode).to be_nil
53
+ expect(@env['rack.jpmobile'].serial_number).to be_nil
54
+ expect(@env['rack.jpmobile'].icc).to be_nil
55
+ expect(@env['rack.jpmobile'].ident).to be_nil
56
+ expect(@env['rack.jpmobile'].ident_device).to be_nil
57
+ expect(@env['rack.jpmobile'].ident_subscriber).to be_nil
58
58
  end
59
59
 
60
60
  it "#supports_cookie? などが false になること" do
61
- @env['rack.jpmobile'].supports_cookie?.should be_falsey
61
+ expect(@env['rack.jpmobile'].supports_cookie?).to be_falsey
62
62
  end
63
63
 
64
64
  it "#imode_browser_versionが1.0になること" do
65
- @env['rack.jpmobile'].imode_browser_version.should == '1.0'
65
+ expect(@env['rack.jpmobile'].imode_browser_version).to eq('1.0')
66
66
  end
67
67
  end
68
68
 
@@ -75,11 +75,11 @@ describe Jpmobile::Rack::MobileCarrier, "docomo" do
75
75
  end
76
76
 
77
77
  it "#supports_cookie? が true になること" do
78
- @env['rack.jpmobile'].supports_cookie?.should be_truthy
78
+ expect(@env['rack.jpmobile'].supports_cookie?).to be_truthy
79
79
  end
80
80
 
81
81
  it "#imode_browser_versionが2.0になること" do
82
- @env['rack.jpmobile'].imode_browser_version.should == '2.0'
82
+ expect(@env['rack.jpmobile'].imode_browser_version).to eq('2.0')
83
83
  end
84
84
  end
85
85
 
@@ -92,11 +92,11 @@ describe Jpmobile::Rack::MobileCarrier, "docomo" do
92
92
  end
93
93
 
94
94
  it "#supports_cookie? が true になること" do
95
- @env['rack.jpmobile'].supports_cookie?.should be_truthy
95
+ expect(@env['rack.jpmobile'].supports_cookie?).to be_truthy
96
96
  end
97
97
 
98
98
  it "#imode_browser_versionが2.0になること" do
99
- @env['rack.jpmobile'].imode_browser_version.should == '2.0'
99
+ expect(@env['rack.jpmobile'].imode_browser_version).to eq('2.0')
100
100
  end
101
101
  end
102
102
 
@@ -109,11 +109,11 @@ describe Jpmobile::Rack::MobileCarrier, "docomo" do
109
109
  end
110
110
 
111
111
  it "#supports_cookie? が true になること" do
112
- @env['rack.jpmobile'].supports_cookie?.should be_truthy
112
+ expect(@env['rack.jpmobile'].supports_cookie?).to be_truthy
113
113
  end
114
114
 
115
115
  it "#imode_browser_versionが2.0になること" do
116
- @env['rack.jpmobile'].imode_browser_version.should == '2.0LE'
116
+ expect(@env['rack.jpmobile'].imode_browser_version).to eq('2.0LE')
117
117
  end
118
118
  end
119
119
 
@@ -125,7 +125,7 @@ describe Jpmobile::Rack::MobileCarrier, "docomo" do
125
125
  "QUERY_STRING" => "AREACODE=00100&ACTN=OK")
126
126
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
127
127
 
128
- env['rack.jpmobile'].areacode.should == "00100"
128
+ expect(env['rack.jpmobile'].areacode).to eq("00100")
129
129
  end
130
130
 
131
131
  it "位置情報も取得できること" do
@@ -135,10 +135,10 @@ describe Jpmobile::Rack::MobileCarrier, "docomo" do
135
135
  "QUERY_STRING" => "LAT=%2B35.00.35.600&LON=%2B135.41.35.600&GEO=wgs84&POSINFO=2&AREACODE=00100&ACTN=OK")
136
136
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
137
137
 
138
- env['rack.jpmobile'].areacode.should == "00100"
138
+ expect(env['rack.jpmobile'].areacode).to eq("00100")
139
139
 
140
- env['rack.jpmobile'].position.lat.should be_within(1e-7).of(35.00988889)
141
- env['rack.jpmobile'].position.lon.should be_within(1e-7).of(135.6932222)
140
+ expect(env['rack.jpmobile'].position.lat).to be_within(1e-7).of(35.00988889)
141
+ expect(env['rack.jpmobile'].position.lon).to be_within(1e-7).of(135.6932222)
142
142
  end
143
143
  end
144
144
 
@@ -150,8 +150,8 @@ describe Jpmobile::Rack::MobileCarrier, "docomo" do
150
150
  "QUERY_STRING" => "lat=%2B35.00.35.600&lon=%2B135.41.35.600&geo=wgs84&x-acc=3")
151
151
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
152
152
 
153
- env['rack.jpmobile'].position.lat.should be_within(1e-7).of(35.00988889)
154
- env['rack.jpmobile'].position.lon.should be_within(1e-7).of(135.6932222)
153
+ expect(env['rack.jpmobile'].position.lat).to be_within(1e-7).of(35.00988889)
154
+ expect(env['rack.jpmobile'].position.lon).to be_within(1e-7).of(135.6932222)
155
155
  end
156
156
 
157
157
  # DoCoMo, 903i, GPS
@@ -164,8 +164,8 @@ describe Jpmobile::Rack::MobileCarrier, "docomo" do
164
164
  "QUERY_STRING" => "lat=%2B35.00.35.600&lon=%2B135.41.35.600&geo=WGS84&alt=%2B64.000&x-acc=1")
165
165
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
166
166
 
167
- env['rack.jpmobile'].position.lat.should be_within(1e-7).of(35.00988889)
168
- env['rack.jpmobile'].position.lon.should be_within(1e-7).of(135.6932222)
167
+ expect(env['rack.jpmobile'].position.lat).to be_within(1e-7).of(35.00988889)
168
+ expect(env['rack.jpmobile'].position.lon).to be_within(1e-7).of(135.6932222)
169
169
  end
170
170
  end
171
171
 
@@ -176,11 +176,11 @@ describe Jpmobile::Rack::MobileCarrier, "docomo" do
176
176
  'HTTP_USER_AGENT' => "DoCoMo/1.0/SO505iS/c20/TC/W30H16/serXXXXX000000")
177
177
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
178
178
 
179
- env['rack.jpmobile'].serial_number.should == "XXXXX000000"
180
- env['rack.jpmobile'].ident.should == "XXXXX000000"
181
- env['rack.jpmobile'].icc.should be_nil
182
- env['rack.jpmobile'].ident_device.should == "XXXXX000000"
183
- env['rack.jpmobile'].ident_subscriber.should be_nil
179
+ expect(env['rack.jpmobile'].serial_number).to eq("XXXXX000000")
180
+ expect(env['rack.jpmobile'].ident).to eq("XXXXX000000")
181
+ expect(env['rack.jpmobile'].icc).to be_nil
182
+ expect(env['rack.jpmobile'].ident_device).to eq("XXXXX000000")
183
+ expect(env['rack.jpmobile'].ident_subscriber).to be_nil
184
184
  end
185
185
 
186
186
  it "FOMA で取得できること" do
@@ -189,11 +189,11 @@ describe Jpmobile::Rack::MobileCarrier, "docomo" do
189
189
  'HTTP_USER_AGENT' => "DoCoMo/2.0 D902i(c100;TB;W23H16;ser999999999999999;icc0000000000000000000f)")
190
190
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
191
191
 
192
- env['rack.jpmobile'].serial_number.should == "999999999999999"
193
- env['rack.jpmobile'].icc.should == "0000000000000000000f"
194
- env['rack.jpmobile'].ident.should == "0000000000000000000f"
195
- env['rack.jpmobile'].ident_device.should == "999999999999999"
196
- env['rack.jpmobile'].ident_subscriber.should == "0000000000000000000f"
192
+ expect(env['rack.jpmobile'].serial_number).to eq("999999999999999")
193
+ expect(env['rack.jpmobile'].icc).to eq("0000000000000000000f")
194
+ expect(env['rack.jpmobile'].ident).to eq("0000000000000000000f")
195
+ expect(env['rack.jpmobile'].ident_device).to eq("999999999999999")
196
+ expect(env['rack.jpmobile'].ident_subscriber).to eq("0000000000000000000f")
197
197
  end
198
198
  end
199
199
 
@@ -205,7 +205,7 @@ describe Jpmobile::Rack::MobileCarrier, "docomo" do
205
205
  "REMOTE_ADDR" => "210.153.84.1")
206
206
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
207
207
 
208
- env['rack.jpmobile'].valid_ip?.should be_truthy
208
+ expect(env['rack.jpmobile'].valid_ip?).to be_truthy
209
209
  end
210
210
 
211
211
  it "正しくないIPアドレス空間からのアクセスを判断できること" do
@@ -215,7 +215,7 @@ describe Jpmobile::Rack::MobileCarrier, "docomo" do
215
215
  "REMOTE_ADDR" => "127.0.0.1")
216
216
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
217
217
 
218
- env['rack.jpmobile'].valid_ip?.should be_falsey
218
+ expect(env['rack.jpmobile'].valid_ip?).to be_falsey
219
219
  end
220
220
  end
221
221
 
@@ -226,12 +226,12 @@ describe Jpmobile::Rack::MobileCarrier, "docomo" do
226
226
  'HTTP_USER_AGENT' => "DoCoMo/1.0/SO506iC/c20/TB/W20H10")
227
227
  env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]
228
228
 
229
- env['rack.jpmobile'].display.browser_width.should == 240
230
- env['rack.jpmobile'].display.browser_height.should == 256
231
- env['rack.jpmobile'].display.width.should == 240
232
- env['rack.jpmobile'].display.height.should == 256
233
- env['rack.jpmobile'].display.color?.should be_truthy
234
- env['rack.jpmobile'].display.colors.should == 262144
229
+ expect(env['rack.jpmobile'].display.browser_width).to eq(240)
230
+ expect(env['rack.jpmobile'].display.browser_height).to eq(256)
231
+ expect(env['rack.jpmobile'].display.width).to eq(240)
232
+ expect(env['rack.jpmobile'].display.height).to eq(256)
233
+ expect(env['rack.jpmobile'].display.color?).to be_truthy
234
+ expect(env['rack.jpmobile'].display.colors).to eq(262144)
235
235
  end
236
236
  end
237
237
  end