jpmobile 2.0.11 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/Gemfile +3 -4
  2. data/README.rdoc +5 -12
  3. data/Rakefile +1 -1
  4. data/VERSION.yml +2 -2
  5. data/jpmobile.gemspec +3 -2
  6. data/lib/jpmobile.rb +1 -15
  7. data/lib/jpmobile/emoticon.rb +2 -65
  8. data/lib/jpmobile/emoticon/z_combine.rb +1 -17
  9. data/lib/jpmobile/lookup_context.rb +1 -1
  10. data/lib/jpmobile/mail.rb +29 -59
  11. data/lib/jpmobile/mailer.rb +1 -1
  12. data/lib/jpmobile/mobile/abstract_mobile.rb +36 -60
  13. data/lib/jpmobile/mobile/android.rb +0 -2
  14. data/lib/jpmobile/mobile/iphone.rb +25 -1
  15. data/lib/jpmobile/rack.rb +1 -6
  16. data/lib/jpmobile/rails.rb +2 -2
  17. data/lib/jpmobile/resolver.rb +18 -13
  18. data/lib/jpmobile/trans_sid.rb +9 -8
  19. data/lib/jpmobile/util.rb +1 -54
  20. data/lib/tasks/jpmobile_tasks.rake +4 -4
  21. data/spec/rack/jpmobile/emoticon_spec.rb +0 -167
  22. data/spec/rack/jpmobile/mobile_by_ua_spec.rb +1 -5
  23. data/spec/unit/emoticon_spec.rb +0 -60
  24. data/spec/unit/mail_spec.rb +0 -86
  25. data/spec/unit/receive_mail_spec.rb +0 -46
  26. data/spec/unit/util_spec.rb +0 -43
  27. data/test/rails/overrides/Gemfile +4 -19
  28. data/test/rails/overrides/app/controllers/template_path_controller.rb +0 -12
  29. data/test/rails/overrides/spec/mailers/mobile_mailer_spec.rb +0 -10
  30. data/test/rails/overrides/spec/requests/template_path_spec.rb +0 -72
  31. metadata +43 -166
  32. data/lib/jpmobile/emoticon/google.rb +0 -2421
  33. data/lib/jpmobile/emoticon/unicode.rb +0 -2253
  34. data/lib/jpmobile/mobile/android_tablet.rb +0 -12
  35. data/lib/jpmobile/mobile/black_berry.rb +0 -10
  36. data/lib/jpmobile/mobile/google_emoticon.rb +0 -29
  37. data/lib/jpmobile/mobile/ipad.rb +0 -12
  38. data/lib/jpmobile/mobile/tablet.rb +0 -16
  39. data/lib/jpmobile/mobile/unicode_emoticon.rb +0 -43
  40. data/spec/rack/jpmobile/black_berry_spec.rb +0 -20
  41. data/spec/unit/email-fixtures/bounce_with_utf8_part.eml +0 -42
  42. data/spec/unit/email-fixtures/iphone-mail3.eml +0 -56
  43. data/spec/unit/email-fixtures/iphone-message.eml +0 -27
  44. data/spec/unit/mobile/iphone_spec.rb +0 -34
  45. data/spec/unit/variants_spec.rb +0 -128
  46. data/test/rails/overrides/app/views/template_path/smart_phone_only.html.erb +0 -1
  47. data/test/rails/overrides/app/views/template_path/smart_phone_only_smart_phone.html.erb +0 -1
  48. data/test/rails/overrides/app/views/template_path/with_ipd.html.erb +0 -1
  49. data/test/rails/overrides/app/views/template_path/with_ipd_tablet_ipad.html.erb +0 -1
  50. data/test/rails/overrides/app/views/template_path/with_tblt.html.erb +0 -1
  51. data/test/rails/overrides/app/views/template_path/with_tblt_tablet.html.erb +0 -1
  52. data/test/rails/overrides/spec/fixtures/mobile_mailer/bounced-jp.eml +0 -72
  53. data/tools/e4u_conv.rb +0 -122
@@ -19,12 +19,8 @@ describe Jpmobile::Rack::MobileCarrier do
19
19
  [ Jpmobile::Mobile::Iphone , 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; ja-jp) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16' ],
