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,2 +0,0 @@
1
- Rails.application.config.jpmobile.mobile_filter
2
- Rails.application.config.jpmobile.form_accept_charset_conversion = true
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- RailsRoot::Application.config.secret_token = '6773d9dbfee1e199c5f7f1cb8c7fff442792f70e3051397a9535b04258bafb009a0a566b0fe0d10a67d64aefaf7396b675ea386893c634411df09272f1f978d4'
@@ -1,2 +0,0 @@
1
- Rails.application.config.session_store :active_record_store, :key => '_session_id'
2
- Rails.application.config.session_options = {:cookie_only => false}
@@ -1,7 +0,0 @@
1
- RailsRoot::Application.routes.draw do
2
- resources :users
3
- namespace :admin do
4
- resources :users
5
- end
6
- match ':controller(/:action(/:id(.:format)))'
7
- end
@@ -1,16 +0,0 @@
1
- class AddSessionsTable < ActiveRecord::Migration
2
- def self.up
3
- create_table :sessions do |t|
4
- t.string :session_id, :null => false
5
- t.text :data
6
- t.timestamps
7
- end
8
-
9
- add_index :sessions, :session_id
10
- add_index :sessions, :updated_at
11
- end
12
-
13
- def self.down
14
- drop_table :sessions
15
- end
16
- end
@@ -1,13 +0,0 @@
1
- class CreateUsers < ActiveRecord::Migration
2
- def self.up
3
- create_table :users do |t|
4
- t.string :name
5
-
6
- t.timestamps
7
- end
8
- end
9
-
10
- def self.down
11
- drop_table :users
12
- end
13
- end
@@ -1,31 +0,0 @@
1
- # This file is auto-generated from the current state of the database. Instead
2
- # of editing this file, please use the migrations feature of Active Record to
3
- # incrementally modify your database, and then regenerate this schema definition.
4
- #
5
- # Note that this schema.rb definition is the authoritative source for your
6
- # database schema. If you need to create the application database on another
7
- # system, you should be using db:schema:load, not running all the migrations
8
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
- # you'll amass, the slower it'll run and the greater likelihood for issues).
10
- #
11
- # It's strongly recommended to check this file into your version control system.
12
-
13
- ActiveRecord::Schema.define(:version => 20100824062306) do
14
-
15
- create_table "sessions", :force => true do |t|
16
- t.string "session_id", :null => false
17
- t.text "data"
18
- t.datetime "created_at"
19
- t.datetime "updated_at"
20
- end
21
-
22
- add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
23
- add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
24
-
25
- create_table "users", :force => true do |t|
26
- t.string "name"
27
- t.datetime "created_at"
28
- t.datetime "updated_at"
29
- end
30
-
31
- end
@@ -1,7 +0,0 @@
1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
- #
4
- # Examples:
5
- #
6
- # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7
- # Mayor.create(:name => 'Daley', :city => cities.first)
@@ -1,15 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- require File.dirname(__FILE__) + '/../spec_helper'
4
-
5
- describe Jpmobile::Helpers do
6
- include Jpmobile::Helpers
7
- it "docomo_guid_link_to が guid=ON を付けたリンクを生成すること" do
8
- docomo_guid_link_to("STRING", :controller => "filter", :action => "rawdata").should == %{<a href="/filter/rawdata?guid=ON">STRING</a>}
9
- end
10
-
11
- it "softbank_location_link_to がリンク先にパラメータを含んでいても正常に動作すること" do
12
- # http://d.hatena.ne.jp/mizincogrammer/20090123/1232702067
13
- softbank_location_link_to("STRING", :controller => "filter", :action => "rawdata", :p => "param").should == %{<a href="location:auto?url=http://test.host/filter/rawdata&amp;p=param">STRING</a>}
14
- end
15
- end
@@ -1,737 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.dirname(__FILE__) + '/../spec_helper'
3
-
4
- describe MobileMailer 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
- @sjis_regexp = %r!=\?shift_jis\?B\?(.+)\?=!
14
- @jis_regexp = %r!=\?iso-2022-jp\?B\?(.+)\?=!
15
- end
16
-
17
- shared_examples_for "PC宛メール" do
18
- it "正常に送信できること" do
19
- email = MobileMailer.view_selection(@to, "題名", "本文").deliver
20
-
21
- ActionMailer::Base.deliveries.size.should == 1
22
- email.to.include?(@to).should be_true
23
- end
24
-
25
- it "ISO-2022-JPに変換されること" do
26
- email = MobileMailer.view_selection(@to, "題名", "本文").deliver
27
-
28
- ActionMailer::Base.deliveries.size.should == 1
29
-
30
- raw_mail = ascii_8bit(email.to_s)
31
- raw_mail.should match(/iso-2022-jp/i)
32
- raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit([utf8_to_jis("題名")].pack('m').strip))))
33
- raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit(utf8_to_jis("本文")))))
34
- end
35
-
36
- it "絵文字がゲタ(〓)に変換されること" do
37
- email = MobileMailer.view_selection(@to, "題名&#xe676;", "本文&#xe68b;".html_safe).deliver
38
-
39
- ActionMailer::Base.deliveries.size.should == 1
40
-
41
- raw_mail = ascii_8bit(email.to_s)
42
- raw_mail.should match(Regexp.escape("GyRCQmpMPiIuGyhC"))
43
- raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit(utf8_to_jis("本文〓")))))
44
- end
45
-
46
- it "quoted-printableではないときに勝手に変換されないこと" do
47
- email = MobileMailer.view_selection(@to, "題名",
48
- "本文です\nhttp://test.rails/foo/bar/index?d=430d0d1cea109cdb384ec5554b890e3940f293c7&e=ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L").deliver
49
-
50
- ActionMailer::Base.deliveries.size.should == 1
51
-
52
- raw_mail = ascii_8bit(email.to_s)
53
- raw_mail.should match(/ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L/)
54
- end
55
- end
56
-
57
- describe "PC宛に送るとき" do
58
- before(:each) do
59
- @to = "bill.gate@microsoft.com"
60
- end
61
-
62
- it_behaves_like "PC宛メール"
63
-
64
- it "複数に配信するときもISO-2022-JPに変換されること" do
65
- email = MobileMailer.view_selection(@to, "題名", "本文").deliver
66
-
67
- ActionMailer::Base.deliveries.size.should == 1
68
-
69
- raw_mail = ascii_8bit(email.to_s)
70
- raw_mail.should match(/iso-2022-jp/i)
71
- raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit([utf8_to_jis("題名")].pack('m').strip))))
72
- raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit(utf8_to_jis("本文")))))
73
- end
74
- end
75
-
76
- describe "docomo にメールを送るとき" do
77
- before(:each) do
78
- @to = "docomo@docomo.ne.jp"
79
- end
80
-
81
- it "subject/body が Shift-JIS になること" do
82
- email = MobileMailer.view_selection(@to, @subject, @text).deliver
83
-
84
- ActionMailer::Base.deliveries.size.should == 1
85
-
86
- raw_mail = email.to_s
87
- raw_mail.should match(/shift_jis/i)
88
- # raw_mail.should match(/For docomo/)
89
- raw_mail.should match(Regexp.escape("k/qWe4zqkeiWvA=="))
90
- raw_mail.should match(Regexp.compile(utf8_to_sjis(@text)))
91
- end
92
-
93
- it "数値参照の絵文字が変換されること" do
94
- emoji_subject = @subject + "&#xe676;"
95
- emoji_text = @text + "&#xe68b;"
96
-
97
- email = MobileMailer.view_selection(@to, emoji_subject, emoji_text.html_safe).deliver
98
-
99
- ActionMailer::Base.deliveries.size.should == 1
100
-
101
- raw_mail = email.to_s
102
- raw_mail.should match(/For docomo/)
103
- raw_mail.should match(Regexp.escape("k/qWe4zqkeiWvPjX"))
104
- raw_mail.should match(regexp_to_sjis("\xf8\xec"))
105
- end
106
-
107
- it "半角カナがそのまま送信されること" do
108
- half_kana_subject = @subject + "ゲーム"
109
- half_kana_text = @text + "ブック"
110
-
111
- email = MobileMailer.view_selection(@to, half_kana_subject, half_kana_text).deliver
112
-
113
- ActionMailer::Base.deliveries.size.should == 1
114
-
115
- raw_mail = email.to_s
116
- raw_mail.should match(/For docomo/)
117
- raw_mail.should match(Regexp.escape("k/qWe4zqkeiWvLnesNE="))
118
- raw_mail.should match(Regexp.compile(Regexp.escape(utf8_to_sjis(half_kana_text))))
119
- end
120
-
121
- it "quoted-printable ではないときに勝手に変換されないこと" do
122
- email = MobileMailer.view_selection(@to, "題名",
123
- "本文です\nhttp://test.rails/foo/bar/index?d=430d0d1cea109cdb384ec5554b890e3940f293c7&e=ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L").deliver
124
-
125
- ActionMailer::Base.deliveries.size.should == 1
126
-
127
- raw_mail = email.to_s
128
- raw_mail.should match(/ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L/)
129
- end
130
- end
131
-
132
- describe "au にメールを送るとき" do
133
- before(:each) do
134
- @to = "au@ezweb.ne.jp"
135
- end
136
-
137
- it "subject/body がISO-2022-JPになること" do
138
- email = MobileMailer.view_selection(@to, @subject, @text).deliver
139
-
140
- ActionMailer::Base.deliveries.size.should == 1
141
-
142
- raw_mail = ascii_8bit(email.to_s)
143
- raw_mail.should match(/iso-2022-jp/i)
144
- raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit([utf8_to_jis(@subject)].pack('m').strip))))
145
- raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit(utf8_to_jis(@text)))))
146
- end
147
-
148
- it "数値参照が絵文字に変換されること" do
149
- emoji_subject = @subject + "&#xe676;"
150
- emoji_text = @text + "&#xe68b;"
151
-
152
- email = MobileMailer.view_selection(@to, emoji_subject, emoji_text.html_safe).deliver
153
-
154
- ActionMailer::Base.deliveries.size.should == 1
155
-
156
- raw_mail = ascii_8bit(email.to_s)
157
- raw_mail.should match(/For au/)
158
- raw_mail.should match(Regexp.escape("GyRCRnxLXDhsQmpMPhsoQhskQnZeGyhC"))
159
- raw_mail.should match(Regexp.compile(ascii_8bit("\x76\x21")))
160
- end
161
-
162
- it "quoted-printable ではないときに勝手に変換されないこと" do
163
- email = MobileMailer.view_selection(@to, "題名",
164
- "本文です\nhttp://test.rails/foo/bar/index?d=430d0d1cea109cdb384ec5554b890e3940f293c7&e=ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L").deliver
165
-
166
- ActionMailer::Base.deliveries.size.should == 1
167
-
168
- raw_mail = ascii_8bit(email.to_s)
169
- raw_mail.should match(/ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L/)
170
- end
171
- end
172
-
173
- describe "softbank にメールを送るとき" do
174
- before(:each) do
175
- @to = "softbank@softbank.ne.jp"
176
- end
177
-
178
- it "subject/body が Shift_JIS になること" do
179
- email = MobileMailer.view_selection(@to, @subject, @text).deliver
180
-
181
- ActionMailer::Base.deliveries.size.should == 1
182
-
183
- raw_mail = email.to_s
184
- raw_mail.should match(/shift_jis/i)
185
- raw_mail.should match(/For softbank/)
186
- raw_mail.should match(Regexp.escape("k/qWe4zqkeiWvA=="))
187
- raw_mail.should match(Regexp.compile(utf8_to_sjis(@text)))
188
- end
189
-
190
- it "数値参照が絵文字に変換されること" do
191
- emoji_subject = @subject + "&#xe676;"
192
- emoji_text = @text + "&#xe68a;"
193
-
194
- email = MobileMailer.view_selection(@to, emoji_subject, emoji_text.html_safe).deliver
195
-
196
- ActionMailer::Base.deliveries.size.should == 1
197
-
198
- raw_mail = email.to_s
199
- raw_mail.should match(/For softbank/)
200
- raw_mail.should match(Regexp.escape("k/qWe4zqkeiWvPl8"))
201
- raw_mail.should match(regexp_to_sjis("\xf7\x6a"))
202
- end
203
-
204
- it "quoted-printable ではないときに勝手に変換されないこと" do
205
- email = MobileMailer.view_selection(@to, "題名",
206
- "本文です\nhttp://test.rails/foo/bar/index?d=430d0d1cea109cdb384ec5554b890e3940f293c7&e=ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L").deliver
207
-
208
- ActionMailer::Base.deliveries.size.should == 1
209
-
210
- raw_mail = email.to_s
211
- raw_mail.should match(/ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L/)
212
- end
213
- end
214
-
215
- describe "vodafone にメールを送るとき" do
216
- before(:each) do
217
- @to = "vodafone@d.vodafone.ne.jp"
218
- end
219
-
220
- it "subject/body が Shift_JIS になること" do
221
- email = MobileMailer.view_selection(@to, @subject, @text).deliver
222
-
223
- ActionMailer::Base.deliveries.size.should == 1
224
-
225
- raw_mail = email.to_s
226
- raw_mail.should match(/shift_jis/i)
227
- raw_mail.should match(/For vodafone/)
228
- raw_mail.should match(Regexp.escape("k/qWe4zqkeiWvA=="))
229
- raw_mail.should match(Regexp.compile(utf8_to_sjis(@text)))
230
- end
231
-
232
- it "数値参照が絵文字に変換されること" do
233
- emoji_subject = @subject + "&#xe676;"
234
- emoji_text = @text + "&#xe68a;"
235
-
236
- email = MobileMailer.view_selection(@to, emoji_subject, emoji_text.html_safe).deliver
237
-
238
- ActionMailer::Base.deliveries.size.should == 1
239
-
240
- raw_mail = email.to_s
241
- raw_mail.should match(/For vodafone/)
242
- raw_mail.should match(Regexp.escape("k/qWe4zqkeiWvPl8"))
243
- raw_mail.should match(regexp_to_sjis("\xf7\x6a"))
244
- end
245
-
246
- it "quoted-printable ではないときに勝手に変換されないこと" do
247
- email = MobileMailer.view_selection(@to, "題名",
248
- "本文です\nhttp://test.rails/foo/bar/index?d=430d0d1cea109cdb384ec5554b890e3940f293c7&e=ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L").deliver
249
-
250
- ActionMailer::Base.deliveries.size.should == 1
251
-
252
- raw_mail = email.to_s
253
- raw_mail.should match(/ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L/)
254
- end
255
- end
256
-
257
- describe "willcom にメールを送るとき" do
258
- before(:each) do
259
- @to = "willcom@wm.pdx.ne.jp"
260
- end
261
-
262
- it_behaves_like "PC宛メール"
263
- end
264
-
265
- describe "emobile にメールを送るとき" do
266
- before(:each) do
267
- @to = "emobile@emnet.ne.jp"
268
- end
269
-
270
- it_behaves_like "PC宛メール"
271
- end
272
-
273
- describe "multipart メールを送信するとき" do
274
- before(:each) do
275
- ActionMailer::Base.deliveries = []
276
-
277
- @subject = "題名"
278
- @text = "本文"
279
- @html = "万葉"
280
- end
281
-
282
- describe "PC の場合" do
283
- before(:each) do
284
- @to = "gate@bill.com"
285
- end
286
-
287
- it "漢字コードが変換されること" do
288
- email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
289
-
290
- ActionMailer::Base.deliveries.size.should == 1
291
-
292
- email.parts.size.should == 2
293
-
294
- raw_mail = ascii_8bit(email.to_s)
295
- raw_mail.should match(Regexp.escape(ascii_8bit(utf8_to_jis(@text))))
296
- raw_mail.should match(Regexp.escape(ascii_8bit(utf8_to_jis(@html))))
297
- end
298
- end
299
-
300
- describe "docomo の場合" do
301
- before(:each) do
302
- @to = "docomo@docomo.ne.jp"
303
- end
304
-
305
- it "漢字コードが変換されること" do
306
- email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
307
-
308
- ActionMailer::Base.deliveries.size.should == 1
309
-
310
- email.parts.size.should == 2
311
-
312
- raw_mail = email.to_s
313
- raw_mail.should match(sjis_regexp(utf8_to_sjis(@text)))
314
- raw_mail.should match(sjis_regexp(utf8_to_sjis(@html)))
315
- end
316
-
317
- it "絵文字が変換されること" do
318
- @text += "&#xe68b;"
319
- @html += "&#xe676;"
320
- email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
321
-
322
- ActionMailer::Base.deliveries.size.should == 1
323
-
324
- email.parts.size.should == 2
325
-
326
- raw_mail = email.to_s
327
- raw_mail.should match(sjis_regexp(sjis("\xf8\xec")))
328
- raw_mail.should match(sjis_regexp(sjis("\xf8\xd7")))
329
- end
330
- end
331
-
332
- describe "au の場合" do
333
- before(:each) do
334
- @to = "au@ezweb.ne.jp"
335
- end
336
-
337
- it "漢字コードが変換されること" do
338
- email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
339
-
340
- ActionMailer::Base.deliveries.size.should == 1
341
-
342
- email.parts.size.should == 2
343
-
344
- raw_mail = ascii_8bit(email.to_s)
345
- raw_mail.should match(Regexp.escape(ascii_8bit(utf8_to_jis(@text))))
346
- raw_mail.should match(Regexp.escape(ascii_8bit(utf8_to_jis(@html))))
347
- end
348
-
349
- it "絵文字が変換されること" do
350
- @text += "&#xe68b;"
351
- @html += "&#xe676;"
352
- email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
353
-
354
- ActionMailer::Base.deliveries.size.should == 1
355
-
356
- email.parts.size.should == 2
357
-
358
- raw_mail = ascii_8bit(email.to_s)
359
- raw_mail.should match(jis_regexp("\x76\x21"))
360
- raw_mail.should match(jis_regexp("\x76\x5e"))
361
- end
362
- end
363
-
364
- describe "softbank の場合" do
365
- before(:each) do
366
- @to = "softbank@softbank.ne.jp"
367
- end
368
-
369
- it "漢字コードが変換されること" do
370
- email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
371
-
372
- ActionMailer::Base.deliveries.size.should == 1
373
-
374
- email.parts.size.should == 2
375
-
376
- raw_mail = email.to_s
377
- raw_mail.should match(sjis_regexp(utf8_to_sjis(@text)))
378
- raw_mail.should match(sjis_regexp(utf8_to_sjis(@html)))
379
- end
380
-
381
- it "絵文字が変換されること" do
382
- @text += "&#xe68a;"
383
- @html += "&#xe676;"
384
- email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
385
-
386
- ActionMailer::Base.deliveries.size.should == 1
387
-
388
- email.parts.size.should == 2
389
-
390
- raw_mail = email.to_s
391
- raw_mail.should match(sjis_regexp(sjis("\xf7\x6a")))
392
- raw_mail.should match(sjis_regexp(sjis("\xf9\x7c")))
393
- end
394
- end
395
-
396
- describe "vodafone の場合" do
397
- before(:each) do
398
- @to = "vodafone@d.vodafone.ne.jp"
399
- end
400
-
401
- it "漢字コードが変換されること" do
402
- email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
403
-
404
- ActionMailer::Base.deliveries.size.should == 1
405
-
406
- email.parts.size.should == 2
407
-
408
- raw_mail = email.to_s
409
- raw_mail.should match(sjis_regexp(utf8_to_sjis(@text)))
410
- raw_mail.should match(sjis_regexp(utf8_to_sjis(@html)))
411
- end
412
-
413
- it "絵文字が変換されること" do
414
- @text += "&#xe68a;"
415
- @html += "&#xe676;"
416
- email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
417
-
418
- ActionMailer::Base.deliveries.size.should == 1
419
-
420
- email.parts.size.should == 2
421
-
422
- raw_mail = email.to_s
423
- raw_mail.should match(sjis_regexp(sjis("\xf7\x6a")))
424
- raw_mail.should match(sjis_regexp(sjis("\xf9\x7c")))
425
- end
426
- end
427
- end
428
- end
429
-
430
- describe MobileMailer, " mail address" do
431
- before(:each) do
432
- ActionMailer::Base.deliveries = []
433
-
434
- @subject = "日本語題名"
435
- @text = "日本語テキスト"
436
- end
437
-
438
- it "ピリオドが3つ以上連続するアドレスが有効になること" do
439
- to = "ruby...rails@domomo-ezweb.ne.jp"
440
- MobileMailer.view_selection(to, @subject, @text).deliver
441
-
442
- emails = ActionMailer::Base.deliveries
443
- emails.size.should == 1
444
- emails.first.to.include?(to).should be_true
445
- emails.first.destinations.include?(to).should be_true
446
- end
447
-
448
- it "@マークの直前にピリオドあるアドレスが有効になること" do
449
- to = "ruby.rails.@domomo-ezweb.ne.jp"
450
- MobileMailer.view_selection(to, @subject, @text).deliver
451
-
452
- emails = ActionMailer::Base.deliveries
453
- emails.size.should == 1
454
- emails.first.to.include?(to).should be_true
455
- emails.first.destinations.include?(to).should be_true
456
- end
457
-
458
- it "ピリオドから始まるアドレスが有効になること" do
459
- to = ".ruby.rails.@domomo-ezweb.ne.jp"
460
- MobileMailer.view_selection(to, @subject, @text).deliver
461
-
462
- emails = ActionMailer::Base.deliveries
463
- emails.size.should == 1
464
- emails.first.to.include?(to).should be_true
465
- emails.first.destinations.include?(to).should be_true
466
- end
467
-
468
- it "複数のアドレスが有効になること" do
469
- to = [".ruby.rails.@domomo-ezweb.ne.jp", "ruby.rails.@domomo-ezweb.ne.jp", "ruby...rails@domomo-ezweb.ne.jp"].join(", ")
470
- MobileMailer.view_selection(to, @subject, @text).deliver
471
-
472
- emails = ActionMailer::Base.deliveries
473
- emails.size.should == 1
474
- emails.first.to.should == to
475
- emails.first.destinations.should == [to]
476
- end
477
- end
478
-
479
- describe MobileMailer, "receiving" do
480
- describe "blank mail" do
481
- it "softbank からの空メールがで受信できること" do
482
- email = open(Rails.root + "spec/fixtures/mobile_mailer/softbank-blank.eml").read
483
- # expect {
484
- email = MobileMailer.receive(email)
485
- # }.to_not raise_error
486
-
487
- email.subject.should be_blank
488
- email.body.should be_blank
489
- end
490
- end
491
-
492
- describe "docomo からのメールを受信するとき" do
493
- before(:each) do
494
- @email = open(Rails.root + "spec/fixtures/mobile_mailer/docomo-emoji.eml").read
495
- end
496
-
497
- it "漢字コードを適切に変換できること" do
498
- email = MobileMailer.receive(@email)
499
- email.subject.should match(/題名/)
500
- email.body.should match(/本文/)
501
- end
502
-
503
- it "絵文字が数値参照に変わること" do
504
- email = MobileMailer.receive(@email)
505
-
506
- email.subject.should match(/&#xe676;/)
507
- email.body.should match(/&#xe6e2;/)
508
- end
509
-
510
- describe "jis コードの場合に" do
511
- before(:each) do
512
- @email = open(Rails.root + "spec/fixtures/mobile_mailer/docomo-jis.eml").read
513
- end
514
-
515
- it "適切に変換できること" do
516
- email = MobileMailer.receive(@email)
517
-
518
- email.subject.should match(/テスト/)
519
- email.body.should match(/テスト本文/)
520
- end
521
- end
522
- end
523
-
524
- describe "au からのメールを受信するとき" do
525
- describe "jpmobile で送信したメールの場合" do
526
- before(:each) do
527
- @email = open(Rails.root + "spec/fixtures/mobile_mailer/au-emoji.eml").read
528
- end
529
-
530
- it "漢字コードを適切に変換できること" do
531
- email = MobileMailer.receive(@email)
532
-
533
- email.subject.should match(/題名/)
534
- email.body.should match(/本文/)
535
- end
536
-
537
- it "絵文字が数値参照に変わること" do
538
- email = MobileMailer.receive(@email)
539
-
540
- email.subject.should match(/&#xe503;/)
541
- email.body.should match(/&#xe522;/)
542
- end
543
- end
544
-
545
- describe "実機からのメールの場合" do
546
- before(:each) do
547
- @email = open(Rails.root + "spec/fixtures/mobile_mailer/au-emoji2.eml").read
548
- end
549
-
550
- it "漢字コードを適切に変換できること" do
551
- email = MobileMailer.receive(@email)
552
-
553
- email.subject.should match(/題名/)
554
- email.body.should match(/本文/)
555
- end
556
-
557
- it "絵文字が数値参照に変わること" do
558
- email = MobileMailer.receive(@email)
559
-
560
- email.subject.should match(/&#xe4f4;/)
561
- email.body.should match(/&#xe471;/)
562
- end
563
- end
564
- end
565
-
566
- describe "softbank からのメールを受信するとき" do
567
- describe "shift_jis のとき" do
568
- before(:each) do
569
- @email = open(Rails.root + "spec/fixtures/mobile_mailer/softbank-emoji.eml").read
570
- end
571
-
572
- it "漢字コードを適切に変換できること" do
573
- email = MobileMailer.receive(@email)
574
-
575
- email.subject.should match(/題名/)
576
- email.body.should match(/本文/)
577
- end
578
-
579
- it "絵文字が数値参照に変わること" do
580
- email = MobileMailer.receive(@email)
581
-
582
- email.subject.should match(/&#xf03c;/)
583
- email.body.should match(/&#xf21c;/)
584
- end
585
- end
586
-
587
- describe "utf-8 のとき" do
588
- before(:each) do
589
- @email = open(Rails.root + "spec/fixtures/mobile_mailer/softbank-emoji-utf8.eml").read
590
- end
591
-
592
- it "漢字コードを適切に変換できること" do
593
- email = MobileMailer.receive(@email)
594
-
595
- email.subject.should match(/題名/)
596
- email.body.should match(/本文/)
597
- end
598
-
599
- it "絵文字が数値参照に変わること" do
600
- email = MobileMailer.receive(@email)
601
-
602
- email.subject.should match(/&#xf03c;/)
603
- email.body.should match(/&#xf21c;/)
604
- end
605
- end
606
- end
607
-
608
- describe "multipart メールを受信するとき" do
609
- describe "docomo の場合" do
610
- # NOTE: キャリアメールサーバで絵文字を変換するため検証は困難
611
- before(:each) do
612
- @email = open(Rails.root + "spec/fixtures/mobile_mailer/docomo-gmail-sjis.eml").read
613
- end
614
-
615
- it "正常に受信できること" do
616
- lambda {
617
- MobileMailer.receive(@email)
618
- }.should_not raise_exception
619
- end
620
-
621
- it "絵文字が変換されること" do
622
- email = MobileMailer.receive(@email)
623
-
624
- email.subject.should match(/&#xe6ec;/)
625
-
626
- email.parts.size.should == 1
627
- email.parts.first.parts.size == 2
628
-
629
- parts = email.parts.first.parts
630
- parts.first.body.should match("テストです&#xe72d;")
631
- parts.last.body.raw_source.should match("テストです&#xe72d;")
632
- end
633
- end
634
-
635
- describe "au の場合" do
636
- before(:each) do
637
- @email = open(Rails.root + "spec/fixtures/mobile_mailer/au-decomail.eml").read
638
- end
639
-
640
- it "正常に受信できること" do
641
- lambda {
642
- MobileMailer.receive(@email)
643
- }.should_not raise_exception
644
- end
645
-
646
- it "絵文字が変換されること" do
647
- email = MobileMailer.receive(@email)
648
-
649
- email.subject.should match(/&#xe4f4;/)
650
-
651
- email.parts.size.should == 1
652
- email.parts.first.parts.size == 2
653
-
654
- parts = email.parts.first.parts
655
- parts.first.body.should match(/テストです&#xe595;/)
656
- parts.last.body.raw_source.should match(/テストです&#xe595;/)
657
- end
658
- end
659
-
660
- describe "softbank(sjis) の場合" do
661
- # NOTE: キャリアメールサーバで絵文字を変換するため検証は困難
662
- before(:each) do
663
- @email = open(Rails.root + "spec/fixtures/mobile_mailer/softbank-gmail-sjis.eml").read
664
- end
665
-
666
- it "正常に受信できること" do
667
- lambda {
668
- MobileMailer.receive(@email)
669
- }.should_not raise_exception
670
- end
671
-
672
- it "絵文字が変換されること" do
673
- email = MobileMailer.receive(@email)
674
-
675
- email.subject.should match(/&#xf221;&#xf223;&#xf221;/)
676
-
677
- email.parts.size.should == 2
678
-
679
- email.parts.first.body.should match(/テストです&#xf018;/)
680
- email.parts.last.body.raw_source.should match(/テストです&#xf231;/)
681
- end
682
- end
683
-
684
- describe "softbank(utf8) の場合" do
685
- # NOTE: キャリアメールサーバで絵文字を変換するため検証は困難
686
- before(:each) do
687
- @email = open(Rails.root + "spec/fixtures/mobile_mailer/softbank-gmail-utf8.eml").read
688
- end
689
-
690
- it "正常に受信できること" do
691
- lambda {
692
- MobileMailer.receive(@email)
693
- }.should_not raise_exception
694
- end
695
-
696
- it "絵文字が変換されること" do
697
- email = MobileMailer.receive(@email)
698
-
699
- email.subject.should match(/テストです&#xf221;/)
700
-
701
- email.parts.size.should == 2
702
-
703
- email.parts.first.body.should match(/テストです&#xf223;/)
704
- email.parts.last.body.raw_source.should match(/テストです&#xf223;/)
705
- end
706
- end
707
-
708
- describe "添付ファイルがある場合" do
709
- # NOTE: au のみテスト
710
- before(:each) do
711
- @email = open(Rails.root + "spec/fixtures/mobile_mailer/au-attached.eml").read
712
- end
713
-
714
- it "正常に受信できること" do
715
- lambda {
716
- MobileMailer.receive(@email)
717
- }.should_not raise_exception
718
- end
719
-
720
- it "添付ファイルが壊れないこと" do
721
- email = MobileMailer.receive(@email)
722
-
723
- email.subject.should match(/&#xe481;/)
724
-
725
- email.parts.size.should == 2
726
-
727
- email.parts.first.body.should match(/カレンダーだ&#xe4f4;/)
728
-
729
- email.has_attachments?.should be_true
730
- email.attachments.size.should == 1
731
- email.attachments['20098calendar01.jpg'].content_type.should match("image/jpeg")
732
- email.attachments['20098calendar01.jpg'].body.to_s[2..6] == "JFIF"
733
- email.attachments['20098calendar01.jpg'].body.to_s.size == 86412
734
- end
735
- end
736
- end
737
- end