jpmobile 1.0.0.pre.4 → 1.0.0.pre.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. data/.rspec +4 -0
  2. data/Gemfile +3 -3
  3. data/VERSION.yml +2 -2
  4. data/jpmobile.gemspec +335 -0
  5. data/lib/jpmobile.rb +0 -1
  6. data/lib/jpmobile/email.rb +47 -21
  7. data/lib/jpmobile/mail.rb +33 -26
  8. data/lib/jpmobile/mailer.rb +2 -0
  9. data/lib/jpmobile/util.rb +3 -3
  10. data/spec/unit/email-fixtures/au-attached.eml +1551 -0
  11. data/spec/unit/email-fixtures/au-decomail.eml +44 -0
  12. data/spec/unit/email-fixtures/au-emoji.eml +19 -0
  13. data/spec/unit/email-fixtures/au-emoji2.eml +45 -0
  14. data/spec/unit/email-fixtures/au-emoji5.eml +24 -0
  15. data/spec/unit/email-fixtures/docomo-emoji.eml +19 -0
  16. data/spec/unit/email-fixtures/docomo-gmail-sjis.eml +45 -0
  17. data/spec/unit/email-fixtures/docomo-jis.eml +20 -0
  18. data/spec/unit/email-fixtures/pc-mail-multi.eml +77 -0
  19. data/spec/unit/email-fixtures/pc-mail-single.eml +29 -0
  20. data/spec/unit/email-fixtures/softbank-blank.eml +20 -0
  21. data/spec/unit/email-fixtures/softbank-emoji-utf8.eml +19 -0
  22. data/spec/unit/email-fixtures/softbank-emoji.eml +19 -0
  23. data/spec/unit/email-fixtures/softbank-gmail-sjis.eml +45 -0
  24. data/spec/unit/email-fixtures/softbank-gmail-utf8.eml +45 -0
  25. data/spec/unit/{detect_by_email_spec.rb → email_spec.rb} +25 -2
  26. data/spec/unit/emoticon_spec.rb +1 -1
  27. data/spec/unit/encoding_spec.rb +1 -1
  28. data/spec/unit/is_carrier_spec.rb +1 -1
  29. data/spec/unit/mail_spec.rb +1 -1
  30. data/spec/unit/receive_mail_spec.rb +26 -1
  31. data/spec/unit/util_spec.rb +1 -1
  32. data/spec/unit/valid_ip_spec.rb +1 -1
  33. data/test/rails/.gitignore +1 -0
  34. data/test/rails/overrides/.rspec +5 -0
  35. data/test/rails/overrides/Gemfile +33 -0
  36. data/test/rails/overrides/app/views/filter/index.html.erb +0 -0
  37. data/test/rails/overrides/app/views/hankaku_filter/index.html.erb +0 -0
  38. data/test/rails/overrides/app/views/hankaku_input_filter/index.html.erb +0 -0
  39. data/test/rails/overrides/app/views/hankaku_input_filter/index_xhtml.html.erb +1 -0
  40. data/test/rails/overrides/app/views/layouts/xhtml.html.erb +12 -0
  41. data/test/rails/overrides/app/views/links/au_gps.html.erb +1 -0
  42. data/test/rails/overrides/app/views/links/au_location.html.erb +1 -0
  43. data/test/rails/overrides/app/views/links/docomo_foma_gps.html.erb +1 -0
  44. data/test/rails/overrides/app/views/links/docomo_openiarea.html.erb +1 -0
  45. data/test/rails/overrides/app/views/links/docomo_utn.html.erb +1 -0
  46. data/test/rails/overrides/app/views/links/link.html.erb +1 -0
  47. data/test/rails/overrides/app/views/links/show_all.html.erb +1 -0
  48. data/test/rails/overrides/app/views/links/softbank_location.html.erb +1 -0
  49. data/test/rails/overrides/app/views/links/willcom_location.html.erb +1 -0
  50. data/test/rails/overrides/app/views/mobile_mailer/multi_message.html.erb +11 -0
  51. data/test/rails/overrides/app/views/mobile_mailer/multi_message.text.erb +2 -0
  52. data/test/rails/overrides/app/views/mobile_mailer/view_selection.html.erb +3 -0
  53. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile.html.erb +3 -0
  54. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_au.html.erb +3 -0
  55. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_docomo.html.erb +3 -0
  56. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_emobile.html.erb +3 -0
  57. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_softbank.html.erb +3 -0
  58. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_vodafone.html.erb +3 -0
  59. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_willcom.html.erb +3 -0
  60. data/test/rails/overrides/app/views/normal_mailer/msg.text.erb +3 -0
  61. data/test/rails/overrides/app/views/template_path/_partial.html.erb +1 -0
  62. data/test/rails/overrides/app/views/template_path/_partial_mobile.html.erb +1 -0
  63. data/test/rails/overrides/app/views/template_path/_partial_mobile_docomo.html.erb +1 -0
  64. data/test/rails/overrides/app/views/template_path/_partial_smart_phone.html.erb +1 -0
  65. data/test/rails/overrides/app/views/template_path/_partial_smart_phone_iphone.html.erb +1 -0
  66. data/test/rails/overrides/app/views/template_path/index.html.erb +1 -0
  67. data/test/rails/overrides/app/views/template_path/index_mobile.html.erb +1 -0
  68. data/test/rails/overrides/app/views/template_path/index_mobile_docomo.html.erb +1 -0
  69. data/test/rails/overrides/app/views/template_path/index_smart_phone.html.erb +1 -0
  70. data/test/rails/overrides/app/views/template_path/index_smart_phone_iphone.html.erb +1 -0
  71. data/test/rails/overrides/app/views/template_path/partial.html.erb +2 -0
  72. data/test/rails/overrides/app/views/template_path/show_mobile.html.erb +1 -0
  73. data/test/rails/overrides/app/views/template_path/show_mobile_docomo.html.erb +1 -0
  74. data/test/rails/overrides/spec/fixtures/mobile_mailer/au-attached.eml +1551 -0
  75. data/test/rails/overrides/spec/fixtures/mobile_mailer/au-decomail.eml +44 -0
  76. data/test/rails/overrides/spec/fixtures/mobile_mailer/au-emoji.eml +19 -0
  77. data/test/rails/overrides/spec/fixtures/mobile_mailer/au-emoji2.eml +45 -0
  78. data/test/rails/overrides/spec/fixtures/mobile_mailer/au-emoji5.eml +24 -0
  79. data/test/rails/overrides/spec/fixtures/mobile_mailer/docomo-emoji.eml +19 -0
  80. data/test/rails/overrides/spec/fixtures/mobile_mailer/docomo-gmail-sjis.eml +45 -0
  81. data/test/rails/overrides/spec/fixtures/mobile_mailer/docomo-jis.eml +20 -0
  82. data/test/rails/overrides/spec/fixtures/mobile_mailer/no-from.eml +78 -0
  83. data/test/rails/overrides/spec/fixtures/mobile_mailer/non-jp.eml +45 -0
  84. data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-blank.eml +20 -0
  85. data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-emoji-utf8.eml +19 -0
  86. data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-emoji.eml +19 -0
  87. data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-gmail-sjis.eml +45 -0
  88. data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-gmail-utf8.eml +45 -0
  89. data/test/rails/overrides/spec/helpers/helpers_spec.rb +1 -2
  90. data/test/rails/overrides/spec/models/mobile_mailer_spec.rb +37 -1
  91. data/test/rails/overrides/spec/models/normal_mailer_spec.rb +1 -1
  92. data/test/rails/overrides/spec/rcov.opts +2 -0
  93. data/test/rails/overrides/spec/requests/docomo_guid_spec.rb +1 -2
  94. data/test/rails/overrides/spec/requests/docomo_spec.rb +1 -2
  95. data/test/rails/overrides/spec/requests/emobile_spec.rb +1 -2
  96. data/test/rails/overrides/spec/requests/filter_spec.rb +1 -1
  97. data/test/rails/overrides/spec/requests/helpers_spec.rb +1 -1
  98. data/test/rails/overrides/spec/requests/pc_spec.rb +1 -2
  99. data/test/rails/overrides/spec/requests/softbank_emulator_spec.rb +1 -2
  100. data/test/rails/overrides/spec/requests/template_path_spec.rb +1 -2
  101. data/test/rails/overrides/spec/requests/trans_sid_spec.rb +1 -2
  102. data/test/rails/overrides/spec/spec_helper.rb +1 -1
  103. metadata +229 -386
  104. data/test/rails/rails_root/app/controllers/application_controller.rb +0 -6
  105. data/test/rails/rails_root/app/controllers/docomo_guid_always_controller.rb +0 -3
  106. data/test/rails/rails_root/app/controllers/docomo_guid_base_controller.rb +0 -5
  107. data/test/rails/rails_root/app/controllers/docomo_guid_docomo_controller.rb +0 -3
  108. data/test/rails/rails_root/app/controllers/filter_controller.rb +0 -3
  109. data/test/rails/rails_root/app/controllers/filter_controller_base.rb +0 -25
  110. data/test/rails/rails_root/app/controllers/hankaku_filter_controller.rb +0 -3
  111. data/test/rails/rails_root/app/controllers/hankaku_input_filter_controller.rb +0 -7
  112. data/test/rails/rails_root/app/controllers/links_controller.rb +0 -28
  113. data/test/rails/rails_root/app/controllers/mobile_spec_controller.rb +0 -5
  114. data/test/rails/rails_root/app/controllers/template_path_controller.rb +0 -17
  115. data/test/rails/rails_root/app/controllers/trans_sid_always_and_session_off_controller.rb +0 -4
  116. data/test/rails/rails_root/app/controllers/trans_sid_always_controller.rb +0 -3
  117. data/test/rails/rails_root/app/controllers/trans_sid_base_controller.rb +0 -40
  118. data/test/rails/rails_root/app/controllers/trans_sid_metal_controller.rb +0 -15
  119. data/test/rails/rails_root/app/controllers/trans_sid_mobile_controller.rb +0 -3
  120. data/test/rails/rails_root/app/controllers/trans_sid_none_controller.rb +0 -3
  121. data/test/rails/rails_root/app/helpers/application_helper.rb +0 -2
  122. data/test/rails/rails_root/app/models/mobile_mailer.rb +0 -19
  123. data/test/rails/rails_root/app/models/normal_mailer.rb +0 -9
  124. data/test/rails/rails_root/app/models/user.rb +0 -2
  125. data/test/rails/rails_root/autotest/discover.rb +0 -2
  126. data/test/rails/rails_root/config/application.rb +0 -42
  127. data/test/rails/rails_root/config/boot.rb +0 -6
  128. data/test/rails/rails_root/config/environment.rb +0 -5
  129. data/test/rails/rails_root/config/environments/development.rb +0 -26
  130. data/test/rails/rails_root/config/environments/production.rb +0 -49
  131. data/test/rails/rails_root/config/environments/test.rb +0 -35
  132. data/test/rails/rails_root/config/initializers/backtrace_silencers.rb +0 -7
  133. data/test/rails/rails_root/config/initializers/inflections.rb +0 -10
  134. data/test/rails/rails_root/config/initializers/jpmobile_generator.rb +0 -2
  135. data/test/rails/rails_root/config/initializers/mime_types.rb +0 -5
  136. data/test/rails/rails_root/config/initializers/secret_token.rb +0 -7
  137. data/test/rails/rails_root/config/initializers/session_store.rb +0 -2
  138. data/test/rails/rails_root/config/routes.rb +0 -7
  139. data/test/rails/rails_root/db/migrate/001_add_sessions_table.rb +0 -16
  140. data/test/rails/rails_root/db/migrate/20100824062306_create_users.rb +0 -13
  141. data/test/rails/rails_root/db/schema.rb +0 -31
  142. data/test/rails/rails_root/db/seeds.rb +0 -7
  143. data/test/rails/rails_root/spec/helpers/helpers_spec.rb +0 -15
  144. data/test/rails/rails_root/spec/models/mobile_mailer_spec.rb +0 -737
  145. data/test/rails/rails_root/spec/models/normal_mailer_spec.rb +0 -34
  146. data/test/rails/rails_root/spec/requests/docomo_guid_spec.rb +0 -102
  147. data/test/rails/rails_root/spec/requests/docomo_spec.rb +0 -33
  148. data/test/rails/rails_root/spec/requests/emobile_spec.rb +0 -53
  149. data/test/rails/rails_root/spec/requests/filter_spec.rb +0 -221
  150. data/test/rails/rails_root/spec/requests/helpers_spec.rb +0 -187
  151. data/test/rails/rails_root/spec/requests/pc_spec.rb +0 -22
  152. data/test/rails/rails_root/spec/requests/softbank_emulator_spec.rb +0 -21
  153. data/test/rails/rails_root/spec/requests/template_path_spec.rb +0 -240
  154. data/test/rails/rails_root/spec/requests/trans_sid_spec.rb +0 -207
  155. data/test/rails/rails_root/spec/spec_helper.rb +0 -38
  156. data/test/rails/rails_root/test/performance/browsing_test.rb +0 -9
  157. data/test/rails/rails_root/test/test_helper.rb +0 -13
  158. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile-ipaddresses.rb +0 -18
  159. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/abstract_ip_addresses.rb +0 -23
  160. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/au.rb +0 -40
  161. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/docomo.rb +0 -22
  162. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/emobile.rb +0 -15
  163. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/softbank.rb +0 -20
  164. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/willcom.rb +0 -158
  165. data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/lib/jpmobile-terminfo.rb +0 -9
  166. data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/lib/jpmobile/mobile/terminfo.rb +0 -62
  167. data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/lib/jpmobile/mobile/terminfo/docomo.rb +0 -739
  168. data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/spec/spec_helper.rb +0 -2
  169. data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/spec/terminfo_spec.rb +0 -54
  170. data/test/rails/rails_root/vendor/plugins/jpmobile/init.rb +0 -3
  171. data/test/rails/rails_root/vendor/plugins/jpmobile/install.rb +0 -1
  172. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile.rb +0 -59
  173. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/datum_conv.rb +0 -72
  174. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/docomo_guid.rb +0 -43
  175. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/email.rb +0 -33
  176. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon.rb +0 -205
  177. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/au.rb +0 -1931
  178. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/conversion_table.rb +0 -3909
  179. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/docomo.rb +0 -255
  180. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/softbank.rb +0 -965
  181. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/z_combine.rb +0 -36
  182. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/encoding.rb +0 -29
  183. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/filter.rb +0 -113
  184. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/helpers.rb +0 -174
  185. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_controller.rb +0 -18
  186. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_dispatch.rb +0 -2
  187. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_view.rb +0 -33
  188. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/lookup_context.rb +0 -2
  189. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mail.rb +0 -330
  190. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mailer.rb +0 -41
  191. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/abstract_mobile.rb +0 -168
  192. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/android.rb +0 -10
  193. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/au.rb +0 -128
  194. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/ddipocket.rb +0 -12
  195. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/docomo.rb +0 -149
  196. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/emobile.rb +0 -16
  197. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/iphone.rb +0 -26
  198. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/smart_phone.rb +0 -21
  199. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/softbank.rb +0 -91
  200. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/vodafone.rb +0 -17
  201. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/willcom.rb +0 -28
  202. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/windows_phone.rb +0 -10
  203. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/path_set.rb +0 -40
  204. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/position.rb +0 -68
  205. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack.rb +0 -49
  206. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/filter.rb +0 -50
  207. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/mobile_carrier.rb +0 -33
  208. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/params_filter.rb +0 -47
  209. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rails.rb +0 -50
  210. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/request_with_mobile.rb +0 -45
  211. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/resolver.rb +0 -38
  212. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/trans_sid.rb +0 -133
  213. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/util.rb +0 -370
  214. data/test/rails/rails_root/vendor/plugins/jpmobile/tmp/conversion-table.rb +0 -2588
  215. data/test/rails/rails_root/vendor/plugins/jpmobile/tmp/utf8_to_image.rb +0 -1407
  216. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/emoji/genregexp.rb +0 -47
  217. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_au_emoticon_table.rb +0 -34
  218. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_docomo_emoticon_table.rb +0 -33
  219. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_emoticon_conversion_table.rb +0 -107
  220. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_softbank_emoticon_table.rb +0 -31
  221. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/list_gps_unsupported_au.rb +0 -23
  222. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile-ipaddresses.rb +0 -18
  223. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/abstract_ip_addresses.rb +0 -23
  224. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/au.rb +0 -40
  225. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/docomo.rb +0 -22
  226. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/emobile.rb +0 -15
  227. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/softbank.rb +0 -20
  228. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/willcom.rb +0 -158
  229. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/lib/jpmobile-terminfo.rb +0 -9
  230. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/lib/jpmobile/mobile/terminfo.rb +0 -62
  231. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/lib/jpmobile/mobile/terminfo/docomo.rb +0 -739
  232. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/spec/spec_helper.rb +0 -2
  233. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/spec/terminfo_spec.rb +0 -54