20
20
  [ Jpmobile::Mobile::Android , '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' ],
21
21
  [ Jpmobile::Mobile::WindowsPhone , 'Mozilla/4.0 (Compatible; MSIE 6.0; Windows NT 5.1 T-01A_6.5; Windows Phone 6.5)' ],
22
- [ Jpmobile::Mobile::BlackBerry, 'BlackBerry9000/4.6.0.224 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/220' ],
23
- [ Jpmobile::Mobile::Ipad , 'Mozilla/5.0 (iPad; U; CPU OS 4_3 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F191 Safari/6533.18.5'],
24
- [ Jpmobile::Mobile::AndroidTablet, 'Mozilla/5.0 (Linux; U; Android 2.2; ja-jp; SC-01C Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'],
25
- [ Jpmobile::Mobile::AndroidTablet, 'Mozilla/5.0 (Linux; U; Android 3.2; ja-jp; Sony Tablet S Build/THMAS11002) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13'],
26
22
  ].each do |carrier, user_agent|
27
- it "#mobile should return #{carrier} when take #{user_agent} as UserAgent" do
23
+ it '#mobile should return #{carrier} when take #{user_agent} as UserAgent' do
28
24
  res = Rack::MockRequest.env_for(
29
25
  'http://jpmobile-rails.org/',
30
26
  'HTTP_USER_AGENT' => user_agent)
@@ -30,38 +30,6 @@ describe Jpmobile::Emoticon do
30
30
  Jpmobile::Emoticon::unicodecr_to_external("", Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK, true).should == [0xe04a, 0xe049].pack('U*')
31
31
  end
32
32
  end
33
-
34
- it 'should convert docomo unicodecr to Unicode 6.0 emoticon' do
35
- Jpmobile::Emoticon.unicodecr_to_external("", Jpmobile::Emoticon::CONVERSION_TABLE_TO_UNICODE_EMOTICON, false).should == [0x2600].pack('U')
36
- end
37
-
38
- it 'should convert au unicodecr to Unicode 6.0 emoticon' do
39
- Jpmobile::Emoticon.unicodecr_to_external("", Jpmobile::Emoticon::CONVERSION_TABLE_TO_UNICODE_EMOTICON, false).should == [0x26C5].pack('U')
40
- end
41
-
42
- it 'should convert Softbank unicodecr to Unicode 6.0 emoticon' do
43
- Jpmobile::Emoticon.unicodecr_to_external("", Jpmobile::Emoticon::CONVERSION_TABLE_TO_UNICODE_EMOTICON, false).should == [0x1F466].pack('U')
44
- end
45
-
46
- it 'should not convert 〓' do
47
- Jpmobile::Emoticon.unicodecr_to_external("〓", Jpmobile::Emoticon::CONVERSION_TABLE_TO_UNICODE_EMOTICON, false).should == '〓'
48
- end
49
-
50
- it 'should convert docomo unicodecr to Google emoticon' do
51
- Jpmobile::Emoticon.unicodecr_to_external("", Jpmobile::Emoticon::CONVERSION_TABLE_TO_GOOGLE_EMOTICON, false).should == [0xFE000].pack('U')
52
- end
53
-
54
- it 'should convert au unicodecr to Google emoticon' do
55
- Jpmobile::Emoticon.unicodecr_to_external("", Jpmobile::Emoticon::CONVERSION_TABLE_TO_GOOGLE_EMOTICON, false).should == [0xFE00F].pack('U')
56
- end
57
-
58
- it 'should convert Softbank unicodecr to Google emoticon' do
59
- Jpmobile::Emoticon.unicodecr_to_external("", Jpmobile::Emoticon::CONVERSION_TABLE_TO_GOOGLE_EMOTICON, false).should == [0xFE19B].pack('U')
60
- end
61
-
62
- it 'should not convert 〓' do
63
- Jpmobile::Emoticon.unicodecr_to_external("〓", Jpmobile::Emoticon::CONVERSION_TABLE_TO_GOOGLE_EMOTICON, false).should == '〓'
64
- end
65
33
  end
66
34
 
67
35
  describe "unicodecr_to_utf8" do
