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,207 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- require File.dirname(__FILE__) + '/../spec_helper'
4
-
5
- def get_with_session(controller, action, user_agent)
6
- open_session do |sess|
7
- sess.get "/#{controller}/#{action}", {}, {"HTTP_USER_AGENT" => user_agent}
8
- end
9
- end
10
-
11
- def describe_mobile_with_ua(user_agent, charset, &block)
12
- describe("trans_sid :mobile が指定されているコントローラに #{user_agent} からアクセスしたとき") do
13
- before(:each) do
14
- @controller = "trans_sid_mobile"
15
- @user_agent = user_agent
16
- @charset = charset
17
- end
18
-
19
- instance_eval(&block)
20
- end
21
- end
22
-
23
- describe "trans_sid functional" do
24
- before(:each) do
25
- @user ||= User.create(:name => "hoge")
26
- end
27
-
28
- shared_examples_for "trans_sid が起動しないとき" do
29
- it "で link_to の自動書き換えが行われない" do
30
- res = get_with_session(@controller, "link", @user_agent)
31
-
32
- res.response.body.should =~ /<a href=\"\/.+?\/link\">linkto<\/a>/
33
- end
34
- it "で form の自動書き換えが行われない" do
35
- res = get_with_session(@controller, "form", @user_agent)
36
-
37
- res.response.body.should =~ /<form accept-charset="#{@charset}" action=\"\/.+?\/form\"/
38
- end
39
- it "で redirect の自動書き換えが行われない" do
40
- res = get_with_session(@controller, "redirect", @user_agent)
41
-
42
- res.response.header['Location'] =~ /\/$/
43
- end
44
- end
45
-
46
- shared_examples_for "trans_sid が起動するとき" do
47
- it "で link_to の自動書き換えが行われる" do
48
- res = get_with_session(@controller, "link", @user_agent)
49
-
50
- res.response.body.should =~ /<a href=\"\/.+?\/link\?_session_id=[a-zA-Z0-9]{32}\">linkto<\/a>/
51
- end
52
- it "で form内にhiddenが差し込まれる" do
53
- res = get_with_session(@controller, "form", @user_agent)
54
- res.response.body.should =~ /<input type=\"hidden\" name=\".+\" value=\"[a-zA-Z0-9]{32}\"/
55
- end
56
- it "で form の自動書き換えが行われる" do
57
- res = get_with_session(@controller, "form", @user_agent)
58
-
59
- res.response.body.should =~ /<form accept-charset="#{@charset}" action=\"\/.+?\/form\?_session_id=[a-zA-Z0-9]{32}\"/
60
- end
61
- it "で redirect の自動書き換えが行われる" do
62
- res = get_with_session(@controller, "redirect", @user_agent)
63
-
64
- res.response.header['Location'] =~ /\?_session_id=[a-zA-Z0-9]{32}$/
65
- end
66
-
67
- # resource paths
68
- it "で @user の link_to の自動書き換えが行われる" do
69
- res = get_with_session(@controller, "link_path", @user_agent)
70
-
71
- res.response.body.should =~ /<a href=\"\/users\/1\?_session_id=[a-zA-Z0-9]{32}\">linkto<\/a>/
72
- end
73
- it "で @user の form の自動書き換えが行われる" do
74
- res = get_with_session(@controller, "form_path", @user_agent)
75
-
76
- res.response.body.should =~ /<form accept-charset="#{@charset}" action=\"\/users\/1\?_session_id=[a-zA-Z0-9]{32}\"/
77
- end
78
- it "で @path の redirect の自動書き換えが行われる" do
79
- res = get_with_session(@controller, "redirect_path", @user_agent)
80
-
81
- res.response.header['Location'] =~ /\?_session_id=[a-zA-Z0-9]{32}$/
82
- end
83
-
84
- # resource path with prefix
85
- it "で [:admin, @user] の link_to の自動書き換えが行われる" do
86
- res = get_with_session(@controller, "link_path_admin", @user_agent)
87
-
88
- res.response.body.should =~ /<a href=\"\/admin\/users\/1\?_session_id=[a-zA-Z0-9]{32}\">linkto<\/a>/
89
- end
90
- it "で [:admin, @user] の form の自動書き換えが行われる" do
91
- res = get_with_session(@controller, "form_path_admin", @user_agent)
92
-
93
- res.response.body.should =~ /<form accept-charset="#{@charset}" action=\"\/admin\/users\/1\?_session_id=[a-zA-Z0-9]{32}\"/
94
- end
95
- it "で [:admin, @path] の redirect の自動書き換えが行われる" do
96
- res = get_with_session(@controller, "redirect_path_admin", @user_agent)
97
-
98
- res.response.header['Location'] =~ /\?_session_id=[a-zA-Z0-9]{32}$/
99
- end
100
- end
101
-
102
- describe TransSidBaseController, "という trans_sid が有効になっていないコントローラ" do
103
- before(:each) do
104
- @controller = "trans_sid_base"
105
- @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)"
106
- @charset = "UTF-8"
107
- end
108
-
109
- it "の trans_sid_mode は nil" do
110
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
111
-
112
- controller.trans_sid_mode.should be_nil
113
- end
114
- it_should_behave_like "trans_sid が起動しないとき"
115
- end
116
-
117
- describe TransSidNoneController, "という trans_sid :none が指定されているコントローラ" do
118
- before(:each) do
119
- @controller = "trans_sid_none"
120
- @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)"
121
- @charset = "UTF-8"
122
- end
123
-
124
- it "の trans_sid_mode は :none" do
125
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
126
-
127
- controller.trans_sid_mode.should == :none
128
- end
129
- it_should_behave_like "trans_sid が起動しないとき"
130
- end
131
-
132
- describe TransSidAlwaysController, "という trans_sid :always が指定されているコントローラ" do
133
- before(:each) do
134
- @controller = "trans_sid_always"
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
- @charset = "UTF-8"
137
- end
138
-
139
- it "の trans_sid_mode は :always" do
140
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
141
-
142
- controller.trans_sid_mode.should == :always
143
- end
144
- it_should_behave_like "trans_sid が起動するとき"
145
- end
146
-
147
- describe TransSidMetalController, "という ActionController::Metal のコントローラ" do
148
- before(:each) do
149
- @controller = "trans_sid_metal"
150
- @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)"
151
- @charset = "UTF-8"
152
- end
153
-
154
- it "で redirect_to がエラーにならない" do
155
- res = get_with_session(@controller, "redirect", @user_agent)
156
-
157
- res.response.should be_redirect
158
- end
159
- end
160
-
161
- describe TransSidMobileController, "という trans_sid :mobile が指定されているコントローラ" do
162
- before(:each) do
163
- @controller = "trans_sid_mobile"
164
- @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)"
165
- @charset = "UTF-8"
166
- end
167
-
168
- it "の trans_sid_mode は :mobile" do
169
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
170
-
171
- controller.trans_sid_mode.should == :mobile
172
- end
173
- end
174
-
175
- describe TransSidAlwaysAndSessionOffController, "という trans_sid :always が指定されていて session がロードされていないとき" do
176
- before(:each) do
177
- @controller = "trans_sid_always_and_session_off"
178
- @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)"
179
- @charset = "UTF-8"
180
- end
181
-
182
- it "の trans_sid_mode は :always" do
183
- res = get_with_session(@controller, "link", @user_agent)
184
-
185
- res.controller.trans_sid_mode.should == :always
186
- end
187
- it_should_behave_like "trans_sid が起動しないとき"
188
- end
189
-
190
- # NOTE: 3.0.0RC では accept-charset は UTF-8 で埋め込まれるので保留
191
- describe_mobile_with_ua "DoCoMo/2.0 SH902i(c100;TB;W24H12)", "Shift_JIS" do
192
- it_should_behave_like "trans_sid が起動するとき"
193
- end
194
-
195
- # NOTE: 3.0.0RC では accept-charset は UTF-8 で埋め込まれるので保留
196
- describe_mobile_with_ua "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0", "Shift_JIS" do
197
- it_should_behave_like "trans_sid が起動しないとき"
198
- end
199
-
200
- describe_mobile_with_ua "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1", "UTF-8" do
201
- it_should_behave_like "trans_sid が起動しないとき"
202
- end
203
-
204
- 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", "UTF-8" do
205
- it_should_behave_like "trans_sid が起動しないとき"
206
- end
207
- end
@@ -1,38 +0,0 @@
1
- # This file is copied to ~/spec when you run 'ruby script/generate rspec'
2
- # from the project root directory.
3
- ENV["RAILS_ENV"] ||= 'test'
4
- require File.expand_path("../../config/environment", __FILE__)
5
- require 'rspec/rails'
6
-
7
- # Requires supporting files with custom matchers and macros, etc,
8
- # in ./support/ and its subdirectories.
9
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
10
-
11
- RSpec.configure do |config|
12
- # == Mock Framework
13
- #
14
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
15
- #
16
- # config.mock_with :mocha
17
- # config.mock_with :flexmock
18
- # config.mock_with :rr
19
- config.mock_with :rspec
20
-
21
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
22
-
23
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
24
- # examples within a transaction, comment the following line or assign false
25
- # instead of true.
26
- config.use_transactional_fixtures = true
27
- config.include Webrat::HaveTagMatcher
28
- config.include Jpmobile::Util
29
- config.before(:each) { Webrat.configuration.mode = :rails }
30
-
31
- config.filter_run :focus => true
32
- config.run_all_when_everything_filtered = true
33
- config.color_enabled = true
34
- config.filter_run_excluding :broken => true
35
- # config.full_backtrace = true
36
- end
37
-
38
- require 'pp'
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
- require 'rails/performance_test_help'
3
-
4
- # Profiling results for each test method are written to tmp/performance.
5
- class BrowsingTest < ActionDispatch::PerformanceTest
6
- def test_homepage
7
- get '/'
8
- end
9
- end
@@ -1,13 +0,0 @@
1
- ENV["RAILS_ENV"] = "test"
2
- require File.expand_path('../../config/environment', __FILE__)
3
- require 'rails/test_help'
4
-
5
- class ActiveSupport::TestCase
6
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7
- #
8
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
9
- # -- they do not yet inherit this setting
10
- fixtures :all
11
-
12
- # Add more helper methods to be used by all tests here...
13
- end
@@ -1,18 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) ||
3
- $:.include?(File.expand_path(File.dirname(__FILE__)))
4
-
5
- module Jpmobile
6
- module Mobile
7
- module IpAddresses
8
- autoload :AbstractIpAddresses, 'jpmobile/mobile/ip_addresses/abstract_ip_addresses'
9
- autoload :Docomo, 'jpmobile/mobile/ip_addresses/docomo'
10
- autoload :Au, 'jpmobile/mobile/ip_addresses/au'
11
- autoload :Softbank, 'jpmobile/mobile/ip_addresses/softbank'
12
- autoload :Vodafone, 'jpmobile/mobile/ip_addresses/softbank'
13
- autoload :Willcom, 'jpmobile/mobile/ip_addresses/willcom'
14
- autoload :Ddipocket, 'jpmobile/mobile/ip_addresses/willcom'
15
- autoload :Emobile, 'jpmobile/mobile/ip_addresses/emobile'
16
- end
17
- end
18
- end
@@ -1,23 +0,0 @@
1
- module Jpmobile
2
- module Mobile
3
- module IpAddresses
4
- class AbstractIpAddresses
5
- def valid_ip?(remote_ip_str)
6
- begin
7
- remote_ip = IPAddr.new(remote_ip_str)
8
- rescue
9
- return false
10
- end
11
-
12
- self.class.ip_address_list.any? {|ip| ip.include?(remote_ip)}
13
- end
14
-
15
- class << self
16
- def ip_address_list
17
- []
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,40 +0,0 @@
1
- module Jpmobile
2
- module Mobile
3
- module IpAddresses
4
- class Au < AbstractIpAddresses
5
- class << self
6
- def ip_address_list
7
- @@ip_address_list ||= [
8
- "210.230.128.224/28",
9
- "121.111.227.160/27",
10
- "61.117.1.0/28",
11
- "219.108.158.0/27",
12
- "219.125.146.0/28",
13
- "61.117.2.32/29",
14
- "61.117.2.40/29",
15
- "219.108.158.40/29",
16
- "219.125.148.0/25",
17
- "222.5.63.0/25",
18
- "222.5.63.128/25",
19
- "222.5.62.128/25",
20
- "59.135.38.128/25",
21
- "219.108.157.0/25",
22
- "219.125.145.0/25",
23
- "121.111.231.0/25",
24
- "121.111.227.0/25",
25
- "118.152.214.192/26",
26
- "118.159.131.0/25",
27
- "118.159.133.0/25",
28
- "118.159.132.160/27",
29
- "111.86.142.0/26",
30
- "111.86.141.64/26",
31
- "111.86.141.128/26",
32
- "111.86.141.192/26",
33
- "118.159.133.192/26"
34
- ].map {|ip| IPAddr.new(ip) }
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,22 +0,0 @@
1
- module Jpmobile
2
- module Mobile
3
- module IpAddresses
4
- class Docomo < AbstractIpAddresses
5
- class << self
6
- def ip_address_list
7
- @@ip_address_list ||= [
8
- "210.153.84.0/24",
9
- "210.136.161.0/24",
10
- "210.153.86.0/24",
11
- "124.146.174.0/24",
12
- "124.146.175.0/24",
13
- "202.229.176.0/24",
14
- "202.229.177.0/24",
15
- "202.229.178.0/24"
16
- ].map {|ip| IPAddr.new(ip)}
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,15 +0,0 @@
1
- module Jpmobile
2
- module Mobile
3
- module IpAddresses
4
- class Emobile < AbstractIpAddresses
5
- class << self
6
- def ip_address_list
7
- @@ip_address_list ||= [
8
- "117.55.1.224/27"
9
- ].map {|ip| IPAddr.new(ip) }
10
- end
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,20 +0,0 @@
1
- module Jpmobile
2
- module Mobile
3
- module IpAddresses
4
- class Softbank < AbstractIpAddresses
5
- class << self
6
- def ip_address_list
7
- @@ip_address_list ||= [
8
- "123.108.237.0/27",
9
- "202.253.96.224/27",
10
- "210.146.7.192/26",
11
- "210.175.1.128/25"
12
- ].map {|ip| IPAddr.new(ip) }
13
- end
14
- end
15
- end
16
- class Vodafone < Softbank
17
- end
18
- end
19
- end
20
- end
@@ -1,158 +0,0 @@
1
- module Jpmobile
2
- module Mobile
3
- module IpAddresses
4
- class Willcom < AbstractIpAddresses
5
- class << self
6
- def ip_address_list
7
- @@ip_address_list ||= [
8
- "61.198.128.0/24",
9
- "61.198.129.0/24",
10
- "61.198.130.0/24",
11
- "61.198.131.0/24",
12
- "61.198.132.0/24",
13
- "61.198.133.0/24",
14
- "61.198.134.0/24",
15
- "61.198.135.0/24",
16
- "61.198.136.0/24",
17
- "61.198.137.0/24",
18
- "61.198.138.100/32",
19
- "61.198.138.101/32",
20
- "61.198.138.102/32",
21
- "61.198.138.103/32",
22
- "61.198.139.0/29",
23
- "61.198.139.128/27",
24
- "61.198.139.160/28",
25
- "61.198.140.0/24",
26
- "61.198.141.0/24",
27
- "61.198.142.0/24",
28
- "61.198.143.0/24",
29
- "61.198.160.0/24",
30
- "61.198.161.0/24",
31
- "61.198.162.0/24",
32
- "61.198.163.0/24",
33
- "61.198.164.0/24",
34
- "61.198.165.0/24",
35
- "61.198.166.0/24",
36
- "61.198.168.0/24",
37
- "61.198.169.0/24",
38
- "61.198.170.0/24",
39
- "61.198.171.0/24",
40
- "61.198.172.0/24",
41
- "61.198.173.0/24",
42
- "61.198.174.0/24",
43
- "61.198.175.0/24",
44
- "61.198.248.0/24",
45
- "61.198.249.0/24",
46
- "61.198.250.0/24",
47
- "61.198.251.0/24",
48
- "61.198.252.0/24",
49
- "61.198.253.0/24",
50
- "61.198.254.0/24",
51
- "61.198.255.0/24",
52
- "61.204.0.0/24",
53
- "61.204.2.0/24",
54
- "61.204.3.0/25",
55
- "61.204.3.128/25",
56
- "61.204.4.0/24",
57
- "61.204.5.0/24",
58
- "61.204.6.0/25",
59
- "61.204.6.128/25",
60
- "61.204.7.0/25",
61
- "61.204.92.0/24",
62
- "61.204.93.0/24",
63
- "61.204.94.0/24",
64
- "61.204.95.0/24",
65
- "114.20.49.0/24",
66
- "114.20.50.0/24",
67
- "114.20.51.0/24",
68
- "114.20.52.0/24",
69
- "114.20.53.0/24",
70
- "114.20.54.0/24",
71
- "114.20.55.0/24",
72
- "114.20.56.0/24",
73
- "114.20.57.0/24",
74
- "114.20.58.0/24",
75
- "114.20.59.0/24",
76
- "114.20.60.0/24",
77
- "114.20.61.0/24",
78
- "114.20.62.0/24",
79
- "114.20.63.0/24",
80
- "114.20.64.0/24",
81
- "114.20.65.0/24",
82
- "114.20.66.0/24",
83
- "114.20.67.0/24",
84
- "114.21.255.0/27",
85
- "125.28.0.0/24",
86
- "125.28.1.0/24",
87
- "125.28.15.0/24",
88
- "125.28.16.0/24",
89
- "125.28.17.0/24",
90
- "125.28.2.0/24",
91
- "125.28.3.0/24",
92
- "125.28.4.0/24",
93
- "125.28.5.0/24",
94
- "125.28.8.0/24",
95
- "210.168.246.0/24",
96
- "210.168.247.0/24",
97
- "210.169.92.0/24",
98
- "210.169.93.0/24",
99
- "210.169.94.0/24",
100
- "210.169.95.0/24",
101
- "210.169.96.0/24",
102
- "210.169.97.0/24",
103
- "210.169.98.0/24",
104
- "210.169.99.0/24",
105
- "211.126.192.128/25",
106
- "211.18.232.0/24",
107
- "211.18.233.0/24",
108
- "211.18.234.0/24",
109
- "211.18.235.0/24",
110
- "211.18.236.0/24",
111
- "211.18.237.0/24",
112
- "219.108.10.0/24",
113
- "219.108.11.0/24",
114
- "219.108.12.0/24",
115
- "219.108.13.0/24",
116
- "219.108.14.0/24",
117
- "219.108.15.0/24",
118
- "219.108.7.0/24",
119
- "219.108.8.0/24",
120
- "219.108.9.0/24",
121
- "221.119.0.0/24",
122
- "221.119.1.0/24",
123
- "221.119.2.0/24",
124
- "221.119.3.0/24",
125
- "221.119.4.0/24",
126
- "221.119.6.0/24",
127
- "221.119.7.0/24",
128
- "221.119.8.0/24",
129
- "221.119.9.0/24",
130
- "114.20.49.0/24",
131
- "114.20.50.0/24",
132
- "114.20.51.0/24",
133
- "114.20.52.0/24",
134
- "114.20.53.0/24",
135
- "114.20.54.0/24",
136
- "114.20.55.0/24",
137
- "114.20.56.0/24",
138
- "114.20.57.0/24",
139
- "114.20.58.0/24",
140
- "114.20.59.0/24",
141
- "114.20.60.0/24",
142
- "114.20.61.0/24",
143
- "114.20.62.0/24",
144
- "114.20.63.0/24",
145
- "114.20.64.0/24",
146
- "114.20.65.0/24",
147
- "114.20.66.0/24",
148
- "114.20.67.0/24",
149
- "114.21.255.0/27"
150
- ].map {|ip| IPAddr.new(ip) }
151
- end
152
- end
153
- end
154
- class Ddipocket < Willcom
155
- end
156
- end
157
- end
158
- end