@@ -1,34 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.dirname(__FILE__) + '/../spec_helper'
3
-
4
- describe NormalMailer do
5
- include Jpmobile::Util
6
-
7
- before(:each) do
8
- ActionMailer::Base.deliveries = []
9
-
10
- @to = ["outer@jp.mobile", "outer1@jp.mobile"]
11
- @subject = "日本語題名"
12
- @text = "日本語テキスト"
13
- end
14
-
15
- context "PC宛メール" do
16
- it "正常に送信できること" do
17
- email = NormalMailer.msg(@to, "題名", "本文").deliver
18
-
19
- ActionMailer::Base.deliveries.size.should == 1
20
- (email.to - @to).should be_empty
21
- end
22
-
23
- it "UTF-8のままであること" do
24
- email = NormalMailer.msg(@to, @subject, @text).deliver
25
-
26
- ActionMailer::Base.deliveries.size.should == 1
27
-
28
- raw_mail = ascii_8bit(email.to_s)
29
- raw_mail.should match(/UTF-8/i)
30
- raw_mail.should match(Regexp.escape("=E6=97=A5=E6=9C=AC=E8=AA=9E=E9=A1=8C=E5=90=8D"))
31
- raw_mail.should match(Regexp.escape([@text].pack("m").strip))
32
- end
33
- end
34
- end
@@ -1,102 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- require File.dirname(__FILE__) + '/../spec_helper'
4
-
5
- shared_examples_for "docomo_guid が起動しないとき" do
6
- it "で link_to の自動書き換えが行われない" do
7
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
8
-
9
- response.should have_tag('a') do |a|
10
- a.first['href'].should match(/^\/.+?\/link$/)
11
- end
12
- end
13
- end
14
-
15
- shared_examples_for "docomo_guid が起動するとき" do
16
- it "で link_to の自動書き換えが行われる" do
17
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
18
-
19
- response.should have_tag('a') do |a|
20
- a.first['href'].should match(/^\/.+?\/link\?guid=ON$/)
21
- end
22
- end
23
- end
24
-
25
- describe DocomoGuidBaseController, "という docomo_guid が有効になっていないコントローラ" do
26
- before(:each) do
27
- @controller = "docomo_guid_base"
28
- @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)"
29
- end
30
-
31
- it "の docomo_guid_mode は nil" do
32
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
33
-
34
- controller.docomo_guid_mode.should be_nil
35
- end
36
- it_should_behave_like "docomo_guid が起動しないとき"
37
- end
38
-
39
- describe DocomoGuidAlwaysController, "という docomo_guid :always が指定されているコントローラ" do
40
- before(:each) do
41
- @controller = "docomo_guid_always"
42
- @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)"
43
- end
44
-
45
- it "の docomo_guid_always は :always" do
46
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
47
-
48
- controller.docomo_guid_mode.should == :always
49
- end
50
- it_should_behave_like "docomo_guid が起動するとき"
51
- end
52
-
53
- describe DocomoGuidDocomoController, "という docomo_guid :docomo が指定されているコントローラ" do
54
- before(:each) do
55
- @controller = "docomo_guid_docomo"
56
- @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)"
57
- end
58
-
59
- it "の docomo_guid_mode は :docomo" do
60
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
61
-
62
- controller.docomo_guid_mode.should == :docomo
63
- end
64
- end
65
-
66
- def describe_mobile_with_ua(user_agent, &block)
67
- describe("docomo_guid :docomo が指定されているコントローラに #{user_agent} からアクセスしたとき") do
68
- before do
69
- @controller = "docomo_guid_docomo"
70
- @user_agent = user_agent
71
- end
72
- instance_eval(&block)
73
- end
74
- end
75
-
76
- describe_mobile_with_ua "DoCoMo/2.0 SH902i(c100;TB;W24H12)" do
77
- it_should_behave_like "docomo_guid が起動するとき"
78
- end
79
-
80
- describe_mobile_with_ua "J-PHONE/3.0/V301D" do
81
- it_should_behave_like "docomo_guid が起動しないとき"
82
- end
83
-
84
- describe_mobile_with_ua "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0" do
85
- it_should_behave_like "docomo_guid が起動しないとき"
86
- end
87
-
88
- describe_mobile_with_ua "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1" do
89
- it_should_behave_like "docomo_guid が起動しないとき"
90
- end
91
-
92
- 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" do
93
- it_should_behave_like "docomo_guid が起動しないとき"
94
- end
95
-
96
- describe_mobile_with_ua "DoCoMo/1.0/N505i/c20/TB/W20H10 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)" do
97
- it_should_behave_like "docomo_guid が起動しないとき"
98
- end
99
-
100
- 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)" do
101
- it_should_behave_like "docomo_guid が起動しないとき"
102
- end
@@ -1,33 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- require File.dirname(__FILE__) + '/../spec_helper'
4
-
5
- describe "DoCoMo SH902i からのアクセス" do
6
- it "request.mobile は Docomo のインスタンスであるべき" do
7
- get "/mobile_spec/index", {}, {"HTTP_USER_AGENT" => "DoCoMo/2.0 SH902i(c100;TB;W24H12)"}
8
-
9
- request.mobile.should be_an_instance_of(Jpmobile::Mobile::Docomo)
10
- end
11
- it "request.mobile? は true であるべき" do
12
- get "/mobile_spec/index", {}, {"HTTP_USER_AGENT" => "DoCoMo/2.0 SH902i(c100;TB;W24H12)"}
13
-
14
- request.mobile?.should be_true
15
- end
16
- end
17
-
18
- describe "DoCoMo SH902i からguid付きのアクセス" do
19
- before(:each) do
20
- @headers = {"HTTP_USER_AGENT" => "DoCoMo/2.0 SH902i(c100;TB;W24H12)", 'HTTP_X_DCMGUID' => "000000a"}
21
- end
22
-
23
- it "guidを正しく取得できること" do
24
- get "/mobile_spec/index", {}, @headers
25
-
26
- request.mobile.guid.should == "000000a"
27
- end
28
- it "ident_subscriberでも正しく取得できること" do
29
- get "/mobile_spec/index", {}, @headers
30
-
31
- request.mobile.ident_subscriber.should == "000000a"
32
- end
33
- end
@@ -1,53 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- require File.dirname(__FILE__) + '/../spec_helper'
4
-
5
- describe "H11T モバイルブラウザからのアクセス" do
6
- before do
7
- @headers = {
8
- "HTTP_USER_AGENT" => "emobile/1.0.0 (H11T; like Gecko; Wireless) NetFront/3.4",
9
- "HTTP_X_EM_UID" => "u00000000000000000",
10
- "REMOTE_ADDR" => "117.55.1.232",
11
- }
12
- end
13
-
14
- it "request.mobile は Emobile のインスタンスであること" do
15
- get "/mobile_spec/index", {}, @headers
16
-
17
- request.mobile.should be_an_instance_of(Jpmobile::Mobile::Emobile)
18
- end
19
- it "request.mobile? は true であること" do
20
- get "/mobile_spec/index", {}, @headers
21
-
22
- request.mobile?.should be_true
23
- end
24
- it "のsubscribe番号を取得できること" do
25
- get "/mobile_spec/index", {}, @headers
26
-
27
- request.mobile.ident_subscriber.should == "u00000000000000000"
28
- end
29
- it "のIPアドレス空間を正しく検証できること" do
30
- get "/mobile_spec/index", {}, @headers
31
-
32
- request.mobile.valid_ip?.should be_true
33
- end
34
- end
35
-
36
- describe "S11HT からのアクセス" do
37
- before do
38
- @headers = {
39
- "HTTP_USER_AGENT" => "Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.7) S11HT",
40
- }
41
- end
42
-
43
- it "request.mobile は Emobile のインスタンスであること" do
44
- get "/mobile_spec/index", {}, @headers
45
-
46
- request.mobile.should be_an_instance_of(Jpmobile::Mobile::Emobile)
47
- end
48
- it "request.mobile? は true であること" do
49
- get "/mobile_spec/index", {}, @headers
50
-
51
- request.mobile?.should be_true
52
- end
53
- end
@@ -1,221 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.dirname(__FILE__) + '/../spec_helper'
3
-
4
- describe "jpmobile integration spec" do
5
- include Jpmobile::Util
6
-
7
- shared_examples_for "hankaku_filter :input => true のとき" do
8
- it "はtextareaの中では半角に変換されないこと" do
9
- get "/#{@controller}/textarea", {}, {"HTTP_USER_AGENT" => @user_agent}
10
- body.should == send(@conversion_method, '<textarea hoge="fuu">アブラカダブラ</textarea>')
11
- end
12
- it "はinputのvalueの中では半角に変換されないこと" do
13
- get "/#{@controller}/input_tag", {}, {"HTTP_USER_AGENT" => @user_agent}
14
- body.should == send(@conversion_method, '<input hoge="fuu" value="アブラカダブラ">')
15
- end
16
- end
17
-
18
- shared_examples_for "hankaku_filter :input => false のとき" do
19
- it "はtextareaの中でも半角に変換されること" do
20
- get "/#{@controller}/textarea", {}, {"HTTP_USER_AGENT" => @user_agent}
21
- body.should == send(@conversion_method, '<textarea hoge="fuu">アブラカダブラ</textarea>')
22
- end
23
- it "はinputのvalueの中も半角に変換されること" do
24
- get "/#{@controller}/input_tag", {}, {"HTTP_USER_AGENT" => @user_agent}
25
- body.should == send(@conversion_method, '<input hoge="fuu" value="アブラカダブラ" />')
26
- end
27
- end
28
-
29
- shared_examples_for "文字コードフィルタが動作しているとき" do
30
- it "はhtml以外は変換しないこと" do
31
- get "/#{@controller}/rawdata", {}, {"HTTP_USER_AGENT" => @user_agent}
32
- body.should == "アブラカダブラ"
33
- headers['Content-Type'].should_not =~ /charset/i
34
- end
35
- it "response.bodyが空のときは文字コードを変更しないこと" do
36
- get "/#{@controller}/empty", {}, {"HTTP_USER_AGENT" => @user_agent}
37
- headers['Content-Type'].should =~ /utf-8/i
38
- end
39
- end
40
-
41
- shared_examples_for "Shift_JISで通信する端末との通信" do
42
- it "はShift_JISで携帯に送出されること" do
43
- get "/#{@controller}/abracadabra_utf8", {}, {"HTTP_USER_AGENT" => @user_agent}
44
- body.should == utf8_to_sjis("アブラカダブラ")
45
- headers['Content-Type'].should =~ /Shift_JIS/i
46
- end
47
- it "はxhtmlでもShift_JISで携帯に送出されること" do
48
- get "/#{@controller}/abracadabra_xhtml_utf8", {}, {"HTTP_USER_AGENT" => @user_agent}
49
-
50
- body.should == utf8_to_sjis("アブラカダブラ")
51
- headers['Content-Type'].should =~ /Shift_JIS/i
52
- end
53
- it "はShift_JISで渡されたパラメタがparamsにUTF-8に変換されて格納されること" do
54
- get "/#{@controller}", {:q => utf8_to_sjis("アブラカダブラ")}, {"HTTP_USER_AGENT" => @user_agent}
55
- assigns(:q).should == utf8("アブラカダブラ")
56
- end
57
- it "は半角カナのparamsを変換しないこと" do
58
- # アブラカダブラ半角,SJIS
59
- get "/#{@controller}", {:q => sjis("\261\314\336\327\266\300\336\314\336\327")}, {"HTTP_USER_AGENT" => @user_agent}
60
- assigns(:q).should == utf8("アブラカダブラ")
61
- end
62
- it_should_behave_like "文字コードフィルタが動作しているとき"
63
- end
64
-
65
- shared_examples_for "UTF-8で通信する端末との通信" do
66
- it "はUTF-8で携帯に送出されること" do
67
- get "/#{@controller}/abracadabra_utf8", {}, {"HTTP_USER_AGENT" => @user_agent}
68
- body.should == "アブラカダブラ"
69
- headers['Content-Type'].should =~ /utf-8/i
70
- end
71
- it "はxhtmlでもUTF-8で携帯に送出されること" do
72
- get "/#{@controller}/abracadabra_xhtml_utf8", {}, {"HTTP_USER_AGENT" => @user_agent}
73
- body.should == "アブラカダブラ"
74
- headers['Content-Type'].should =~ /utf-8/i
75
- end
76
- it "はparamsにUTF-8のまま格納されること" do
77
- get "/#{@controller}/index", {:q => "アブラカダブラ"}, {"HTTP_USER_AGENT" => @user_agent}
78
- assigns(:q).should == utf8("アブラカダブラ")
79
- end
80
- it "は半角カナのparamsを変換しないこと" do
81
- get "/#{@controller}/index", {:q => "アブラカダブラ"}, {"HTTP_USER_AGENT" => @user_agent}
82
- assigns(:q).should == utf8("アブラカダブラ")
83
- end
84
- it_should_behave_like "文字コードフィルタが動作しているとき"
85
- end
86
-
87
- shared_examples_for "Shift_JISで通信する端末との通信(半角変換付き)" do
88
- it "は半角に変換されShift_JISで携帯に送出されること" do
89
- get "/#{@controller}/abracadabra_utf8", {}, {"HTTP_USER_AGENT" => @user_agent}
90
- body.should == sjis("\261\314\336\327\266\300\336\314\336\327") # アブラカダブラ半角,SJIS
91
- headers['Content-Type'].should =~ /Shift_JIS/
92
- end
93
- it "はShift_JISで渡されたパラメタがparamsにUTF-8に変換されて格納されること" do
94
- get "/#{@controller}/index", {:q => utf8_to_sjis("アブラカダブラ")}, {"HTTP_USER_AGENT" => @user_agent}
95
- assigns(:q).should == utf8("アブラカダブラ")
96
- end
97
- it "は半角Shift_JISで渡されたパラメタがparamsに全角UTF-8に変換されて格納されること" do
98
- # アブラカダブラ半角,SJIS
99
- get "/#{@controller}/index", {:q => sjis("\261\314\336\327\266\300\336\314\336\327")}, {"HTTP_USER_AGENT" => @user_agent}
100
- assigns(:q).should == utf8("アブラカダブラ")
101
- end
102
- it_should_behave_like "文字コードフィルタが動作しているとき"
103
- end
104
-
105
- shared_examples_for "UTF-8で通信する端末との通信(半角変換付き)" do
106
- it "はUTF-8半角で携帯に送出されること" do
107
- get "/#{@controller}/abracadabra_utf8", {}, {"HTTP_USER_AGENT" => @user_agent}
108
- body.should == "アブラカダブラ"
109
- headers['Content-Type'].should =~ /utf-8/i
110
- end
111
- it "はparamsにUTF-8のまま格納されること" do
112
- get "/#{@controller}/index", {:q => "アブラカダブラ"}, {"HTTP_USER_AGENT" => @user_agent}
113
- assigns(:q).should == utf8("アブラカダブラ")
114
- end
115
- it "は半角で渡されたparamsを全角に変換して格納すること" do
116
- get "/#{@controller}/index", {:q => "アブラカダブラ"}, {"HTTP_USER_AGENT" => @user_agent}
117
- assigns(:q).should == utf8("アブラカダブラ")
118
- end
119
- it_should_behave_like "文字コードフィルタが動作しているとき"
120
- end
121
-
122
- #
123
- # PCからのアクセス
124
- #
125
- describe FilterController, "PCからのアクセス" do
126
- before(:each) do
127
- @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)"
128
- @controller = "filter"
129
- end
130
- it_should_behave_like "UTF-8で通信する端末との通信"
131
- end
132
-
133
- describe HankakuFilterController, "PCからのアクセス" do
134
- before(:each) do
135
- @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)"
136
- @controller = "hankaku_filter"
137
- end
138
- it_should_behave_like "UTF-8で通信する端末との通信"
139
- end
140
-
141
- #
142
- # 携帯からのアクセス
143
- #
144
- describe FilterController, "DoCoMo SH902i からのアクセス" do
145
- before do
146
- @user_agent = "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
147
- @controller = "filter"
148
- end
149
- it_should_behave_like "Shift_JISで通信する端末との通信"
150
- end
151
-
152
- describe FilterController, "au CA32 からのアクセス" do
153
- before do
154
- @user_agent = "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0"
155
- @controller = "filter"
156
- end
157
- it_should_behave_like "Shift_JISで通信する端末との通信"
158
- end
159
-
160
- describe FilterController, "Vodafone V903T からのアクセス" do
161
- before do
162
- @user_agent = "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"
163
- @controller = "filter"
164
- end
165
- it_should_behave_like "UTF-8で通信する端末との通信"
166
- end
167
-
168
- describe FilterController, "SoftBank 910T からのアクセス" do
169
- before do
170
- @user_agent = "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1"
171
- @controller = "filter"
172
- end
173
- it_should_behave_like "UTF-8で通信する端末との通信"
174
- end
175
-
176
- #
177
- # 半角フィルタ
178
- #
179
- describe HankakuFilterController, "DoCoMo SH902i からのアクセス" do
180
- before do
181
- @user_agent = "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
182
- @controller = "hankaku_filter"
183
- @conversion_method = :utf8_to_sjis
184
- end
185
- it_should_behave_like "Shift_JISで通信する端末との通信(半角変換付き)"
186
- it_should_behave_like "hankaku_filter :input => false のとき"
187
- end
188
-
189
- describe HankakuFilterController, "SoftBank 910T からのアクセス" do
190
- before do
191
- @user_agent = "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1"
192
- @controller = "hankaku_filter"
193
- @conversion_method = :utf8
194
- end
195
- it_should_behave_like "UTF-8で通信する端末との通信(半角変換付き)"
196
- it_should_behave_like "hankaku_filter :input => false のとき"
197
- end
198
-
199
- #
200
- # 半角フィルタ(input付き)
201
- #
202
- describe HankakuInputFilterController, "DoCoMo SH902i からのアクセス" do
203
- before do
204
- @user_agent = "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
205
- @controller = "hankaku_input_filter"
206
- @conversion_method = :utf8_to_sjis
207
- end
208
- it_should_behave_like "Shift_JISで通信する端末との通信(半角変換付き)"
209
- it_should_behave_like "hankaku_filter :input => true のとき"
210
- end
211
-
212
- describe HankakuInputFilterController, "SoftBank 910T からのアクセス" do
213
- before do
214
- @user_agent = "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1"
215
- @controller = "hankaku_input_filter"
216
- @conversion_method = :utf8
217
- end
218
- it_should_behave_like "UTF-8で通信する端末との通信(半角変換付き)"
219
- it_should_behave_like "hankaku_filter :input => true のとき"
220
- end
221
- end