@@ -102,34 +70,6 @@ describe Jpmobile::Emoticon do
102
70
  it "should not convert docomo encoding of koukai-sjis emoticons to unicodecr" do
103
71
  Jpmobile::Emoticon::external_to_unicodecr_docomo(sjis("\x8c\xf6\x8a\x4a")).should == sjis("\x8c\xf6\x8a\x4a")
104
72
  end
105
-
106
- context 'at iPhone emoticon' do
107
- it 'should convert iPhone Unicode emoticon to SoftBank emoticon' do
108
- Jpmobile::Emoticon::external_to_unicodecr_unicode60("\342\230\200").should == ""
109
- end
110
-
111
- it 'should convert iPhone Unicode emoticon to multi SoftBank emoticons' do
112
- Jpmobile::Emoticon::external_to_unicodecr_unicode60("\342\233\205").should == ","
113
- end
114
-
115
- it 'should not convert 〓' do
116
- Jpmobile::Emoticon::external_to_unicodecr_unicode60('〓').should == "〓"
117
- end
118
- end
119
-
120
- context 'at Android emoticon' do
121
- it 'should convert Android Google Unicode emoticon to Docomo emoticon' do
122
- Jpmobile::Emoticon::external_to_unicodecr_google("\363\276\200\200").should == ""
123
- end
124
-
125
- it 'should convert Android Google Unicode emoticon to multi Docomo emoticon' do
126
- Jpmobile::Emoticon::external_to_unicodecr_google("\363\276\200\217").should == ""
127
- end
128
-
129
- it 'should not convert 〓' do
130
- Jpmobile::Emoticon::external_to_unicodecr_google('〓').should == "〓"
131
- end
132
- end
133
73
  end
134
74
 
135
75
  context "for email" do
@@ -255,31 +255,6 @@ describe "Jpmobile::Mail" do
255
255
  end
256
256
  end
257
257
 
258
- describe "long subject with half-characters" do
259
- before(:each) do
260
- @mail = Mail.new
261
- @mail.subject = "西暦2012年09月03日は今日になるわけだが10時16分現在のこの時間ではどうかな"
262
- @mail.body = "株式会社・・"
263
- @mail.from = "info@jpmobile-rails.org"
264
- end
265
-
266
- describe "AbstractMobile" do
267
- before(:each) do
268
- @mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
269
- @mail.mobile = @mobile
270
- @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
271
- end
272
-
273
- context "to_s" do
274
- it "should contain encoded subject" do
275
- ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCQD5OcRsoQjIwMTIbJEJHLxsoQjA5GyRCN24bKEIwMxskQkZ8JE86IxsoQg==?=")))
276
- ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCRnwkSyRKJGskbyQxJEAkLBsoQjEwGyRCO34bKEIxNhskQkosOD0bKEI=?=")))
277
- ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCOl8kTiQzJE47fjRWJEckTyRJJCYkKyRKGyhC?=")))
278
- end
279
- end
280
- end
281
- end
282
-
283
258
  context "with attachments" do
284
259
  before(:each) do
285
260
  @mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
@@ -303,14 +278,6 @@ describe "Jpmobile::Mail" do
303
278
  @mail.to_s
304
279
  }.should_not raise_error
305
280
  end
306
-
307
- it "should encodes itself successfully with an UTF-8 filename attachment" do
308
- @mail.attachments.inline['日本語のファイル名です.jpg'] = @photo
309
-
310
- lambda {
311
- @mail.to_s
312
- }.should_not raise_error
313
- end
314
281
  end
315
282
 
316
283
  context "encoding conversion" do
@@ -333,57 +300,4 @@ describe "Jpmobile::Mail" do
333
300
  ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("\x31\x30\x3a\x30\x30\x1b\x24\x42\x21\x41\x1b\x28\x42\x31\x32\x3a\x30\x30"))))
334
301
  end
335
302
  end
