jpmobile 4.0.1 → 4.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/jpmobile.gemspec +2 -3
- data/lib/jpmobile/filter.rb +1 -1
- data/lib/jpmobile/hook_action_controller.rb +2 -2
- data/lib/jpmobile/mail.rb +42 -45
- data/lib/jpmobile/mailer.rb +1 -0
- data/lib/jpmobile/rails.rb +2 -1
- data/lib/jpmobile/resolver.rb +2 -23
- data/lib/jpmobile/version.rb +1 -1
- data/lib/tasks/jpmobile_tasks.rake +1 -1
- data/spec/unit/receive_mail_spec.rb +3 -18
- data/test/rails/overrides/app/controllers/filter_controller_base.rb +7 -0
- data/test/rails/overrides/spec/controllers/docomo_guid_spec.rb +74 -0
- data/test/rails/overrides/spec/{requests → controllers}/helpers_spec.rb +57 -41
- data/test/rails/overrides/spec/controllers/template_path_spec.rb +86 -0
- data/test/rails/overrides/spec/features/admin/top_spec.rb +32 -0
- data/test/rails/overrides/spec/features/filter_spec.rb +236 -0
- data/test/rails/overrides/spec/requests/template_path_spec.rb +88 -165
- data/test/rails/overrides/spec/spec_helper.rb +3 -2
- metadata +37 -54
- data/CHANGELOG +0 -11
- data/VERSION.yml +0 -5
- data/install.rb +0 -1
- data/spec/unit/email-fixtures/pc-mail-attached-without-subject.eml +0 -45
- data/test/rails/overrides/spec/requests/admin/top_spec.rb +0 -28
- data/test/rails/overrides/spec/requests/docomo_guid_spec.rb +0 -101
- data/test/rails/overrides/spec/requests/filter_spec.rb +0 -239
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b0f241ba03225004123b6f08d987f2311f75d2f
|
4
|
+
data.tar.gz: 8fcff8ad38f8f22b37fe56af7352273abe3ee07a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61351a0a29f21d528b49697814707a8da681029bf86e55681ab0453013e809709136c320653d21ba85567539aaa6d9a8c6c95f14427427c5b117dcf2ddc0890f
|
7
|
+
data.tar.gz: b93a1d05668f5d752a713139aa41d8a7c860a491fc3e633c37c1cd0051667b84014f49eea2c796ecd6d6a326fd995b26f21cc23dfa0f8a132c3b1b0a0f18f4f8
|
data/.gitignore
CHANGED
data/jpmobile.gemspec
CHANGED
@@ -16,13 +16,12 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
17
|
gem.require_paths = ["lib"]
|
18
18
|
|
19
|
-
gem.add_development_dependency 'rails'
|
19
|
+
gem.add_development_dependency 'rails'
|
20
20
|
gem.add_development_dependency 'rspec'
|
21
21
|
gem.add_development_dependency 'rspec-rails'
|
22
|
-
gem.add_development_dependency '
|
22
|
+
gem.add_development_dependency 'capybara-webkit'
|
23
23
|
gem.add_development_dependency 'geokit'
|
24
24
|
gem.add_development_dependency 'sqlite3-ruby'
|
25
|
-
gem.add_development_dependency 'nokogiri', '1.6.2.1'
|
26
25
|
gem.add_development_dependency 'hpricot'
|
27
26
|
gem.add_development_dependency 'git'
|
28
27
|
end
|
data/lib/jpmobile/filter.rb
CHANGED
@@ -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(:
|
160
|
+
element["value"] = filter(:zenkaku, element["value"])
|
161
161
|
elsif element.children.any?
|
162
162
|
# 子要素があれば再帰的に変換
|
163
163
|
element = convert_text_content(element)
|
@@ -17,8 +17,8 @@ module ActionController
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
module
|
21
|
-
module
|
20
|
+
module ActionController
|
21
|
+
module Renderers
|
22
22
|
def render_to_body_with_jpmobile(options)
|
23
23
|
if Jpmobile.config.fallback_view_selector and
|
24
24
|
lookup_context.mobile.present? and !lookup_context.mobile.empty?
|
data/lib/jpmobile/mail.rb
CHANGED
@@ -29,6 +29,12 @@ module Mail
|
|
29
29
|
def mobile=(m)
|
30
30
|
if @mobile = m
|
31
31
|
@charset = m.mail_charset(@charset)
|
32
|
+
|
33
|
+
if self.body
|
34
|
+
self.body.content_type_with_jpmobile = self.content_type
|
35
|
+
self.body.charset = @charset
|
36
|
+
self.body.mobile = m
|
37
|
+
end
|
32
38
|
end
|
33
39
|
end
|
34
40
|
|
@@ -41,6 +47,7 @@ module Mail
|
|
41
47
|
|
42
48
|
ready_to_send!
|
43
49
|
|
50
|
+
self.body.charset = @charset
|
44
51
|
self.body.mobile = @mobile
|
45
52
|
self.header['Content-Transfer-Encoding'].value = @mobile.content_transfer_encoding(self.header)
|
46
53
|
if @mobile.decorated?
|
@@ -77,18 +84,6 @@ module Mail
|
|
77
84
|
self.body = body_part
|
78
85
|
end
|
79
86
|
|
80
|
-
def init_with_hash_with_jpmobile(hash)
|
81
|
-
if hash[:body_raw]
|
82
|
-
@mobile = hash[:mobile]
|
83
|
-
init_with_string(hash[:body_raw])
|
84
|
-
else
|
85
|
-
init_with_hash_without_jpmobile(hash)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
alias_method :init_with_hash_without_jpmobile, :init_with_hash
|
90
|
-
alias_method :init_with_hash, :init_with_hash_with_jpmobile
|
91
|
-
|
92
87
|
def init_with_string(string)
|
93
88
|
# convert to ASCII-8BIT for ascii incompatible encodings
|
94
89
|
s = Jpmobile::Util.ascii_8bit(string)
|
@@ -102,6 +97,7 @@ module Mail
|
|
102
97
|
process_body_raw_without_jpmobile
|
103
98
|
|
104
99
|
if @mobile
|
100
|
+
@body.charset = @charset
|
105
101
|
@body.mobile = @mobile
|
106
102
|
@body.content_type_with_jpmobile = self.content_type
|
107
103
|
|
@@ -125,11 +121,6 @@ module Mail
|
|
125
121
|
@raw_source = value.to_crlf
|
126
122
|
end
|
127
123
|
|
128
|
-
def separate_parts_with_jpmobile
|
129
|
-
@body.mobile = @mobile
|
130
|
-
separate_parts_without_jpmobile
|
131
|
-
end
|
132
|
-
|
133
124
|
alias_method :encoded_without_jpmobile, :encoded
|
134
125
|
alias_method :encoded, :encoded_with_jpmobile
|
135
126
|
|
@@ -139,9 +130,6 @@ module Mail
|
|
139
130
|
alias_method :process_body_raw_without_jpmobile, :process_body_raw
|
140
131
|
alias_method :process_body_raw, :process_body_raw_with_jpmobile
|
141
132
|
|
142
|
-
alias_method :separate_parts_without_jpmobile, :separate_parts
|
143
|
-
alias_method :separate_parts, :separate_parts_with_jpmobile
|
144
|
-
|
145
133
|
# -- docomo
|
146
134
|
# multipart/mixed
|
147
135
|
# |- multipart/related
|
@@ -242,23 +230,34 @@ module Mail
|
|
242
230
|
# override charset
|
243
231
|
if self.header[:content_type]
|
244
232
|
content_type_charset = Jpmobile::Util.extract_charset(self.header[:content_type].value)
|
245
|
-
@charset = content_type_charset
|
246
233
|
unless content_type_charset.blank?
|
234
|
+
@charset = content_type_charset
|
247
235
|
self.header[:content_type].parameters[:charset] = @charset
|
248
236
|
@mobile_main_type = self.header[:content_type].main_type
|
249
237
|
end
|
238
|
+
|
239
|
+
if !Jpmobile::Email.convertable?(self.header[:content_type].value) and content_type_charset.blank?
|
240
|
+
@charset = ''
|
241
|
+
end
|
250
242
|
end
|
251
243
|
|
252
244
|
# convert header(s)
|
253
245
|
if self.header[:subject]
|
254
246
|
subject_charset = Jpmobile::Util.extract_charset(self.header[:subject].value)
|
247
|
+
|
248
|
+
# override subject encoding if @charset is blank
|
249
|
+
@charset = subject_charset if !subject_charset.blank? # and @charset.blank?
|
255
250
|
self.header[:subject].charset = subject_charset unless subject_charset.blank?
|
256
251
|
|
257
252
|
if @mobile
|
258
253
|
subject_value = Encodings.value_decode(self.header[:subject].value)
|
259
254
|
subject_converting_encoding = Jpmobile::Util.detect_encoding(subject_value)
|
260
255
|
v = @mobile.to_mail_internal(subject_value, subject_converting_encoding)
|
261
|
-
|
256
|
+
if @charset == subject_charset and @mobile.mail_charset != @charset
|
257
|
+
self.header[:subject].value = Jpmobile::Util.force_encode(v, @charset, Jpmobile::Util::UTF8)
|
258
|
+
else
|
259
|
+
self.header[:subject].value = Jpmobile::Util.force_encode(v, @mobile.mail_charset(@charset), Jpmobile::Util::UTF8)
|
260
|
+
end
|
262
261
|
end
|
263
262
|
end
|
264
263
|
|
@@ -323,18 +322,25 @@ module Mail
|
|
323
322
|
# convert encoding
|
324
323
|
def encoded_with_jpmobile(transfer_encoding = '8bit')
|
325
324
|
if @mobile and !multipart?
|
326
|
-
|
327
|
-
|
325
|
+
if @mobile.to_mail_body_encoded?(@raw_source)
|
326
|
+
@raw_source
|
327
|
+
elsif Jpmobile::Util.ascii_8bit?(@raw_source)
|
328
328
|
_raw_source = if transfer_encoding == encoding
|
329
|
-
@raw_source
|
329
|
+
@raw_source
|
330
330
|
else
|
331
|
-
get_best_encoding(transfer_encoding)
|
331
|
+
enc = Mail::Encodings::get_encoding(get_best_encoding(transfer_encoding))
|
332
|
+
enc.encode(@raw_source)
|
332
333
|
end
|
333
|
-
Jpmobile::Util.
|
334
|
-
when /quoted-printable/
|
335
|
-
Jpmobile::Util.set_encoding([@mobile.to_mail_body(@raw_source)].pack("M").gsub(/\n/, "\r\n"), @mobile.mail_charset(@charset))
|
334
|
+
Jpmobile::Util.force_encode(_raw_source, nil, @charset)
|
336
335
|
else
|
337
|
-
|
336
|
+
case transfer_encoding
|
337
|
+
when /quoted-printable/
|
338
|
+
# [str].pack("M").gsub(/\n/, "\r\n")
|
339
|
+
Jpmobile::Util.force_encode([@mobile.to_mail_body(Jpmobile::Util.force_encode(@raw_source, @charset, Jpmobile::Util::UTF8))].pack("M").gsub(/\n/, "\r\n"), Jpmobile::Util::BINARY, @charset)
|
340
|
+
# @mobile.to_mail_body(Jpmobile::Util.force_encode(@raw_source, @charset, Jpmobile::Util::UTF8))
|
341
|
+
else
|
342
|
+
@mobile.to_mail_body(Jpmobile::Util.force_encode(@raw_source, @charset, Jpmobile::Util::UTF8))
|
343
|
+
end
|
338
344
|
end
|
339
345
|
else
|
340
346
|
encoded_without_jpmobile(transfer_encoding)
|
@@ -360,7 +366,9 @@ module Mail
|
|
360
366
|
|
361
367
|
if self.multipart? and @mobile
|
362
368
|
self.parts.each do |part|
|
369
|
+
part.charset = @mobile.mail_charset(part.charset)
|
363
370
|
part.mobile = @mobile
|
371
|
+
part.body.charset = part.charset
|
364
372
|
part.body.mobile = @mobile
|
365
373
|
end
|
366
374
|
end
|
@@ -374,7 +382,7 @@ module Mail
|
|
374
382
|
|
375
383
|
def preamble_with_jpmobile
|
376
384
|
if @mobile
|
377
|
-
Jpmobile::Util.encode(@preamble, @
|
385
|
+
Jpmobile::Util.encode(@preamble, @charset)
|
378
386
|
else
|
379
387
|
preamble_without_jpmobile
|
380
388
|
end
|
@@ -382,7 +390,7 @@ module Mail
|
|
382
390
|
|
383
391
|
def epilogue_with_jpmobile
|
384
392
|
if @mobile
|
385
|
-
Jpmobile::Util.encode(@epilogue, @
|
393
|
+
Jpmobile::Util.encode(@epilogue, @charset)
|
386
394
|
else
|
387
395
|
epilogue_without_jpmobile
|
388
396
|
end
|
@@ -390,7 +398,7 @@ module Mail
|
|
390
398
|
|
391
399
|
def crlf_boundary_with_jpmobile
|
392
400
|
if @mobile
|
393
|
-
Jpmobile::Util.encode(crlf_boundary_without_jpmobile, @
|
401
|
+
Jpmobile::Util.encode(crlf_boundary_without_jpmobile, @charset)
|
394
402
|
else
|
395
403
|
crlf_boundary_without_jpmobile
|
396
404
|
end
|
@@ -398,7 +406,7 @@ module Mail
|
|
398
406
|
|
399
407
|
def end_boundary_with_jpmobile
|
400
408
|
if @mobile
|
401
|
-
Jpmobile::Util.encode(end_boundary_without_jpmobile, @
|
409
|
+
Jpmobile::Util.encode(end_boundary_without_jpmobile, @charset)
|
402
410
|
else
|
403
411
|
end_boundary_without_jpmobile
|
404
412
|
end
|
@@ -427,17 +435,6 @@ module Mail
|
|
427
435
|
|
428
436
|
alias_method :epilogue_without_jpmobile, :epilogue
|
429
437
|
alias_method :epilogue, :epilogue_with_jpmobile
|
430
|
-
|
431
|
-
def split!(boundary)
|
432
|
-
self.boundary = boundary
|
433
|
-
parts = raw_source.split(/(?:\A|\r\n)--#{Regexp.escape(boundary)}(?=(?:--)?\s*$)/)
|
434
|
-
# Make the preamble equal to the preamble (if any)
|
435
|
-
self.preamble = parts[0].to_s.strip
|
436
|
-
# Make the epilogue equal to the epilogue (if any)
|
437
|
-
self.epilogue = parts[-1].to_s.sub('--', '').strip
|
438
|
-
parts[1...-1].to_a.each { |part| @parts << Mail::Part.new(:body_raw => part, :mobile => @mobile) }
|
439
|
-
self
|
440
|
-
end
|
441
438
|
end
|
442
439
|
|
443
440
|
class UnstructuredField
|
data/lib/jpmobile/mailer.rb
CHANGED
data/lib/jpmobile/rails.rb
CHANGED
@@ -14,7 +14,8 @@ end
|
|
14
14
|
|
15
15
|
ActiveSupport.on_load(:before_configuration) do
|
16
16
|
# MobileCarrierのみデフォルトで有効
|
17
|
-
|
17
|
+
config.middleware.insert_before ActionDispatch::ParamsParser, Jpmobile::Rack::MobileCarrier
|
18
|
+
|
18
19
|
module Rails
|
19
20
|
class Application
|
20
21
|
class Configuration
|
data/lib/jpmobile/resolver.rb
CHANGED
@@ -11,27 +11,6 @@ module Jpmobile
|
|
11
11
|
|
12
12
|
private
|
13
13
|
|
14
|
-
# Helper for building query glob string based on resolver's pattern.
|
15
|
-
def build_query(path, details)
|
16
|
-
if path.prefix.match(/^\//) and !File.exists?(path.prefix)
|
17
|
-
path = Path.build(path.name, File.join(@path, path.prefix), path.partial)
|
18
|
-
end
|
19
|
-
|
20
|
-
query = @pattern.dup
|
21
|
-
|
22
|
-
prefix = path.prefix.empty? ? "" : "#{escape_entry(path.prefix)}\\1"
|
23
|
-
query.gsub!(/\:prefix(\/)?/, prefix)
|
24
|
-
|
25
|
-
partial = escape_entry(path.partial? ? "_#{path.name}" : path.name)
|
26
|
-
query.gsub!(/\:action/, partial)
|
27
|
-
|
28
|
-
details.each do |ext, variants|
|
29
|
-
query.gsub!(/\:#{ext}/, "{#{variants.compact.uniq.join(',')}}")
|
30
|
-
end
|
31
|
-
|
32
|
-
File.expand_path(query, @path)
|
33
|
-
end
|
34
|
-
|
35
14
|
def query(path, details, formats)
|
36
15
|
query = build_query(path, details)
|
37
16
|
|
@@ -48,8 +27,8 @@ module Jpmobile
|
|
48
27
|
contents = File.binread template
|
49
28
|
|
50
29
|
if format
|
51
|
-
|
52
|
-
virtual_path =
|
30
|
+
jpmobile_variant = template.match(/.+#{path}(.+)\.#{format.to_sym.to_s}.*$/) ? $1 : ''
|
31
|
+
virtual_path = jpmobile_variant.blank? ? path.virtual : path.to_str + jpmobile_variant
|
53
32
|
else
|
54
33
|
virtual_path = path.virtual
|
55
34
|
end
|
data/lib/jpmobile/version.rb
CHANGED
@@ -93,7 +93,7 @@ END
|
|
93
93
|
# run tests in rails
|
94
94
|
cd rails_root
|
95
95
|
ruby "-S bundle install"
|
96
|
-
ruby "-S rake db:migrate" unless skip
|
96
|
+
ruby "-S rake db:migrate RAILS_ENV=test" unless skip
|
97
97
|
ruby "-S rake spec"
|
98
98
|
# ruby "-S rspec -b --color spec/requests/filter_spec.rb -e 'jpmobile integration spec HankakuInputFilterController SoftBank 910T からのアクセス it should behave like hankaku_filter :input => true のとき はtextareaの中では半角に変換されないこと'"
|
99
99
|
end
|
@@ -67,21 +67,6 @@ describe "Jpmobile::Mail#receive" do
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
describe "PC mail without subject" do
|
71
|
-
before(:each) do
|
72
|
-
@mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/pc-mail-attached-without-subject.eml")).read)
|
73
|
-
end
|
74
|
-
|
75
|
-
it "body should be parsed correctly" do
|
76
|
-
@mail.body.parts.size.should == 2
|
77
|
-
@mail.body.parts.first.body.to_s.should == "本文です\n\n"
|
78
|
-
end
|
79
|
-
|
80
|
-
it "should encode correctly" do
|
81
|
-
ascii_8bit(@mail.to_s).should match(/GODlhAQABAIAAAAAAAP/)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
70
|
describe "Docomo" do
|
86
71
|
before(:each) do
|
87
72
|
@mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "../../test/rails/overrides/spec/fixtures/mobile_mailer/docomo-gmail-sjis.eml")).read)
|
@@ -273,7 +258,7 @@ describe "Jpmobile::Mail#receive" do
|
|
273
258
|
|
274
259
|
it 'should be encoded correctly' do
|
275
260
|
@mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/iphone-message.eml")).read)
|
276
|
-
@mail.encoded
|
261
|
+
@mail.encoded
|
277
262
|
end
|
278
263
|
end
|
279
264
|
|
@@ -286,14 +271,14 @@ describe "Jpmobile::Mail#receive" do
|
|
286
271
|
|
287
272
|
it 'should be encoded correctly' do
|
288
273
|
@mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/iphone-mail3.eml")).read)
|
289
|
-
@mail.encoded
|
274
|
+
@mail.encoded
|
290
275
|
end
|
291
276
|
end
|
292
277
|
|
293
278
|
it 'should not raise when parsing attached email' do
|
294
279
|
lambda {
|
295
280
|
@mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/au-attached.eml")).read)
|
296
|
-
@mail.encoded
|
281
|
+
@mail.encoded
|
297
282
|
}.should_not raise_error
|
298
283
|
end
|
299
284
|
end
|
@@ -9,6 +9,13 @@ class FilterControllerBase < ApplicationController
|
|
9
9
|
end
|
10
10
|
def index
|
11
11
|
@q = params[:q]
|
12
|
+
render :text => @q
|
13
|
+
end
|
14
|
+
def index_hankaku
|
15
|
+
render :text => 'アブラカダブラ' == params[:q]
|
16
|
+
end
|
17
|
+
def index_zenkaku
|
18
|
+
render :text => 'アブラカダブラ' == params[:q]
|
12
19
|
end
|
13
20
|
def empty
|
14
21
|
render :text => ""
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '/../spec_helper'))
|
3
|
+
|
4
|
+
shared_examples_for "docomo_guid が起動しないとき" do
|
5
|
+
render_views
|
6
|
+
|
7
|
+
it "で link_to の自動書き換えが行われない" do
|
8
|
+
get :link
|
9
|
+
|
10
|
+
expect(response.body).to match(/href=\".+\/link\"/)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
shared_examples_for "docomo_guid が起動するとき" do
|
15
|
+
it "で link_to の自動書き換えが行われる" do
|
16
|
+
get :link
|
17
|
+
|
18
|
+
expect(response.body).to match(/href=\".+\/link\?guid=ON\"/)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe DocomoGuidBaseController do
|
23
|
+
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)"
|
25
|
+
end
|
26
|
+
|
27
|
+
it "の docomo_guid_mode は nil" do
|
28
|
+
get :link
|
29
|
+
|
30
|
+
controller.docomo_guid_mode.should be_nil
|
31
|
+
end
|
32
|
+
it_should_behave_like "docomo_guid が起動しないとき"
|
33
|
+
end
|
34
|
+
|
35
|
+
describe DocomoGuidAlwaysController do
|
36
|
+
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)"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "の docomo_guid_always は :always" do
|
41
|
+
get :link
|
42
|
+
|
43
|
+
controller.docomo_guid_mode.should == :always
|
44
|
+
end
|
45
|
+
it_should_behave_like "docomo_guid が起動するとき"
|
46
|
+
end
|
47
|
+
|
48
|
+
describe DocomoGuidDocomoController do
|
49
|
+
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)"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "の docomo_guid_mode は :docomo" do
|
54
|
+
get :link
|
55
|
+
|
56
|
+
controller.docomo_guid_mode.should == :docomo
|
57
|
+
end
|
58
|
+
|
59
|
+
shared_examples_for 'describe_mobile_with_ua' do |user_agent, example_name|
|
60
|
+
before do
|
61
|
+
request.user_agent = user_agent
|
62
|
+
end
|
63
|
+
|
64
|
+
it_should_behave_like example_name
|
65
|
+
end
|
66
|
+
|
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 が起動しないとき"
|
74
|
+
end
|