336
-
337
- context "delivering" do
338
- before(:each) do
339
- @mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
340
- @mail.mobile = @mobile
341
- @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
342
- end
343
-
344
- it "delivers through SMTP" do
345
- @mail.delivery_method :smtp, {:enable_starttls_auto => false}
346
- lambda {
347
- @mail.deliver
348
- }.should_not raise_error
349
-
350
- Mail::TestMailer.deliveries.size
351
- end
352
- end
353
-
354
- context 'sending with carrier from' do
355
- before do
356
- @mail = Mail.new
357
- @mail.subject = "万葉"
358
- @mail.to = "ちはやふる <info@jpmobile-rails.org>"
359
- end
360
-
361
- it 'should convert content-transfer-encoding' do
362
- mobile = Jpmobile::Mobile::Au.new(nil, nil)
363
- @mail.content_transfer_encoding = 'base64'
364
- @mail.body = ['ほげ'].pack('m')
365
- @mail.charset = 'UTF-8'
366
-
367
- @mail.mobile = mobile
368
- @mail.from = '<えーゆー> au@ezweb.ne.jp'
369
-
370
- @mail.encoded.should match(/content-transfer-encoding: 7bit/i)
371
- end
372
-
373
- it 'should not convert content-transfer-encoding with BINARY' do
374
- mobile = Jpmobile::Mobile::Au.new(nil, nil)
375
- data = ['ほげ'].pack('m').strip
376
-
377
- @mail.content_transfer_encoding = 'base64'
378
- @mail.content_type = 'image/jpeg'
379
- @mail.body = data
380
- @mail.charset = 'UTF-8'
381
-
382
- @mail.mobile = mobile
383
- @mail.from = '<えーゆー> au@ezweb.ne.jp'
384
-
385
- @mail.encoded.should match(/content-transfer-encoding: base64/i)
386
- @mail.encoded.should match(data)
387
- end
388
- end
389
303
  end
@@ -148,14 +148,6 @@ describe "Jpmobile::Mail#receive" do
148
148
  end
149
149
  end
150
150
  end
151
-
152
- context 'bounced mail' do
153
- it 'should parse sub-part charset correctly' do
154
- @mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/bounce_with_utf8_part.eml")).read)
155
- @mail.parts.first.charset.should match(/iso-2022-jp/i)
156
- @mail.parts.last.charset.should match(/utf-8/i)
157
- end
158
- end
159
151
  end
160
152
 
161
153
  describe "Docomo" do
@@ -228,32 +220,6 @@ describe "Jpmobile::Mail#receive" do
228
220
  ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("\x1b\x24\x42\x32\x71\x35\x44\x24\x2C\x33\x2B\x3A\x45\x75\x48\x1b\x28\x42"))))
229
221
  end
230
222
  end
231
-
232
- context 'From au iPhone' do
233
- it 'charset should be UTF-8' do
234
- @mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/iphone-message.eml")).read)
235
- @mail.mobile.should be_a(Jpmobile::Mobile::Au)
236
- @mail.charset.should match(/utf-8/i)
237
- end
238
-
239
- it 'should be encoded correctly' do
240
- @mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/iphone-message.eml")).read)
241
- @mail.encoded
242
- end
243
- end
244
-
245
- context 'From iPad' do
246
- it 'charset should be UTF-8' do
247
- @mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/iphone-mail3.eml")).read)
248
- @mail.mobile.should be_a(Jpmobile::Mobile::AbstractMobile)
249
- @mail.charset.should match(/utf-8/i)
250
- end
251
-
252
- it 'should be encoded correctly' do
253
- @mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/iphone-mail3.eml")).read)
254
- @mail.encoded
255
- end
256
- end
257
223
  end
258
224
 
259
225
  describe "Softbank" do
@@ -322,18 +288,6 @@ describe "Jpmobile::Mail#receive" do
322
288
  end
323
289
  end
324
290
 
325
- describe 'bounced mail' do
326
- context "has jp address" do
327
- before(:each) do
328
- @mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "../../test/rails/overrides/spec/fixtures/mobile_mailer/bounced-jp.eml")).read)
329
- end
330
-
331
- it "mobile should abstract mobile" do
332
- @mail.mobile.should be_a Jpmobile::Mobile::AbstractMobile
333
- end
334
- end
335
- end
336
-
337
291
  describe "non-Japanese mail" do
338
292
  context "us-ascii" do
339
293
  before(:each) do
@@ -108,47 +108,4 @@ describe Jpmobile::Util do
108
108
  ascii_8bit(utf8_to_jis("\xef\xbd\x9e")).should == ascii_8bit("\x1b\x24\x42\x21\x41\x1b\x28\x42")
109
109
  ascii_8bit(encode("\xef\xbd\x9e", "ISO-2022-JP")).should == ascii_8bit("\x1b\x24\x42\x21\x41\x1b\x28\x42")
110
110
  end
111
-
112
- describe 'invert_table' do
113
- it 'pickups the first(least) of duplicated values when inverting hash table' do
114
- hash = invert_table({
115
- 0xFE009 => 0xE63E,
116
- 0xFE00A => 0xE63E,
117
- 0xFE00B => 0x3013,
118
- 0xFE010 => 0xE6B3,
119
- 0xFE038 => 0xE73F})
120
- hash[0xE63E].should == 0xFE009
121
- hash[0x3013].should == 0xFE00B
122
- end
123
-
124
- it 'should not raise error when hash has Array keys' do
125
- hash = invert_table({
126
- [0x1F1E8, 0x1F1F3] => 0x3013,
127
- 0x1F1FF => 0x3013,
128
- 0x1F526 => 0xE6FB,
129
- [0x0023, 0x20E3] => 0xE6E0,
130
- 0x1F354 => 0xE673})
131
- hash[0x3013].should == [0x1F1E8, 0x1F1F3]
132
- hash[0xE6FB].should == 0x1F526
133
- end
134
- end
135
-
136
- describe 'check_charset' do
137
- it 'returns true if compatible' do
138
- str = 'ABC'.force_encoding('ASCII-8BIT')
139
- check_charset(str, 'UTF-8').should be_true
140
- end
141
-
142
- it 'returns false if incompatible' do
143
- str = '再現'.encode('ISO-2022-JP')
144
- check_charset(str, 'UTF-8').should be_false
145
- end
146
- end
147
-
148
- describe 'correct_encoding' do
149
- it 'updates encoding correctly' do
150
- str = '再現'.force_encoding('ISO-2022-JP')
151
- correct_encoding(str).encoding.should == Encoding::UTF_8
152
- end
153
- end
154
111
  end
@@ -1,30 +1,15 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rails', '~> 3.1.8'
4
- gem 'mail', '~> 2.3.0'
5
-
6
- # Bundle edge Rails instead:
7
- # gem 'rails', :git => 'git://github.com/rails/rails.git'
3
+ gem 'rails', '~> 3.2.0'
8
4
 
9
5
  gem 'sqlite3-ruby', :require => 'sqlite3'
10
6
 
11
7
  gem 'geokit'
12
8
  gem 'hpricot'
13
9
 
14
- # Use unicorn as the web server
15
- # gem 'unicorn'
16
-
17
- # Deploy with Capistrano
18
- # gem 'capistrano'
19
-
20
- # To use debugger
21
- # gem 'ruby-debug'
22
-
23
- # Bundle the extra gems:
24
- # gem 'bj'
25
- # gem 'nokogiri', '1.4.1'
26
- # gem 'sqlite3-ruby', :require => 'sqlite3'
27
- # gem 'aws-s3', :require => 'aws/s3'
10
+ gem 'jpmobile', :path => '../../../'
11
+ gem 'jpmobile-terminfo', :path => '../../../vendor/jpmobile-terminfo'
12
+ gem 'jpmobile-ipaddresses', :path => '../../../vendor/jpmobile-ipaddresses'
28
13
 
29
14
  # Bundle gems for certain environments:
30
15
  group :development, :test do
@@ -13,17 +13,5 @@ class TemplatePathController < ApplicationController
13
13
  def optioned_index
14
14
  render :action => "index"
15
15
  end
16
-
17
- def full_path_partial
18
- end
19
-
20
- def smart_phone_only
21
- end
22
-
23
- def with_tblt
24
- end
25
-
26
- def with_ipd
27
- end
28
16
  end
29
17
 
@@ -78,7 +78,6 @@ describe MobileMailer do
78
78
  raw_mail.should match(/iso-2022-jp/i)
79
79
  raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit([utf8_to_jis("題名")].pack('m').strip))))
80
80
  raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit(utf8_to_jis("本文")))))
81
- raw_mail.should match(/For PC/)
82
81
  end
83
82
  end
84
83
 
@@ -664,15 +663,6 @@ describe MobileMailer, "receiving" do
664
663
  parts.first.body.should match(/テストです&#xe595;/)
665
664
  parts.last.body.raw_source.should match(/テストです&#xe595;/)
666
665
  end
667
-
668
- context 'iPhone' do
669
- it 'should parse correctly' do
670
- lambda {
671
- @mail = MobileMailer.receive(open(File.join(Rails.root, "../../../spec/unit/email-fixtures/iphone-message.eml")).read)
672
- @mail.encoded
673
- }.should_not raise_error
674
- end
675
- end
676
666
  end
677
667
 
678
668
  describe "softbank(sjis) の場合" do
@@ -169,78 +169,6 @@ describe TemplatePathController, "integrated_views" do
169
169
  end
170
170
  end
171
171
 
172
- context 'only smart_phone view' do
173
- context 'iPadからのアクセスの場合' do
174
- before do
175
- @user_agent = 'Mozilla/5.0 (iPad; U; CPU OS 4_3 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F191 Safari/6533.18.5'
176
- end
177
- it 'smart_phone_only.html.erbが使用されること' do
178
- get '/template_path/smart_phone_only', {}, {'HTTP_USER_AGENT' => @user_agent}
179
-
180
- response.should have_tag('h1', :content => 'smart_phone_only_smart_phone.html.erb')
181
- end
182
- end
183
-
184
- context 'Android Tabletからのアクセスの場合' do
185
- before do
186
- @user_agent = 'Mozilla/5.0 (Linux; U; Android 2.2; ja-jp; SC-01C Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'
187
- end
188
- it 'smart_phone_only.html.erbが使用されること' do
189
- get '/template_path/smart_phone_only', {}, {'HTTP_USER_AGENT' => @user_agent}
190
-
191
- response.should have_tag('h1', :content => 'smart_phone_only_smart_phone.html.erb')
192
- end
193
- end
194
- end
195
-
196
- context 'with_tblt view' do
197
- context 'iPadからのアクセスの場合' do
198
- before do
199
- @user_agent = 'Mozilla/5.0 (iPad; U; CPU OS 4_3 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F191 Safari/6533.18.5'
200
- end
201
- it 'with_tblt_tablet.html.erbが使用されること' do
202
- get '/template_path/with_tblt', {}, {'HTTP_USER_AGENT' => @user_agent}
203
-
204
- response.should have_tag('h1', :content => 'with_tblt_tablet.html.erb')
205
- end
206
- end
207
-
208
- context 'Android Tabletからのアクセスの場合' do
209
- before do
210
- @user_agent = 'Mozilla/5.0 (Linux; U; Android 2.2; ja-jp; SC-01C Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'
211
- end
212
- it 'with_tblt_tablet.html.erbが使用されること' do
213
- get '/template_path/with_tblt', {}, {'HTTP_USER_AGENT' => @user_agent}
214
-
215
- response.should have_tag('h1', :content => 'with_tblt_tablet.html.erb')
216
- end
217
- end
218
- end
219
-
220
- context 'with_ipd view' do
221
- context 'iPadからのアクセスの場合' do
222
- before do
223
- @user_agent = 'Mozilla/5.0 (iPad; U; CPU OS 4_3 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F191 Safari/6533.18.5'
224
- end
225
- it 'with_ipd_tablet_ipad.html.erbが使用されること' do
226
- get '/template_path/with_ipd', {}, {'HTTP_USER_AGENT' => @user_agent}
227
-
228
- response.should have_tag('h1', :content => 'with_ipd_tablet_ipad.html.erb')
229
- end
230
- end
231
-
232
- context 'Android Tabletからのアクセスの場合' do
233
- before do
234
- @user_agent = 'Mozilla/5.0 (Linux; U; Android 2.2; ja-jp; SC-01C Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'
235
- end
236
- it 'with_ipd.html.erbが使用されること' do
237
- get '/template_path/with_ipd', {}, {'HTTP_USER_AGENT' => @user_agent}
238
-
239
- response.should have_tag('h1', :content => 'with_ipd.html.erb')
240
- end
241
- end
242
- end
243
-
244
172
  context "partial" do
245
173
  context "PCからのアクセスの場合" do
246
174
  before do