activejob-lock 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2864) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/Gemfile +21 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +48 -0
  6. data/Rakefile +77 -0
  7. data/activejob-lock.gemspec +30 -0
  8. data/lib/activejob/lock/queue_adapters/resque_adapter.rb +44 -0
  9. data/lib/activejob/lock/queue_adapters.rb +1 -0
  10. data/lib/activejob/lock/version.rb +5 -0
  11. data/lib/activejob/lock.rb +38 -0
  12. data/rails/.gitignore +21 -0
  13. data/rails/.travis.yml +62 -0
  14. data/rails/.yardopts +4 -0
  15. data/rails/CONTRIBUTING.md +17 -0
  16. data/rails/Gemfile +126 -0
  17. data/rails/Gemfile.lock +273 -0
  18. data/rails/RAILS_VERSION +1 -0
  19. data/rails/README.md +85 -0
  20. data/rails/RELEASING_RAILS.rdoc +217 -0
  21. data/rails/Rakefile +67 -0
  22. data/rails/actionmailer/CHANGELOG.md +63 -0
  23. data/rails/actionmailer/MIT-LICENSE +21 -0
  24. data/rails/actionmailer/README.rdoc +176 -0
  25. data/rails/actionmailer/Rakefile +35 -0
  26. data/rails/actionmailer/actionmailer.gemspec +28 -0
  27. data/rails/actionmailer/lib/action_mailer/base.rb +947 -0
  28. data/rails/actionmailer/lib/action_mailer/collector.rb +30 -0
  29. data/rails/actionmailer/lib/action_mailer/delivery_job.rb +13 -0
  30. data/rails/actionmailer/lib/action_mailer/delivery_methods.rb +84 -0
  31. data/rails/actionmailer/lib/action_mailer/gem_version.rb +15 -0
  32. data/rails/actionmailer/lib/action_mailer/log_subscriber.rb +39 -0
  33. data/rails/actionmailer/lib/action_mailer/mail_helper.rb +58 -0
  34. data/rails/actionmailer/lib/action_mailer/message_delivery.rb +115 -0
  35. data/rails/actionmailer/lib/action_mailer/preview.rb +118 -0
  36. data/rails/actionmailer/lib/action_mailer/railtie.rb +64 -0
  37. data/rails/actionmailer/lib/action_mailer/test_case.rb +104 -0
  38. data/rails/actionmailer/lib/action_mailer/test_helper.rb +62 -0
  39. data/rails/actionmailer/lib/action_mailer/version.rb +9 -0
  40. data/rails/actionmailer/lib/action_mailer.rb +50 -0
  41. data/rails/actionmailer/lib/rails/generators/mailer/USAGE +17 -0
  42. data/rails/actionmailer/lib/rails/generators/mailer/mailer_generator.rb +19 -0
  43. data/rails/actionmailer/lib/rails/generators/mailer/templates/application_mailer.rb +4 -0
  44. data/rails/actionmailer/lib/rails/generators/mailer/templates/mailer.rb +17 -0
  45. data/rails/actionmailer/test/abstract_unit.rb +49 -0
  46. data/rails/actionmailer/test/assert_select_email_test.rb +47 -0
  47. data/rails/actionmailer/test/asset_host_test.rb +37 -0
  48. data/rails/actionmailer/test/base_test.rb +885 -0
  49. data/rails/actionmailer/test/delivery_methods_test.rb +237 -0
  50. data/rails/actionmailer/test/fixtures/anonymous/welcome.erb +1 -0
  51. data/rails/actionmailer/test/fixtures/another.path/base_mailer/welcome.erb +1 -0
  52. data/rails/actionmailer/test/fixtures/asset_host_mailer/email_with_asset.html.erb +1 -0
  53. data/rails/actionmailer/test/fixtures/asset_mailer/welcome.html.erb +1 -0
  54. data/rails/actionmailer/test/fixtures/async_mailer/welcome.erb +1 -0
  55. data/rails/actionmailer/test/fixtures/attachments/foo.jpg +0 -0
  56. data/rails/actionmailer/test/fixtures/attachments/test.jpg +0 -0
  57. data/rails/actionmailer/test/fixtures/auto_layout_mailer/hello.html.erb +1 -0
  58. data/rails/actionmailer/test/fixtures/auto_layout_mailer/multipart.html.erb +1 -0
  59. data/rails/actionmailer/test/fixtures/auto_layout_mailer/multipart.text.erb +1 -0
  60. data/rails/actionmailer/test/fixtures/base_mailer/attachment_with_content.erb +1 -0
  61. data/rails/actionmailer/test/fixtures/base_mailer/attachment_with_hash.html.erb +0 -0
  62. data/rails/actionmailer/test/fixtures/base_mailer/attachment_with_hash_default_encoding.html.erb +0 -0
  63. data/rails/actionmailer/test/fixtures/base_mailer/different_layout.html.erb +1 -0
  64. data/rails/actionmailer/test/fixtures/base_mailer/different_layout.text.erb +1 -0
  65. data/rails/actionmailer/test/fixtures/base_mailer/email_custom_layout.text.html.erb +1 -0
  66. data/rails/actionmailer/test/fixtures/base_mailer/email_with_translations.html.erb +1 -0
  67. data/rails/actionmailer/test/fixtures/base_mailer/explicit_multipart_templates.html.erb +1 -0
  68. data/rails/actionmailer/test/fixtures/base_mailer/explicit_multipart_templates.text.erb +1 -0
  69. data/rails/actionmailer/test/fixtures/base_mailer/explicit_multipart_with_one_template.erb +1 -0
  70. data/rails/actionmailer/test/fixtures/base_mailer/html_only.html.erb +1 -0
  71. data/rails/actionmailer/test/fixtures/base_mailer/implicit_multipart.html.erb +1 -0
  72. data/rails/actionmailer/test/fixtures/base_mailer/implicit_multipart.text.erb +1 -0
  73. data/rails/actionmailer/test/fixtures/base_mailer/implicit_with_locale.en.html.erb +1 -0
  74. data/rails/actionmailer/test/fixtures/base_mailer/implicit_with_locale.html.erb +1 -0
  75. data/rails/actionmailer/test/fixtures/base_mailer/implicit_with_locale.pl.text.erb +1 -0
  76. data/rails/actionmailer/test/fixtures/base_mailer/implicit_with_locale.text.erb +1 -0
  77. data/rails/actionmailer/test/fixtures/base_mailer/inline_attachment.html.erb +5 -0
  78. data/rails/actionmailer/test/fixtures/base_mailer/inline_attachment.text.erb +4 -0
  79. data/rails/actionmailer/test/fixtures/base_mailer/plain_text_only.text.erb +1 -0
  80. data/rails/actionmailer/test/fixtures/base_mailer/welcome.erb +1 -0
  81. data/rails/actionmailer/test/fixtures/base_mailer/welcome_with_headers.html.erb +0 -0
  82. data/rails/actionmailer/test/fixtures/base_mailer/without_mail_call.erb +1 -0
  83. data/rails/actionmailer/test/fixtures/base_test/after_action_mailer/welcome.html.erb +0 -0
  84. data/rails/actionmailer/test/fixtures/base_test/before_action_mailer/welcome.html.erb +0 -0
  85. data/rails/actionmailer/test/fixtures/base_test/default_inline_attachment_mailer/welcome.html.erb +0 -0
  86. data/rails/actionmailer/test/fixtures/base_test/late_inline_attachment_mailer/on_render.erb +7 -0
  87. data/rails/actionmailer/test/fixtures/explicit_layout_mailer/logout.html.erb +1 -0
  88. data/rails/actionmailer/test/fixtures/explicit_layout_mailer/signup.html.erb +1 -0
  89. data/rails/actionmailer/test/fixtures/first_mailer/share.erb +1 -0
  90. data/rails/actionmailer/test/fixtures/i18n_test_mailer/mail_with_i18n_subject.erb +4 -0
  91. data/rails/actionmailer/test/fixtures/layouts/auto_layout_mailer.html.erb +1 -0
  92. data/rails/actionmailer/test/fixtures/layouts/auto_layout_mailer.text.erb +1 -0
  93. data/rails/actionmailer/test/fixtures/layouts/different_layout.html.erb +1 -0
  94. data/rails/actionmailer/test/fixtures/layouts/different_layout.text.erb +1 -0
  95. data/rails/actionmailer/test/fixtures/layouts/spam.html.erb +1 -0
  96. data/rails/actionmailer/test/fixtures/mail_delivery_test/delivery_mailer/welcome.html.erb +0 -0
  97. data/rails/actionmailer/test/fixtures/nested_layout_mailer/signup.html.erb +1 -0
  98. data/rails/actionmailer/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb +1 -0
  99. data/rails/actionmailer/test/fixtures/proc_mailer/welcome.html.erb +0 -0
  100. data/rails/actionmailer/test/fixtures/raw_email +14 -0
  101. data/rails/actionmailer/test/fixtures/second_mailer/share.erb +1 -0
  102. data/rails/actionmailer/test/fixtures/templates/signed_up.erb +3 -0
  103. data/rails/actionmailer/test/fixtures/test_helper_mailer/welcome +1 -0
  104. data/rails/actionmailer/test/fixtures/test_mailer/_subtemplate.text.erb +1 -0
  105. data/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml +6 -0
  106. data/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml +6 -0
  107. data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.html.erb +10 -0
  108. data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.html.erb~ +10 -0
  109. data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb +1 -0
  110. data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +1 -0
  111. data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.erb +2 -0
  112. data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.yaml.erb +1 -0
  113. data/rails/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.erb +1 -0
  114. data/rails/actionmailer/test/fixtures/test_mailer/multipart_alternative.html.erb +1 -0
  115. data/rails/actionmailer/test/fixtures/test_mailer/multipart_alternative.plain.erb +1 -0
  116. data/rails/actionmailer/test/fixtures/test_mailer/rxml_template.rxml +2 -0
  117. data/rails/actionmailer/test/fixtures/test_mailer/signed_up.html.erb +3 -0
  118. data/rails/actionmailer/test/fixtures/url_test_mailer/exercise_url_for.erb +1 -0
  119. data/rails/actionmailer/test/fixtures/url_test_mailer/signed_up_with_url.erb +5 -0
  120. data/rails/actionmailer/test/i18n_with_controller_test.rb +70 -0
  121. data/rails/actionmailer/test/log_subscriber_test.rb +47 -0
  122. data/rails/actionmailer/test/mail_helper_test.rb +111 -0
  123. data/rails/actionmailer/test/mail_layout_test.rb +95 -0
  124. data/rails/actionmailer/test/mailers/asset_mailer.rb +7 -0
  125. data/rails/actionmailer/test/mailers/base_mailer.rb +130 -0
  126. data/rails/actionmailer/test/mailers/delayed_mailer.rb +6 -0
  127. data/rails/actionmailer/test/mailers/proc_mailer.rb +17 -0
  128. data/rails/actionmailer/test/message_delivery_test.rb +104 -0
  129. data/rails/actionmailer/test/test_case_test.rb +28 -0
  130. data/rails/actionmailer/test/test_helper_test.rb +135 -0
  131. data/rails/actionmailer/test/url_test.rb +138 -0
  132. data/rails/actionpack/CHANGELOG.md +501 -0
  133. data/rails/actionpack/MIT-LICENSE +21 -0
  134. data/rails/actionpack/README.rdoc +58 -0
  135. data/rails/actionpack/Rakefile +53 -0
  136. data/rails/actionpack/actionpack.gemspec +31 -0
  137. data/rails/actionpack/lib/abstract_controller/asset_paths.rb +10 -0
  138. data/rails/actionpack/lib/abstract_controller/base.rb +269 -0
  139. data/rails/actionpack/lib/abstract_controller/callbacks.rb +196 -0
  140. data/rails/actionpack/lib/abstract_controller/collector.rb +46 -0
  141. data/rails/actionpack/lib/abstract_controller/helpers.rb +194 -0
  142. data/rails/actionpack/lib/abstract_controller/logger.rb +12 -0
  143. data/rails/actionpack/lib/abstract_controller/railties/routes_helpers.rb +18 -0
  144. data/rails/actionpack/lib/abstract_controller/rendering.rb +120 -0
  145. data/rails/actionpack/lib/abstract_controller/translation.rb +28 -0
  146. data/rails/actionpack/lib/abstract_controller/url_for.rb +33 -0
  147. data/rails/actionpack/lib/abstract_controller.rb +20 -0
  148. data/rails/actionpack/lib/action_controller/base.rb +268 -0
  149. data/rails/actionpack/lib/action_controller/caching/fragments.rb +103 -0
  150. data/rails/actionpack/lib/action_controller/caching.rb +89 -0
  151. data/rails/actionpack/lib/action_controller/log_subscriber.rb +83 -0
  152. data/rails/actionpack/lib/action_controller/metal/conditional_get.rb +200 -0
  153. data/rails/actionpack/lib/action_controller/metal/cookies.rb +16 -0
  154. data/rails/actionpack/lib/action_controller/metal/data_streaming.rb +171 -0
  155. data/rails/actionpack/lib/action_controller/metal/etag_with_template_digest.rb +50 -0
  156. data/rails/actionpack/lib/action_controller/metal/exceptions.rb +59 -0
  157. data/rails/actionpack/lib/action_controller/metal/flash.rb +60 -0
  158. data/rails/actionpack/lib/action_controller/metal/force_ssl.rb +97 -0
  159. data/rails/actionpack/lib/action_controller/metal/head.rb +56 -0
  160. data/rails/actionpack/lib/action_controller/metal/helpers.rb +113 -0
  161. data/rails/actionpack/lib/action_controller/metal/hide_actions.rb +40 -0
  162. data/rails/actionpack/lib/action_controller/metal/http_authentication.rb +507 -0
  163. data/rails/actionpack/lib/action_controller/metal/implicit_render.rb +19 -0
  164. data/rails/actionpack/lib/action_controller/metal/instrumentation.rb +109 -0
  165. data/rails/actionpack/lib/action_controller/metal/live.rb +328 -0
  166. data/rails/actionpack/lib/action_controller/metal/mime_responds.rb +324 -0
  167. data/rails/actionpack/lib/action_controller/metal/params_wrapper.rb +285 -0
  168. data/rails/actionpack/lib/action_controller/metal/rack_delegation.rb +32 -0
  169. data/rails/actionpack/lib/action_controller/metal/redirecting.rb +112 -0
  170. data/rails/actionpack/lib/action_controller/metal/renderers.rb +140 -0
  171. data/rails/actionpack/lib/action_controller/metal/rendering.rb +100 -0
  172. data/rails/actionpack/lib/action_controller/metal/request_forgery_protection.rb +334 -0
  173. data/rails/actionpack/lib/action_controller/metal/rescue.rb +35 -0
  174. data/rails/actionpack/lib/action_controller/metal/streaming.rb +221 -0
  175. data/rails/actionpack/lib/action_controller/metal/strong_parameters.rb +667 -0
  176. data/rails/actionpack/lib/action_controller/metal/testing.rb +31 -0
  177. data/rails/actionpack/lib/action_controller/metal/url_for.rb +49 -0
  178. data/rails/actionpack/lib/action_controller/metal.rb +241 -0
  179. data/rails/actionpack/lib/action_controller/middleware.rb +39 -0
  180. data/rails/actionpack/lib/action_controller/model_naming.rb +12 -0
  181. data/rails/actionpack/lib/action_controller/railtie.rb +71 -0
  182. data/rails/actionpack/lib/action_controller/railties/helpers.rb +22 -0
  183. data/rails/actionpack/lib/action_controller/test_case.rb +754 -0
  184. data/rails/actionpack/lib/action_controller.rb +58 -0
  185. data/rails/actionpack/lib/action_dispatch/http/cache.rb +176 -0
  186. data/rails/actionpack/lib/action_dispatch/http/filter_parameters.rb +78 -0
  187. data/rails/actionpack/lib/action_dispatch/http/filter_redirect.rb +38 -0
  188. data/rails/actionpack/lib/action_dispatch/http/headers.rb +99 -0
  189. data/rails/actionpack/lib/action_dispatch/http/mime_negotiation.rb +156 -0
  190. data/rails/actionpack/lib/action_dispatch/http/mime_type.rb +315 -0
  191. data/rails/actionpack/lib/action_dispatch/http/mime_types.rb +36 -0
  192. data/rails/actionpack/lib/action_dispatch/http/parameter_filter.rb +72 -0
  193. data/rails/actionpack/lib/action_dispatch/http/parameters.rb +67 -0
  194. data/rails/actionpack/lib/action_dispatch/http/rack_cache.rb +61 -0
  195. data/rails/actionpack/lib/action_dispatch/http/request.rb +348 -0
  196. data/rails/actionpack/lib/action_dispatch/http/response.rb +406 -0
  197. data/rails/actionpack/lib/action_dispatch/http/upload.rb +72 -0
  198. data/rails/actionpack/lib/action_dispatch/http/url.rb +268 -0
  199. data/rails/actionpack/lib/action_dispatch/journey/backwards.rb +5 -0
  200. data/rails/actionpack/lib/action_dispatch/journey/formatter.rb +166 -0
  201. data/rails/actionpack/lib/action_dispatch/journey/gtg/builder.rb +162 -0
  202. data/rails/actionpack/lib/action_dispatch/journey/gtg/simulator.rb +47 -0
  203. data/rails/actionpack/lib/action_dispatch/journey/gtg/transition_table.rb +157 -0
  204. data/rails/actionpack/lib/action_dispatch/journey/nfa/builder.rb +76 -0
  205. data/rails/actionpack/lib/action_dispatch/journey/nfa/dot.rb +36 -0
  206. data/rails/actionpack/lib/action_dispatch/journey/nfa/simulator.rb +47 -0
  207. data/rails/actionpack/lib/action_dispatch/journey/nfa/transition_table.rb +163 -0
  208. data/rails/actionpack/lib/action_dispatch/journey/nodes/node.rb +128 -0
  209. data/rails/actionpack/lib/action_dispatch/journey/parser.rb +198 -0
  210. data/rails/actionpack/lib/action_dispatch/journey/parser.y +49 -0
  211. data/rails/actionpack/lib/action_dispatch/journey/parser_extras.rb +23 -0
  212. data/rails/actionpack/lib/action_dispatch/journey/path/pattern.rb +193 -0
  213. data/rails/actionpack/lib/action_dispatch/journey/route.rb +125 -0
  214. data/rails/actionpack/lib/action_dispatch/journey/router/strexp.rb +27 -0
  215. data/rails/actionpack/lib/action_dispatch/journey/router/utils.rb +93 -0
  216. data/rails/actionpack/lib/action_dispatch/journey/router.rb +144 -0
  217. data/rails/actionpack/lib/action_dispatch/journey/routes.rb +76 -0
  218. data/rails/actionpack/lib/action_dispatch/journey/scanner.rb +61 -0
  219. data/rails/actionpack/lib/action_dispatch/journey/visitors.rb +221 -0
  220. data/rails/actionpack/lib/action_dispatch/journey/visualizer/fsm.css +30 -0
  221. data/rails/actionpack/lib/action_dispatch/journey/visualizer/fsm.js +134 -0
  222. data/rails/actionpack/lib/action_dispatch/journey/visualizer/index.html.erb +52 -0
  223. data/rails/actionpack/lib/action_dispatch/journey.rb +5 -0
  224. data/rails/actionpack/lib/action_dispatch/middleware/callbacks.rb +37 -0
  225. data/rails/actionpack/lib/action_dispatch/middleware/cookies.rb +574 -0
  226. data/rails/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb +110 -0
  227. data/rails/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb +148 -0
  228. data/rails/actionpack/lib/action_dispatch/middleware/flash.rb +276 -0
  229. data/rails/actionpack/lib/action_dispatch/middleware/params_parser.rb +60 -0
  230. data/rails/actionpack/lib/action_dispatch/middleware/public_exceptions.rb +55 -0
  231. data/rails/actionpack/lib/action_dispatch/middleware/reloader.rb +98 -0
  232. data/rails/actionpack/lib/action_dispatch/middleware/remote_ip.rb +173 -0
  233. data/rails/actionpack/lib/action_dispatch/middleware/request_id.rb +35 -0
  234. data/rails/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb +90 -0
  235. data/rails/actionpack/lib/action_dispatch/middleware/session/cache_store.rb +49 -0
  236. data/rails/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb +123 -0
  237. data/rails/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb +22 -0
  238. data/rails/actionpack/lib/action_dispatch/middleware/show_exceptions.rb +58 -0
  239. data/rails/actionpack/lib/action_dispatch/middleware/ssl.rb +72 -0
  240. data/rails/actionpack/lib/action_dispatch/middleware/stack.rb +129 -0
  241. data/rails/actionpack/lib/action_dispatch/middleware/static.rb +116 -0
  242. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +34 -0
  243. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb +23 -0
  244. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb +27 -0
  245. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +52 -0
  246. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.text.erb +9 -0
  247. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +16 -0
  248. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb +9 -0
  249. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb +160 -0
  250. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +11 -0
  251. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/missing_template.text.erb +3 -0
  252. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +32 -0
  253. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.text.erb +11 -0
  254. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +20 -0
  255. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/template_error.text.erb +7 -0
  256. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +6 -0
  257. data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/unknown_action.text.erb +3 -0
  258. data/rails/actionpack/lib/action_dispatch/middleware/templates/routes/_route.html.erb +16 -0
  259. data/rails/actionpack/lib/action_dispatch/middleware/templates/routes/_table.html.erb +200 -0
  260. data/rails/actionpack/lib/action_dispatch/railtie.rb +45 -0
  261. data/rails/actionpack/lib/action_dispatch/request/session.rb +193 -0
  262. data/rails/actionpack/lib/action_dispatch/request/utils.rb +35 -0
  263. data/rails/actionpack/lib/action_dispatch/routing/endpoint.rb +10 -0
  264. data/rails/actionpack/lib/action_dispatch/routing/inspector.rb +234 -0
  265. data/rails/actionpack/lib/action_dispatch/routing/mapper.rb +1979 -0
  266. data/rails/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +330 -0
  267. data/rails/actionpack/lib/action_dispatch/routing/redirection.rb +191 -0
  268. data/rails/actionpack/lib/action_dispatch/routing/route_set.rb +862 -0
  269. data/rails/actionpack/lib/action_dispatch/routing/routes_proxy.rb +41 -0
  270. data/rails/actionpack/lib/action_dispatch/routing/url_for.rb +195 -0
  271. data/rails/actionpack/lib/action_dispatch/routing.rb +261 -0
  272. data/rails/actionpack/lib/action_dispatch/testing/assertions/dom.rb +3 -0
  273. data/rails/actionpack/lib/action_dispatch/testing/assertions/response.rb +82 -0
  274. data/rails/actionpack/lib/action_dispatch/testing/assertions/routing.rb +212 -0
  275. data/rails/actionpack/lib/action_dispatch/testing/assertions/selector.rb +3 -0
  276. data/rails/actionpack/lib/action_dispatch/testing/assertions/tag.rb +3 -0
  277. data/rails/actionpack/lib/action_dispatch/testing/assertions.rb +22 -0
  278. data/rails/actionpack/lib/action_dispatch/testing/integration.rb +511 -0
  279. data/rails/actionpack/lib/action_dispatch/testing/test_process.rb +44 -0
  280. data/rails/actionpack/lib/action_dispatch/testing/test_request.rb +78 -0
  281. data/rails/actionpack/lib/action_dispatch/testing/test_response.rb +36 -0
  282. data/rails/actionpack/lib/action_dispatch.rb +105 -0
  283. data/rails/actionpack/lib/action_pack/gem_version.rb +15 -0
  284. data/rails/actionpack/lib/action_pack/version.rb +8 -0
  285. data/rails/actionpack/lib/action_pack.rb +24 -0
  286. data/rails/actionpack/test/abstract/callbacks_test.rb +315 -0
  287. data/rails/actionpack/test/abstract/collector_test.rb +63 -0
  288. data/rails/actionpack/test/abstract/translation_test.rb +50 -0
  289. data/rails/actionpack/test/abstract_unit.rb +521 -0
  290. data/rails/actionpack/test/assertions/response_assertions_test.rb +63 -0
  291. data/rails/actionpack/test/controller/action_pack_assertions_test.rb +657 -0
  292. data/rails/actionpack/test/controller/base_test.rb +342 -0
  293. data/rails/actionpack/test/controller/caching_test.rb +351 -0
  294. data/rails/actionpack/test/controller/content_type_test.rb +167 -0
  295. data/rails/actionpack/test/controller/controller_fixtures/app/controllers/admin/user_controller.rb +0 -0
  296. data/rails/actionpack/test/controller/controller_fixtures/app/controllers/user_controller.rb +0 -0
  297. data/rails/actionpack/test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib/plugin_controller.rb +0 -0
  298. data/rails/actionpack/test/controller/default_url_options_with_before_action_test.rb +29 -0
  299. data/rails/actionpack/test/controller/filters_test.rb +1047 -0
  300. data/rails/actionpack/test/controller/flash_hash_test.rb +211 -0
  301. data/rails/actionpack/test/controller/flash_test.rb +335 -0
  302. data/rails/actionpack/test/controller/force_ssl_test.rb +324 -0
  303. data/rails/actionpack/test/controller/helper_test.rb +297 -0
  304. data/rails/actionpack/test/controller/http_basic_authentication_test.rb +144 -0
  305. data/rails/actionpack/test/controller/http_digest_authentication_test.rb +289 -0
  306. data/rails/actionpack/test/controller/http_token_authentication_test.rb +200 -0
  307. data/rails/actionpack/test/controller/integration_test.rb +899 -0
  308. data/rails/actionpack/test/controller/live_stream_test.rb +454 -0
  309. data/rails/actionpack/test/controller/localized_templates_test.rb +46 -0
  310. data/rails/actionpack/test/controller/log_subscriber_test.rb +345 -0
  311. data/rails/actionpack/test/controller/mime/accept_format_test.rb +92 -0
  312. data/rails/actionpack/test/controller/mime/respond_to_test.rb +784 -0
  313. data/rails/actionpack/test/controller/mime/responders_test.rb +32 -0
  314. data/rails/actionpack/test/controller/new_base/bare_metal_test.rb +153 -0
  315. data/rails/actionpack/test/controller/new_base/base_test.rb +132 -0
  316. data/rails/actionpack/test/controller/new_base/content_negotiation_test.rb +27 -0
  317. data/rails/actionpack/test/controller/new_base/content_type_test.rb +112 -0
  318. data/rails/actionpack/test/controller/new_base/metal_test.rb +45 -0
  319. data/rails/actionpack/test/controller/new_base/middleware_test.rb +110 -0
  320. data/rails/actionpack/test/controller/new_base/render_action_test.rb +315 -0
  321. data/rails/actionpack/test/controller/new_base/render_body_test.rb +170 -0
  322. data/rails/actionpack/test/controller/new_base/render_context_test.rb +54 -0
  323. data/rails/actionpack/test/controller/new_base/render_file_test.rb +70 -0
  324. data/rails/actionpack/test/controller/new_base/render_html_test.rb +190 -0
  325. data/rails/actionpack/test/controller/new_base/render_implicit_action_test.rb +57 -0
  326. data/rails/actionpack/test/controller/new_base/render_layout_test.rb +127 -0
  327. data/rails/actionpack/test/controller/new_base/render_partial_test.rb +63 -0
  328. data/rails/actionpack/test/controller/new_base/render_plain_test.rb +168 -0
  329. data/rails/actionpack/test/controller/new_base/render_streaming_test.rb +114 -0
  330. data/rails/actionpack/test/controller/new_base/render_template_test.rb +239 -0
  331. data/rails/actionpack/test/controller/new_base/render_test.rb +136 -0
  332. data/rails/actionpack/test/controller/new_base/render_text_test.rb +158 -0
  333. data/rails/actionpack/test/controller/new_base/render_xml_test.rb +11 -0
  334. data/rails/actionpack/test/controller/output_escaping_test.rb +17 -0
  335. data/rails/actionpack/test/controller/parameters/accessors_test.rb +125 -0
  336. data/rails/actionpack/test/controller/parameters/always_permitted_parameters_test.rb +29 -0
  337. data/rails/actionpack/test/controller/parameters/log_on_unpermitted_params_test.rb +72 -0
  338. data/rails/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb +38 -0
  339. data/rails/actionpack/test/controller/parameters/mutators_test.rb +99 -0
  340. data/rails/actionpack/test/controller/parameters/nested_parameters_test.rb +187 -0
  341. data/rails/actionpack/test/controller/parameters/parameters_permit_test.rb +289 -0
  342. data/rails/actionpack/test/controller/parameters/raise_on_unpermitted_params_test.rb +33 -0
  343. data/rails/actionpack/test/controller/params_wrapper_test.rb +362 -0
  344. data/rails/actionpack/test/controller/permitted_params_test.rb +25 -0
  345. data/rails/actionpack/test/controller/redirect_test.rb +354 -0
  346. data/rails/actionpack/test/controller/render_js_test.rb +34 -0
  347. data/rails/actionpack/test/controller/render_json_test.rb +136 -0
  348. data/rails/actionpack/test/controller/render_other_test.rb +24 -0
  349. data/rails/actionpack/test/controller/render_test.rb +579 -0
  350. data/rails/actionpack/test/controller/render_xml_test.rb +97 -0
  351. data/rails/actionpack/test/controller/request/test_request_test.rb +35 -0
  352. data/rails/actionpack/test/controller/request_forgery_protection_test.rb +510 -0
  353. data/rails/actionpack/test/controller/required_params_test.rb +51 -0
  354. data/rails/actionpack/test/controller/rescue_test.rb +348 -0
  355. data/rails/actionpack/test/controller/resources_test.rb +1334 -0
  356. data/rails/actionpack/test/controller/routing_test.rb +2026 -0
  357. data/rails/actionpack/test/controller/runner_test.rb +22 -0
  358. data/rails/actionpack/test/controller/send_file_test.rb +209 -0
  359. data/rails/actionpack/test/controller/show_exceptions_test.rb +112 -0
  360. data/rails/actionpack/test/controller/streaming_test.rb +26 -0
  361. data/rails/actionpack/test/controller/test_case_test.rb +913 -0
  362. data/rails/actionpack/test/controller/url_for_integration_test.rb +188 -0
  363. data/rails/actionpack/test/controller/url_for_test.rb +446 -0
  364. data/rails/actionpack/test/controller/url_rewriter_test.rb +90 -0
  365. data/rails/actionpack/test/controller/webservice_test.rb +114 -0
  366. data/rails/actionpack/test/dispatch/callbacks_test.rb +58 -0
  367. data/rails/actionpack/test/dispatch/cookies_test.rb +1159 -0
  368. data/rails/actionpack/test/dispatch/debug_exceptions_test.rb +350 -0
  369. data/rails/actionpack/test/dispatch/exception_wrapper_test.rb +97 -0
  370. data/rails/actionpack/test/dispatch/header_test.rb +139 -0
  371. data/rails/actionpack/test/dispatch/live_response_test.rb +94 -0
  372. data/rails/actionpack/test/dispatch/mapper_test.rb +112 -0
  373. data/rails/actionpack/test/dispatch/middleware_stack/middleware_test.rb +77 -0
  374. data/rails/actionpack/test/dispatch/middleware_stack_test.rb +117 -0
  375. data/rails/actionpack/test/dispatch/mime_type_test.rb +203 -0
  376. data/rails/actionpack/test/dispatch/mount_test.rb +93 -0
  377. data/rails/actionpack/test/dispatch/prefix_generation_test.rb +465 -0
  378. data/rails/actionpack/test/dispatch/rack_cache_test.rb +21 -0
  379. data/rails/actionpack/test/dispatch/reloader_test.rb +176 -0
  380. data/rails/actionpack/test/dispatch/request/json_params_parsing_test.rb +164 -0
  381. data/rails/actionpack/test/dispatch/request/multipart_params_parsing_test.rb +186 -0
  382. data/rails/actionpack/test/dispatch/request/query_string_parsing_test.rb +171 -0
  383. data/rails/actionpack/test/dispatch/request/session_test.rb +116 -0
  384. data/rails/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb +177 -0
  385. data/rails/actionpack/test/dispatch/request_id_test.rb +65 -0
  386. data/rails/actionpack/test/dispatch/request_test.rb +1159 -0
  387. data/rails/actionpack/test/dispatch/response_test.rb +344 -0
  388. data/rails/actionpack/test/dispatch/routing/concerns_test.rb +120 -0
  389. data/rails/actionpack/test/dispatch/routing/inspector_test.rb +326 -0
  390. data/rails/actionpack/test/dispatch/routing/route_set_test.rb +205 -0
  391. data/rails/actionpack/test/dispatch/routing_assertions_test.rb +131 -0
  392. data/rails/actionpack/test/dispatch/routing_test.rb +4475 -0
  393. data/rails/actionpack/test/dispatch/session/abstract_store_test.rb +56 -0
  394. data/rails/actionpack/test/dispatch/session/cache_store_test.rb +179 -0
  395. data/rails/actionpack/test/dispatch/session/cookie_store_test.rb +356 -0
  396. data/rails/actionpack/test/dispatch/session/mem_cache_store_test.rb +201 -0
  397. data/rails/actionpack/test/dispatch/session/test_session_test.rb +43 -0
  398. data/rails/actionpack/test/dispatch/show_exceptions_test.rb +115 -0
  399. data/rails/actionpack/test/dispatch/ssl_test.rb +219 -0
  400. data/rails/actionpack/test/dispatch/static_test.rb +239 -0
  401. data/rails/actionpack/test/dispatch/template_assertions_test.rb +110 -0
  402. data/rails/actionpack/test/dispatch/test_request_test.rb +99 -0
  403. data/rails/actionpack/test/dispatch/test_response_test.rb +21 -0
  404. data/rails/actionpack/test/dispatch/uploaded_file_test.rb +105 -0
  405. data/rails/actionpack/test/dispatch/url_generation_test.rb +134 -0
  406. data/rails/actionpack/test/fixtures/_top_level_partial_only.erb +1 -0
  407. data/rails/actionpack/test/fixtures/alternate_helpers/foo_helper.rb +3 -0
  408. data/rails/actionpack/test/fixtures/bad_customers/_bad_customer.html.erb +1 -0
  409. data/rails/actionpack/test/fixtures/company.rb +9 -0
  410. data/rails/actionpack/test/fixtures/filter_test/implicit_actions/edit.html.erb +1 -0
  411. data/rails/actionpack/test/fixtures/filter_test/implicit_actions/show.html.erb +1 -0
  412. data/rails/actionpack/test/fixtures/functional_caching/_partial.erb +3 -0
  413. data/rails/actionpack/test/fixtures/functional_caching/formatted_fragment_cached.html.erb +3 -0
  414. data/rails/actionpack/test/fixtures/functional_caching/formatted_fragment_cached.xml.builder +5 -0
  415. data/rails/actionpack/test/fixtures/functional_caching/formatted_fragment_cached_with_variant.html+phone.erb +3 -0
  416. data/rails/actionpack/test/fixtures/functional_caching/fragment_cached.html.erb +3 -0
  417. data/rails/actionpack/test/fixtures/functional_caching/fragment_cached_without_digest.html.erb +3 -0
  418. data/rails/actionpack/test/fixtures/functional_caching/html_fragment_cached_with_partial.html.erb +1 -0
  419. data/rails/actionpack/test/fixtures/functional_caching/inline_fragment_cached.html.erb +2 -0
  420. data/rails/actionpack/test/fixtures/helpers/abc_helper.rb +3 -0
  421. data/rails/actionpack/test/fixtures/helpers/fun/games_helper.rb +5 -0
  422. data/rails/actionpack/test/fixtures/helpers/fun/pdf_helper.rb +5 -0
  423. data/rails/actionpack/test/fixtures/helpers/just_me_helper.rb +3 -0
  424. data/rails/actionpack/test/fixtures/helpers/me_too_helper.rb +3 -0
  425. data/rails/actionpack/test/fixtures/helpers1_pack/pack1_helper.rb +5 -0
  426. data/rails/actionpack/test/fixtures/helpers2_pack/pack2_helper.rb +5 -0
  427. data/rails/actionpack/test/fixtures/helpers_typo/admin/users_helper.rb +5 -0
  428. data/rails/actionpack/test/fixtures/layouts/_customers.erb +1 -0
  429. data/rails/actionpack/test/fixtures/layouts/block_with_layout.erb +3 -0
  430. data/rails/actionpack/test/fixtures/layouts/builder.builder +3 -0
  431. data/rails/actionpack/test/fixtures/layouts/partial_with_layout.erb +3 -0
  432. data/rails/actionpack/test/fixtures/layouts/standard.html.erb +1 -0
  433. data/rails/actionpack/test/fixtures/layouts/talk_from_action.erb +2 -0
  434. data/rails/actionpack/test/fixtures/layouts/with_html_partial.html.erb +1 -0
  435. data/rails/actionpack/test/fixtures/layouts/xhr.html.erb +2 -0
  436. data/rails/actionpack/test/fixtures/layouts/yield.erb +2 -0
  437. data/rails/actionpack/test/fixtures/localized/hello_world.de.html +1 -0
  438. data/rails/actionpack/test/fixtures/localized/hello_world.en.html +1 -0
  439. data/rails/actionpack/test/fixtures/localized/hello_world.it.erb +1 -0
  440. data/rails/actionpack/test/fixtures/multipart/binary_file +0 -0
  441. data/rails/actionpack/test/fixtures/multipart/boundary_problem_file +10 -0
  442. data/rails/actionpack/test/fixtures/multipart/bracketed_param +5 -0
  443. data/rails/actionpack/test/fixtures/multipart/bracketed_utf8_param +5 -0
  444. data/rails/actionpack/test/fixtures/multipart/empty +10 -0
  445. data/rails/actionpack/test/fixtures/multipart/hello.txt +1 -0
  446. data/rails/actionpack/test/fixtures/multipart/large_text_file +10 -0
  447. data/rails/actionpack/test/fixtures/multipart/mixed_files +0 -0
  448. data/rails/actionpack/test/fixtures/multipart/mona_lisa.jpg +0 -0
  449. data/rails/actionpack/test/fixtures/multipart/none +9 -0
  450. data/rails/actionpack/test/fixtures/multipart/single_parameter +5 -0
  451. data/rails/actionpack/test/fixtures/multipart/single_utf8_param +5 -0
  452. data/rails/actionpack/test/fixtures/multipart/text_file +10 -0
  453. data/rails/actionpack/test/fixtures/old_content_type/render_default_content_types_for_respond_to.xml.erb +1 -0
  454. data/rails/actionpack/test/fixtures/old_content_type/render_default_for_builder.builder +1 -0
  455. data/rails/actionpack/test/fixtures/old_content_type/render_default_for_erb.erb +1 -0
  456. data/rails/actionpack/test/fixtures/post_test/layouts/post.html.erb +1 -0
  457. data/rails/actionpack/test/fixtures/post_test/layouts/super_post.iphone.erb +1 -0
  458. data/rails/actionpack/test/fixtures/post_test/post/index.html.erb +1 -0
  459. data/rails/actionpack/test/fixtures/post_test/post/index.iphone.erb +1 -0
  460. data/rails/actionpack/test/fixtures/post_test/super_post/index.html.erb +1 -0
  461. data/rails/actionpack/test/fixtures/post_test/super_post/index.iphone.erb +1 -0
  462. data/rails/actionpack/test/fixtures/public/400.html +1 -0
  463. data/rails/actionpack/test/fixtures/public/404.html +1 -0
  464. data/rails/actionpack/test/fixtures/public/500.da.html +1 -0
  465. data/rails/actionpack/test/fixtures/public/500.html +1 -0
  466. data/rails/actionpack/test/fixtures/public/bar/index.html +1 -0
  467. data/rails/actionpack/test/fixtures/public/bar.html +1 -0
  468. data/rails/actionpack/test/fixtures/public/foo/bar.html +1 -0
  469. data/rails/actionpack/test/fixtures/public/foo/baz.css +3 -0
  470. data/rails/actionpack/test/fixtures/public/foo/index.html +1 -0
  471. data/rails/actionpack/test/fixtures/public/foo//343/201/223/343/202/223/343/201/253/343/201/241/343/201/257.html +1 -0
  472. data/rails/actionpack/test/fixtures/public/gzip/application-a71b3024f80aea3181c09774ca17e712.js +4 -0
  473. data/rails/actionpack/test/fixtures/public/gzip/application-a71b3024f80aea3181c09774ca17e712.js.gz +0 -0
  474. data/rails/actionpack/test/fixtures/public/gzip/foo.zoo +4 -0
  475. data/rails/actionpack/test/fixtures/public/gzip/foo.zoo.gz +0 -0
  476. data/rails/actionpack/test/fixtures/public/index.html +1 -0
  477. data/rails/actionpack/test/fixtures/respond_to/all_types_with_layout.html.erb +1 -0
  478. data/rails/actionpack/test/fixtures/respond_to/custom_constant_handling_without_block.mobile.erb +1 -0
  479. data/rails/actionpack/test/fixtures/respond_to/iphone_with_html_response_type.html.erb +1 -0
  480. data/rails/actionpack/test/fixtures/respond_to/iphone_with_html_response_type.iphone.erb +1 -0
  481. data/rails/actionpack/test/fixtures/respond_to/layouts/missing.html.erb +1 -0
  482. data/rails/actionpack/test/fixtures/respond_to/layouts/standard.html.erb +1 -0
  483. data/rails/actionpack/test/fixtures/respond_to/layouts/standard.iphone.erb +1 -0
  484. data/rails/actionpack/test/fixtures/respond_to/using_defaults.html.erb +1 -0
  485. data/rails/actionpack/test/fixtures/respond_to/using_defaults.xml.builder +1 -0
  486. data/rails/actionpack/test/fixtures/respond_to/using_defaults_with_all.html.erb +1 -0
  487. data/rails/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.html.erb +1 -0
  488. data/rails/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.xml.builder +1 -0
  489. data/rails/actionpack/test/fixtures/respond_to/variant_any_implicit_render.html+phablet.erb +1 -0
  490. data/rails/actionpack/test/fixtures/respond_to/variant_any_implicit_render.html+tablet.erb +1 -0
  491. data/rails/actionpack/test/fixtures/respond_to/variant_inline_syntax_without_block.html+phone.erb +1 -0
  492. data/rails/actionpack/test/fixtures/respond_to/variant_plus_none_for_format.html.erb +1 -0
  493. data/rails/actionpack/test/fixtures/respond_to/variant_with_implicit_rendering.html+mobile.erb +1 -0
  494. data/rails/actionpack/test/fixtures/ruby_template.ruby +2 -0
  495. data/rails/actionpack/test/fixtures/session_autoload_test/session_autoload_test/foo.rb +10 -0
  496. data/rails/actionpack/test/fixtures/shared.html.erb +1 -0
  497. data/rails/actionpack/test/fixtures/star_star_mime/index.js.erb +1 -0
  498. data/rails/actionpack/test/fixtures/symlink_parent/symlinked_layout.erb +5 -0
  499. data/rails/actionpack/test/fixtures/test/_partial.erb +1 -0
  500. data/rails/actionpack/test/fixtures/test/_partial.html.erb +1 -0
  501. data/rails/actionpack/test/fixtures/test/_partial.js.erb +1 -0
  502. data/rails/actionpack/test/fixtures/test/dot.directory/render_file_with_ivar.erb +1 -0
  503. data/rails/actionpack/test/fixtures/test/formatted_xml_erb.builder +1 -0
  504. data/rails/actionpack/test/fixtures/test/formatted_xml_erb.html.erb +1 -0
  505. data/rails/actionpack/test/fixtures/test/formatted_xml_erb.xml.erb +1 -0
  506. data/rails/actionpack/test/fixtures/test/hello/hello.erb +1 -0
  507. data/rails/actionpack/test/fixtures/test/hello_world.erb +1 -0
  508. data/rails/actionpack/test/fixtures/test/hello_world_with_partial.html.erb +2 -0
  509. data/rails/actionpack/test/fixtures/test/hello_xml_world.builder +11 -0
  510. data/rails/actionpack/test/fixtures/test/implicit_content_type.atom.builder +2 -0
  511. data/rails/actionpack/test/fixtures/test/render_file_with_ivar.erb +1 -0
  512. data/rails/actionpack/test/fixtures/test/render_file_with_locals.erb +1 -0
  513. data/rails/actionpack/test/fixtures//345/205/254/345/205/261/bar/index.html +1 -0
  514. data/rails/actionpack/test/fixtures//345/205/254/345/205/261/bar.html +1 -0
  515. data/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo/bar.html +1 -0
  516. data/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo/baz.css +3 -0
  517. data/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo/index.html +1 -0
  518. data/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo//343/201/223/343/202/223/343/201/253/343/201/241/343/201/257.html +1 -0
  519. data/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/application-a71b3024f80aea3181c09774ca17e712.js +4 -0
  520. data/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/application-a71b3024f80aea3181c09774ca17e712.js.gz +0 -0
  521. data/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/foo.zoo +4 -0
  522. data/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/foo.zoo.gz +0 -0
  523. data/rails/actionpack/test/fixtures//345/205/254/345/205/261/index.html +1 -0
  524. data/rails/actionpack/test/journey/gtg/builder_test.rb +79 -0
  525. data/rails/actionpack/test/journey/gtg/transition_table_test.rb +115 -0
  526. data/rails/actionpack/test/journey/nfa/simulator_test.rb +98 -0
  527. data/rails/actionpack/test/journey/nfa/transition_table_test.rb +72 -0
  528. data/rails/actionpack/test/journey/nodes/symbol_test.rb +17 -0
  529. data/rails/actionpack/test/journey/path/pattern_test.rb +284 -0
  530. data/rails/actionpack/test/journey/route/definition/parser_test.rb +110 -0
  531. data/rails/actionpack/test/journey/route/definition/scanner_test.rb +69 -0
  532. data/rails/actionpack/test/journey/route_test.rb +106 -0
  533. data/rails/actionpack/test/journey/router/utils_test.rb +38 -0
  534. data/rails/actionpack/test/journey/router_test.rb +622 -0
  535. data/rails/actionpack/test/journey/routes_test.rb +53 -0
  536. data/rails/actionpack/test/lib/controller/fake_controllers.rb +35 -0
  537. data/rails/actionpack/test/lib/controller/fake_models.rb +73 -0
  538. data/rails/actionpack/test/routing/helper_test.rb +45 -0
  539. data/rails/actionpack/test/tmp/.gitignore +0 -0
  540. data/rails/actionview/CHANGELOG.md +228 -0
  541. data/rails/actionview/MIT-LICENSE +21 -0
  542. data/rails/actionview/README.rdoc +39 -0
  543. data/rails/actionview/RUNNING_UNIT_TESTS.rdoc +27 -0
  544. data/rails/actionview/Rakefile +83 -0
  545. data/rails/actionview/actionview.gemspec +31 -0
  546. data/rails/actionview/lib/action_view/base.rb +205 -0
  547. data/rails/actionview/lib/action_view/buffers.rb +50 -0
  548. data/rails/actionview/lib/action_view/context.rb +36 -0
  549. data/rails/actionview/lib/action_view/dependency_tracker.rb +141 -0
  550. data/rails/actionview/lib/action_view/digestor.rb +122 -0
  551. data/rails/actionview/lib/action_view/flows.rb +76 -0
  552. data/rails/actionview/lib/action_view/gem_version.rb +15 -0
  553. data/rails/actionview/lib/action_view/helpers/active_model_helper.rb +49 -0
  554. data/rails/actionview/lib/action_view/helpers/asset_tag_helper.rb +329 -0
  555. data/rails/actionview/lib/action_view/helpers/asset_url_helper.rb +366 -0
  556. data/rails/actionview/lib/action_view/helpers/atom_feed_helper.rb +203 -0
  557. data/rails/actionview/lib/action_view/helpers/cache_helper.rb +200 -0
  558. data/rails/actionview/lib/action_view/helpers/capture_helper.rb +207 -0
  559. data/rails/actionview/lib/action_view/helpers/controller_helper.rb +25 -0
  560. data/rails/actionview/lib/action_view/helpers/csrf_helper.rb +33 -0
  561. data/rails/actionview/lib/action_view/helpers/date_helper.rb +1098 -0
  562. data/rails/actionview/lib/action_view/helpers/debug_helper.rb +35 -0
  563. data/rails/actionview/lib/action_view/helpers/form_helper.rb +1942 -0
  564. data/rails/actionview/lib/action_view/helpers/form_options_helper.rb +841 -0
  565. data/rails/actionview/lib/action_view/helpers/form_tag_helper.rb +877 -0
  566. data/rails/actionview/lib/action_view/helpers/javascript_helper.rb +81 -0
  567. data/rails/actionview/lib/action_view/helpers/number_helper.rb +432 -0
  568. data/rails/actionview/lib/action_view/helpers/output_safety_helper.rb +38 -0
  569. data/rails/actionview/lib/action_view/helpers/record_tag_helper.rb +108 -0
  570. data/rails/actionview/lib/action_view/helpers/rendering_helper.rb +98 -0
  571. data/rails/actionview/lib/action_view/helpers/sanitize_helper.rb +172 -0
  572. data/rails/actionview/lib/action_view/helpers/tag_helper.rb +188 -0
  573. data/rails/actionview/lib/action_view/helpers/tags/base.rb +155 -0
  574. data/rails/actionview/lib/action_view/helpers/tags/check_box.rb +64 -0
  575. data/rails/actionview/lib/action_view/helpers/tags/checkable.rb +16 -0
  576. data/rails/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb +57 -0
  577. data/rails/actionview/lib/action_view/helpers/tags/collection_helpers.rb +85 -0
  578. data/rails/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb +36 -0
  579. data/rails/actionview/lib/action_view/helpers/tags/collection_select.rb +28 -0
  580. data/rails/actionview/lib/action_view/helpers/tags/color_field.rb +25 -0
  581. data/rails/actionview/lib/action_view/helpers/tags/date_field.rb +13 -0
  582. data/rails/actionview/lib/action_view/helpers/tags/date_select.rb +72 -0
  583. data/rails/actionview/lib/action_view/helpers/tags/datetime_field.rb +30 -0
  584. data/rails/actionview/lib/action_view/helpers/tags/datetime_local_field.rb +19 -0
  585. data/rails/actionview/lib/action_view/helpers/tags/datetime_select.rb +8 -0
  586. data/rails/actionview/lib/action_view/helpers/tags/email_field.rb +8 -0
  587. data/rails/actionview/lib/action_view/helpers/tags/file_field.rb +8 -0
  588. data/rails/actionview/lib/action_view/helpers/tags/grouped_collection_select.rb +29 -0
  589. data/rails/actionview/lib/action_view/helpers/tags/hidden_field.rb +8 -0
  590. data/rails/actionview/lib/action_view/helpers/tags/label.rb +79 -0
  591. data/rails/actionview/lib/action_view/helpers/tags/month_field.rb +13 -0
  592. data/rails/actionview/lib/action_view/helpers/tags/number_field.rb +18 -0
  593. data/rails/actionview/lib/action_view/helpers/tags/password_field.rb +12 -0
  594. data/rails/actionview/lib/action_view/helpers/tags/placeholderable.rb +22 -0
  595. data/rails/actionview/lib/action_view/helpers/tags/radio_button.rb +31 -0
  596. data/rails/actionview/lib/action_view/helpers/tags/range_field.rb +8 -0
  597. data/rails/actionview/lib/action_view/helpers/tags/search_field.rb +22 -0
  598. data/rails/actionview/lib/action_view/helpers/tags/select.rb +41 -0
  599. data/rails/actionview/lib/action_view/helpers/tags/tel_field.rb +8 -0
  600. data/rails/actionview/lib/action_view/helpers/tags/text_area.rb +22 -0
  601. data/rails/actionview/lib/action_view/helpers/tags/text_field.rb +33 -0
  602. data/rails/actionview/lib/action_view/helpers/tags/time_field.rb +13 -0
  603. data/rails/actionview/lib/action_view/helpers/tags/time_select.rb +8 -0
  604. data/rails/actionview/lib/action_view/helpers/tags/time_zone_select.rb +20 -0
  605. data/rails/actionview/lib/action_view/helpers/tags/translator.rb +40 -0
  606. data/rails/actionview/lib/action_view/helpers/tags/url_field.rb +8 -0
  607. data/rails/actionview/lib/action_view/helpers/tags/week_field.rb +13 -0
  608. data/rails/actionview/lib/action_view/helpers/tags.rb +42 -0
  609. data/rails/actionview/lib/action_view/helpers/text_helper.rb +467 -0
  610. data/rails/actionview/lib/action_view/helpers/translation_helper.rb +106 -0
  611. data/rails/actionview/lib/action_view/helpers/url_helper.rb +620 -0
  612. data/rails/actionview/lib/action_view/helpers.rb +64 -0
  613. data/rails/actionview/lib/action_view/layouts.rb +426 -0
  614. data/rails/actionview/lib/action_view/locale/en.yml +56 -0
  615. data/rails/actionview/lib/action_view/log_subscriber.rb +44 -0
  616. data/rails/actionview/lib/action_view/lookup_context.rb +255 -0
  617. data/rails/actionview/lib/action_view/model_naming.rb +12 -0
  618. data/rails/actionview/lib/action_view/path_set.rb +77 -0
  619. data/rails/actionview/lib/action_view/railtie.rb +49 -0
  620. data/rails/actionview/lib/action_view/record_identifier.rb +84 -0
  621. data/rails/actionview/lib/action_view/renderer/abstract_renderer.rb +49 -0
  622. data/rails/actionview/lib/action_view/renderer/partial_renderer.rb +548 -0
  623. data/rails/actionview/lib/action_view/renderer/renderer.rb +50 -0
  624. data/rails/actionview/lib/action_view/renderer/streaming_template_renderer.rb +103 -0
  625. data/rails/actionview/lib/action_view/renderer/template_renderer.rb +101 -0
  626. data/rails/actionview/lib/action_view/rendering.rb +146 -0
  627. data/rails/actionview/lib/action_view/routing_url_for.rb +134 -0
  628. data/rails/actionview/lib/action_view/tasks/dependencies.rake +21 -0
  629. data/rails/actionview/lib/action_view/template/error.rb +141 -0
  630. data/rails/actionview/lib/action_view/template/handlers/builder.rb +26 -0
  631. data/rails/actionview/lib/action_view/template/handlers/erb.rb +145 -0
  632. data/rails/actionview/lib/action_view/template/handlers/raw.rb +11 -0
  633. data/rails/actionview/lib/action_view/template/handlers.rb +62 -0
  634. data/rails/actionview/lib/action_view/template/html.rb +34 -0
  635. data/rails/actionview/lib/action_view/template/resolver.rb +349 -0
  636. data/rails/actionview/lib/action_view/template/text.rb +34 -0
  637. data/rails/actionview/lib/action_view/template/types.rb +57 -0
  638. data/rails/actionview/lib/action_view/template.rb +336 -0
  639. data/rails/actionview/lib/action_view/test_case.rb +278 -0
  640. data/rails/actionview/lib/action_view/testing/resolvers.rb +54 -0
  641. data/rails/actionview/lib/action_view/version.rb +8 -0
  642. data/rails/actionview/lib/action_view/view_paths.rb +111 -0
  643. data/rails/actionview/lib/action_view.rb +96 -0
  644. data/rails/actionview/test/abstract_unit.rb +345 -0
  645. data/rails/actionview/test/actionpack/abstract/abstract_controller_test.rb +310 -0
  646. data/rails/actionview/test/actionpack/abstract/helper_test.rb +127 -0
  647. data/rails/actionview/test/actionpack/abstract/layouts_test.rb +384 -0
  648. data/rails/actionview/test/actionpack/abstract/render_test.rb +103 -0
  649. data/rails/actionview/test/actionpack/abstract/views/abstract_controller/testing/me3/formatted.html.erb +1 -0
  650. data/rails/actionview/test/actionpack/abstract/views/abstract_controller/testing/me3/index.erb +1 -0
  651. data/rails/actionview/test/actionpack/abstract/views/abstract_controller/testing/me4/index.erb +1 -0
  652. data/rails/actionview/test/actionpack/abstract/views/abstract_controller/testing/me5/index.erb +1 -0
  653. data/rails/actionview/test/actionpack/abstract/views/action_with_ivars.erb +1 -0
  654. data/rails/actionview/test/actionpack/abstract/views/helper_test.erb +1 -0
  655. data/rails/actionview/test/actionpack/abstract/views/index.erb +1 -0
  656. data/rails/actionview/test/actionpack/abstract/views/layouts/abstract_controller/testing/me4.erb +1 -0
  657. data/rails/actionview/test/actionpack/abstract/views/layouts/application.erb +1 -0
  658. data/rails/actionview/test/actionpack/abstract/views/naked_render.erb +1 -0
  659. data/rails/actionview/test/actionpack/controller/capture_test.rb +81 -0
  660. data/rails/actionview/test/actionpack/controller/layout_test.rb +269 -0
  661. data/rails/actionview/test/actionpack/controller/render_test.rb +1344 -0
  662. data/rails/actionview/test/actionpack/controller/view_paths_test.rb +174 -0
  663. data/rails/actionview/test/active_record_unit.rb +91 -0
  664. data/rails/actionview/test/activerecord/controller_runtime_test.rb +93 -0
  665. data/rails/actionview/test/activerecord/debug_helper_test.rb +8 -0
  666. data/rails/actionview/test/activerecord/form_helper_activerecord_test.rb +92 -0
  667. data/rails/actionview/test/activerecord/polymorphic_routes_test.rb +733 -0
  668. data/rails/actionview/test/activerecord/render_partial_with_record_identification_test.rb +210 -0
  669. data/rails/actionview/test/fixtures/_top_level_partial.html.erb +1 -0
  670. data/rails/actionview/test/fixtures/_top_level_partial_only.erb +1 -0
  671. data/rails/actionview/test/fixtures/actionpack/bad_customers/_bad_customer.html.erb +1 -0
  672. data/rails/actionview/test/fixtures/actionpack/customers/_customer.html.erb +1 -0
  673. data/rails/actionview/test/fixtures/actionpack/fun/games/_form.erb +1 -0
  674. data/rails/actionview/test/fixtures/actionpack/fun/games/hello_world.erb +1 -0
  675. data/rails/actionview/test/fixtures/actionpack/good_customers/_good_customer.html.erb +1 -0
  676. data/rails/actionview/test/fixtures/actionpack/hello.html +1 -0
  677. data/rails/actionview/test/fixtures/actionpack/layout_tests/alt/layouts/alt.erb +0 -0
  678. data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/controller_name_space/nested.erb +1 -0
  679. data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/item.erb +1 -0
  680. data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/layout_test.erb +1 -0
  681. data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/multiple_extensions.html.erb +1 -0
  682. data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/symlinked/symlinked_layout.erb +5 -0
  683. data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/third_party_template_library.mab +1 -0
  684. data/rails/actionview/test/fixtures/actionpack/layout_tests/views/goodbye.erb +1 -0
  685. data/rails/actionview/test/fixtures/actionpack/layout_tests/views/hello.erb +1 -0
  686. data/rails/actionview/test/fixtures/actionpack/layouts/_column.html.erb +2 -0
  687. data/rails/actionview/test/fixtures/actionpack/layouts/_customers.erb +1 -0
  688. data/rails/actionview/test/fixtures/actionpack/layouts/_partial_and_yield.erb +2 -0
  689. data/rails/actionview/test/fixtures/actionpack/layouts/_yield_only.erb +1 -0
  690. data/rails/actionview/test/fixtures/actionpack/layouts/_yield_with_params.erb +1 -0
  691. data/rails/actionview/test/fixtures/actionpack/layouts/block_with_layout.erb +3 -0
  692. data/rails/actionview/test/fixtures/actionpack/layouts/builder.builder +3 -0
  693. data/rails/actionview/test/fixtures/actionpack/layouts/partial_with_layout.erb +3 -0
  694. data/rails/actionview/test/fixtures/actionpack/layouts/standard.html.erb +1 -0
  695. data/rails/actionview/test/fixtures/actionpack/layouts/streaming.erb +4 -0
  696. data/rails/actionview/test/fixtures/actionpack/layouts/talk_from_action.erb +2 -0
  697. data/rails/actionview/test/fixtures/actionpack/layouts/with_html_partial.html.erb +1 -0
  698. data/rails/actionview/test/fixtures/actionpack/layouts/xhr.html.erb +2 -0
  699. data/rails/actionview/test/fixtures/actionpack/layouts/yield.erb +2 -0
  700. data/rails/actionview/test/fixtures/actionpack/layouts/yield_with_render_inline_inside.erb +2 -0
  701. data/rails/actionview/test/fixtures/actionpack/layouts/yield_with_render_partial_inside.erb +2 -0
  702. data/rails/actionview/test/fixtures/actionpack/quiz/questions/_question.html.erb +1 -0
  703. data/rails/actionview/test/fixtures/actionpack/shared.html.erb +1 -0
  704. data/rails/actionview/test/fixtures/actionpack/test/_changing_priority.html.erb +1 -0
  705. data/rails/actionview/test/fixtures/actionpack/test/_changing_priority.json.erb +1 -0
  706. data/rails/actionview/test/fixtures/actionpack/test/_counter.html.erb +1 -0
  707. data/rails/actionview/test/fixtures/actionpack/test/_customer.erb +1 -0
  708. data/rails/actionview/test/fixtures/actionpack/test/_customer_counter.erb +1 -0
  709. data/rails/actionview/test/fixtures/actionpack/test/_customer_counter_with_as.erb +1 -0
  710. data/rails/actionview/test/fixtures/actionpack/test/_customer_greeting.erb +1 -0
  711. data/rails/actionview/test/fixtures/actionpack/test/_customer_iteration.erb +1 -0
  712. data/rails/actionview/test/fixtures/actionpack/test/_customer_iteration_with_as.erb +1 -0
  713. data/rails/actionview/test/fixtures/actionpack/test/_customer_with_var.erb +1 -0
  714. data/rails/actionview/test/fixtures/actionpack/test/_directory/_partial_with_locales.html.erb +1 -0
  715. data/rails/actionview/test/fixtures/actionpack/test/_first_json_partial.json.erb +1 -0
  716. data/rails/actionview/test/fixtures/actionpack/test/_form.erb +1 -0
  717. data/rails/actionview/test/fixtures/actionpack/test/_hash_greeting.erb +1 -0
  718. data/rails/actionview/test/fixtures/actionpack/test/_hash_object.erb +2 -0
  719. data/rails/actionview/test/fixtures/actionpack/test/_hello.builder +1 -0
  720. data/rails/actionview/test/fixtures/actionpack/test/_json_change_priority.json.erb +0 -0
  721. data/rails/actionview/test/fixtures/actionpack/test/_labelling_form.erb +1 -0
  722. data/rails/actionview/test/fixtures/actionpack/test/_layout_for_partial.html.erb +3 -0
  723. data/rails/actionview/test/fixtures/actionpack/test/_partial.erb +1 -0
  724. data/rails/actionview/test/fixtures/actionpack/test/_partial.html.erb +1 -0
  725. data/rails/actionview/test/fixtures/actionpack/test/_partial.js.erb +1 -0
  726. data/rails/actionview/test/fixtures/actionpack/test/_partial_for_use_in_layout.html.erb +1 -0
  727. data/rails/actionview/test/fixtures/actionpack/test/_partial_html_erb.html.erb +1 -0
  728. data/rails/actionview/test/fixtures/actionpack/test/_partial_name_local_variable.erb +1 -0
  729. data/rails/actionview/test/fixtures/actionpack/test/_partial_only.erb +1 -0
  730. data/rails/actionview/test/fixtures/actionpack/test/_partial_only_html.html +1 -0
  731. data/rails/actionview/test/fixtures/actionpack/test/_partial_with_partial.erb +2 -0
  732. data/rails/actionview/test/fixtures/actionpack/test/_person.erb +2 -0
  733. data/rails/actionview/test/fixtures/actionpack/test/_raise_indentation.html.erb +13 -0
  734. data/rails/actionview/test/fixtures/actionpack/test/_second_json_partial.json.erb +1 -0
  735. data/rails/actionview/test/fixtures/actionpack/test/action_talk_to_layout.erb +2 -0
  736. data/rails/actionview/test/fixtures/actionpack/test/calling_partial_with_layout.html.erb +1 -0
  737. data/rails/actionview/test/fixtures/actionpack/test/capturing.erb +4 -0
  738. data/rails/actionview/test/fixtures/actionpack/test/change_priority.html.erb +2 -0
  739. data/rails/actionview/test/fixtures/actionpack/test/content_for.erb +1 -0
  740. data/rails/actionview/test/fixtures/actionpack/test/content_for_concatenated.erb +3 -0
  741. data/rails/actionview/test/fixtures/actionpack/test/content_for_with_parameter.erb +2 -0
  742. data/rails/actionview/test/fixtures/actionpack/test/dot.directory/render_file_with_ivar.erb +1 -0
  743. data/rails/actionview/test/fixtures/actionpack/test/formatted_html_erb.html.erb +1 -0
  744. data/rails/actionview/test/fixtures/actionpack/test/formatted_xml_erb.builder +1 -0
  745. data/rails/actionview/test/fixtures/actionpack/test/formatted_xml_erb.html.erb +1 -0
  746. data/rails/actionview/test/fixtures/actionpack/test/formatted_xml_erb.xml.erb +1 -0
  747. data/rails/actionview/test/fixtures/actionpack/test/greeting.html.erb +1 -0
  748. data/rails/actionview/test/fixtures/actionpack/test/greeting.xml.erb +1 -0
  749. data/rails/actionview/test/fixtures/actionpack/test/hello/hello.erb +1 -0
  750. data/rails/actionview/test/fixtures/actionpack/test/hello,world.erb +1 -0
  751. data/rails/actionview/test/fixtures/actionpack/test/hello.builder +4 -0
  752. data/rails/actionview/test/fixtures/actionpack/test/hello_world.erb +1 -0
  753. data/rails/actionview/test/fixtures/actionpack/test/hello_world_container.builder +3 -0
  754. data/rails/actionview/test/fixtures/actionpack/test/hello_world_from_rxml.builder +3 -0
  755. data/rails/actionview/test/fixtures/actionpack/test/hello_world_with_layout_false.erb +1 -0
  756. data/rails/actionview/test/fixtures/actionpack/test/hello_world_with_partial.html.erb +2 -0
  757. data/rails/actionview/test/fixtures/actionpack/test/hello_xml_world.builder +11 -0
  758. data/rails/actionview/test/fixtures/actionpack/test/html_template.html.erb +1 -0
  759. data/rails/actionview/test/fixtures/actionpack/test/hyphen-ated.erb +1 -0
  760. data/rails/actionview/test/fixtures/actionpack/test/implicit_content_type.atom.builder +2 -0
  761. data/rails/actionview/test/fixtures/actionpack/test/list.erb +1 -0
  762. data/rails/actionview/test/fixtures/actionpack/test/non_erb_block_content_for.builder +4 -0
  763. data/rails/actionview/test/fixtures/actionpack/test/potential_conflicts.erb +4 -0
  764. data/rails/actionview/test/fixtures/actionpack/test/proper_block_detection.erb +1 -0
  765. data/rails/actionview/test/fixtures/actionpack/test/render_file_from_template.html.erb +1 -0
  766. data/rails/actionview/test/fixtures/actionpack/test/render_file_with_ivar.erb +1 -0
  767. data/rails/actionview/test/fixtures/actionpack/test/render_file_with_locals.erb +1 -0
  768. data/rails/actionview/test/fixtures/actionpack/test/render_file_with_locals_and_default.erb +1 -0
  769. data/rails/actionview/test/fixtures/actionpack/test/render_implicit_html_template_from_xhr_request.da.html.erb +1 -0
  770. data/rails/actionview/test/fixtures/actionpack/test/render_implicit_html_template_from_xhr_request.html.erb +1 -0
  771. data/rails/actionview/test/fixtures/actionpack/test/render_implicit_js_template_without_layout.js.erb +1 -0
  772. data/rails/actionview/test/fixtures/actionpack/test/render_partial_inside_directory.html.erb +1 -0
  773. data/rails/actionview/test/fixtures/actionpack/test/render_to_string_test.erb +1 -0
  774. data/rails/actionview/test/fixtures/actionpack/test/render_two_partials.html.erb +2 -0
  775. data/rails/actionview/test/fixtures/actionpack/test/using_layout_around_block.html.erb +1 -0
  776. data/rails/actionview/test/fixtures/actionpack/test/with_html_partial.html.erb +1 -0
  777. data/rails/actionview/test/fixtures/actionpack/test/with_partial.html.erb +1 -0
  778. data/rails/actionview/test/fixtures/actionpack/test/with_partial.text.erb +1 -0
  779. data/rails/actionview/test/fixtures/actionpack/test/with_xml_template.html.erb +1 -0
  780. data/rails/actionview/test/fixtures/blog_public/.gitignore +1 -0
  781. data/rails/actionview/test/fixtures/blog_public/blog.html +1 -0
  782. data/rails/actionview/test/fixtures/blog_public/index.html +1 -0
  783. data/rails/actionview/test/fixtures/blog_public/subdir/index.html +1 -0
  784. data/rails/actionview/test/fixtures/comments/empty.de.html.erb +1 -0
  785. data/rails/actionview/test/fixtures/comments/empty.html.builder +1 -0
  786. data/rails/actionview/test/fixtures/comments/empty.html.erb +1 -0
  787. data/rails/actionview/test/fixtures/comments/empty.xml.erb +1 -0
  788. data/rails/actionview/test/fixtures/companies.yml +24 -0
  789. data/rails/actionview/test/fixtures/company.rb +9 -0
  790. data/rails/actionview/test/fixtures/custom_pattern/another.html.erb +1 -0
  791. data/rails/actionview/test/fixtures/custom_pattern/html/another.erb +1 -0
  792. data/rails/actionview/test/fixtures/custom_pattern/html/path.erb +1 -0
  793. data/rails/actionview/test/fixtures/customers/_customer.html.erb +1 -0
  794. data/rails/actionview/test/fixtures/customers/_customer.xml.erb +1 -0
  795. data/rails/actionview/test/fixtures/db_definitions/sqlite.sql +49 -0
  796. data/rails/actionview/test/fixtures/developer.rb +6 -0
  797. data/rails/actionview/test/fixtures/developers/_developer.erb +1 -0
  798. data/rails/actionview/test/fixtures/developers.yml +21 -0
  799. data/rails/actionview/test/fixtures/developers_projects.yml +13 -0
  800. data/rails/actionview/test/fixtures/digestor/comments/_comment.html.erb +1 -0
  801. data/rails/actionview/test/fixtures/digestor/comments/_comments.html.erb +1 -0
  802. data/rails/actionview/test/fixtures/digestor/events/_event.html.erb +0 -0
  803. data/rails/actionview/test/fixtures/digestor/level/_recursion.html.erb +1 -0
  804. data/rails/actionview/test/fixtures/digestor/level/below/_header.html.erb +0 -0
  805. data/rails/actionview/test/fixtures/digestor/level/below/index.html.erb +1 -0
  806. data/rails/actionview/test/fixtures/digestor/level/recursion.html.erb +1 -0
  807. data/rails/actionview/test/fixtures/digestor/messages/_form.html.erb +0 -0
  808. data/rails/actionview/test/fixtures/digestor/messages/_header.html.erb +0 -0
  809. data/rails/actionview/test/fixtures/digestor/messages/_message.html.erb +1 -0
  810. data/rails/actionview/test/fixtures/digestor/messages/actions/_move.html.erb +0 -0
  811. data/rails/actionview/test/fixtures/digestor/messages/edit.html.erb +5 -0
  812. data/rails/actionview/test/fixtures/digestor/messages/index.html.erb +2 -0
  813. data/rails/actionview/test/fixtures/digestor/messages/new.html+iphone.erb +15 -0
  814. data/rails/actionview/test/fixtures/digestor/messages/show.html.erb +14 -0
  815. data/rails/actionview/test/fixtures/fun/games/_game.erb +1 -0
  816. data/rails/actionview/test/fixtures/fun/games/hello_world.erb +1 -0
  817. data/rails/actionview/test/fixtures/fun/serious/games/_game.erb +1 -0
  818. data/rails/actionview/test/fixtures/functional_caching/fragment_cached_without_digest.html.erb +3 -0
  819. data/rails/actionview/test/fixtures/games/_game.erb +1 -0
  820. data/rails/actionview/test/fixtures/good_customers/_good_customer.html.erb +1 -0
  821. data/rails/actionview/test/fixtures/happy_path/render_action/hello_world.erb +1 -0
  822. data/rails/actionview/test/fixtures/helpers/abc_helper.rb +3 -0
  823. data/rails/actionview/test/fixtures/helpers/helpery_test_helper.rb +5 -0
  824. data/rails/actionview/test/fixtures/helpers_missing/invalid_require_helper.rb +5 -0
  825. data/rails/actionview/test/fixtures/layout_tests/alt/hello.erb +1 -0
  826. data/rails/actionview/test/fixtures/layouts/_column.html.erb +2 -0
  827. data/rails/actionview/test/fixtures/layouts/_customers.erb +1 -0
  828. data/rails/actionview/test/fixtures/layouts/_partial_and_yield.erb +2 -0
  829. data/rails/actionview/test/fixtures/layouts/_yield_only.erb +1 -0
  830. data/rails/actionview/test/fixtures/layouts/_yield_with_params.erb +1 -0
  831. data/rails/actionview/test/fixtures/layouts/streaming.erb +4 -0
  832. data/rails/actionview/test/fixtures/layouts/yield.erb +2 -0
  833. data/rails/actionview/test/fixtures/layouts/yield_with_render_inline_inside.erb +2 -0
  834. data/rails/actionview/test/fixtures/layouts/yield_with_render_partial_inside.erb +2 -0
  835. data/rails/actionview/test/fixtures/mascot.rb +3 -0
  836. data/rails/actionview/test/fixtures/mascots/_mascot.html.erb +1 -0
  837. data/rails/actionview/test/fixtures/mascots.yml +4 -0
  838. data/rails/actionview/test/fixtures/multipart/bracketed_utf8_param +5 -0
  839. data/rails/actionview/test/fixtures/multipart/single_utf8_param +5 -0
  840. data/rails/actionview/test/fixtures/override/test/hello_world.erb +1 -0
  841. data/rails/actionview/test/fixtures/override2/layouts/test/sub.erb +1 -0
  842. data/rails/actionview/test/fixtures/plain_text.raw +1 -0
  843. data/rails/actionview/test/fixtures/plain_text_with_characters.raw +1 -0
  844. data/rails/actionview/test/fixtures/project.rb +3 -0
  845. data/rails/actionview/test/fixtures/projects/_project.erb +1 -0
  846. data/rails/actionview/test/fixtures/projects.yml +7 -0
  847. data/rails/actionview/test/fixtures/public/.gitignore +1 -0
  848. data/rails/actionview/test/fixtures/public/elsewhere/cools.js +1 -0
  849. data/rails/actionview/test/fixtures/public/elsewhere/file.css +1 -0
  850. data/rails/actionview/test/fixtures/public/foo/baz.css +3 -0
  851. data/rails/actionview/test/fixtures/public/javascripts/application.js +1 -0
  852. data/rails/actionview/test/fixtures/public/javascripts/bank.js +1 -0
  853. data/rails/actionview/test/fixtures/public/javascripts/common.javascript +1 -0
  854. data/rails/actionview/test/fixtures/public/javascripts/controls.js +1 -0
  855. data/rails/actionview/test/fixtures/public/javascripts/dragdrop.js +1 -0
  856. data/rails/actionview/test/fixtures/public/javascripts/effects.js +1 -0
  857. data/rails/actionview/test/fixtures/public/javascripts/prototype.js +1 -0
  858. data/rails/actionview/test/fixtures/public/javascripts/robber.js +1 -0
  859. data/rails/actionview/test/fixtures/public/javascripts/subdir/subdir.js +1 -0
  860. data/rails/actionview/test/fixtures/public/javascripts/version.1.0.js +1 -0
  861. data/rails/actionview/test/fixtures/public/stylesheets/bank.css +1 -0
  862. data/rails/actionview/test/fixtures/public/stylesheets/random.styles +1 -0
  863. data/rails/actionview/test/fixtures/public/stylesheets/robber.css +1 -0
  864. data/rails/actionview/test/fixtures/public/stylesheets/subdir/subdir.css +1 -0
  865. data/rails/actionview/test/fixtures/public/stylesheets/version.1.0.css +1 -0
  866. data/rails/actionview/test/fixtures/replies/_reply.erb +1 -0
  867. data/rails/actionview/test/fixtures/replies.yml +15 -0
  868. data/rails/actionview/test/fixtures/reply.rb +7 -0
  869. data/rails/actionview/test/fixtures/respond_to/using_defaults_with_all.html.erb +1 -0
  870. data/rails/actionview/test/fixtures/ruby_template.ruby +2 -0
  871. data/rails/actionview/test/fixtures/scope/test/modgreet.erb +1 -0
  872. data/rails/actionview/test/fixtures/shared.html.erb +1 -0
  873. data/rails/actionview/test/fixtures/test/_200.html.erb +1 -0
  874. data/rails/actionview/test/fixtures/test/_b_layout_for_partial.html.erb +1 -0
  875. data/rails/actionview/test/fixtures/test/_b_layout_for_partial_with_object.html.erb +1 -0
  876. data/rails/actionview/test/fixtures/test/_b_layout_for_partial_with_object_counter.html.erb +1 -0
  877. data/rails/actionview/test/fixtures/test/_changing_priority.html.erb +1 -0
  878. data/rails/actionview/test/fixtures/test/_changing_priority.json.erb +1 -0
  879. data/rails/actionview/test/fixtures/test/_content_tag_nested_in_content_tag.erb +3 -0
  880. data/rails/actionview/test/fixtures/test/_counter.html.erb +1 -0
  881. data/rails/actionview/test/fixtures/test/_customer.erb +1 -0
  882. data/rails/actionview/test/fixtures/test/_customer_greeting.erb +1 -0
  883. data/rails/actionview/test/fixtures/test/_customer_with_var.erb +1 -0
  884. data/rails/actionview/test/fixtures/test/_directory/_partial_with_locales.html.erb +1 -0
  885. data/rails/actionview/test/fixtures/test/_first_json_partial.json.erb +1 -0
  886. data/rails/actionview/test/fixtures/test/_from_helper.erb +1 -0
  887. data/rails/actionview/test/fixtures/test/_json_change_priority.json.erb +0 -0
  888. data/rails/actionview/test/fixtures/test/_label_with_block.erb +4 -0
  889. data/rails/actionview/test/fixtures/test/_layout_for_block_with_args.html.erb +3 -0
  890. data/rails/actionview/test/fixtures/test/_layout_for_partial.html.erb +3 -0
  891. data/rails/actionview/test/fixtures/test/_layout_with_partial_and_yield.html.erb +4 -0
  892. data/rails/actionview/test/fixtures/test/_local_inspector.html.erb +1 -0
  893. data/rails/actionview/test/fixtures/test/_object_inspector.erb +1 -0
  894. data/rails/actionview/test/fixtures/test/_one.html.erb +1 -0
  895. data/rails/actionview/test/fixtures/test/_partial.erb +1 -0
  896. data/rails/actionview/test/fixtures/test/_partial.html.erb +1 -0
  897. data/rails/actionview/test/fixtures/test/_partial.js.erb +1 -0
  898. data/rails/actionview/test/fixtures/test/_partial_for_use_in_layout.html.erb +1 -0
  899. data/rails/actionview/test/fixtures/test/_partial_name_local_variable.erb +1 -0
  900. data/rails/actionview/test/fixtures/test/_partial_only.erb +1 -0
  901. data/rails/actionview/test/fixtures/test/_partial_with_layout.erb +2 -0
  902. data/rails/actionview/test/fixtures/test/_partial_with_layout_block_content.erb +4 -0
  903. data/rails/actionview/test/fixtures/test/_partial_with_layout_block_partial.erb +4 -0
  904. data/rails/actionview/test/fixtures/test/_partial_with_only_html_version.html.erb +1 -0
  905. data/rails/actionview/test/fixtures/test/_partial_with_partial.erb +2 -0
  906. data/rails/actionview/test/fixtures/test/_raise.html.erb +1 -0
  907. data/rails/actionview/test/fixtures/test/_raise_indentation.html.erb +13 -0
  908. data/rails/actionview/test/fixtures/test/_second_json_partial.json.erb +1 -0
  909. data/rails/actionview/test/fixtures/test/_two.html.erb +1 -0
  910. data/rails/actionview/test/fixtures/test/_utf8_partial.html.erb +1 -0
  911. data/rails/actionview/test/fixtures/test/_utf8_partial_magic.html.erb +2 -0
  912. data/rails/actionview/test/fixtures/test/basic.html.erb +1 -0
  913. data/rails/actionview/test/fixtures/test/calling_partial_with_layout.html.erb +1 -0
  914. data/rails/actionview/test/fixtures/test/change_priority.html.erb +2 -0
  915. data/rails/actionview/test/fixtures/test/dont_pick_me +1 -0
  916. data/rails/actionview/test/fixtures/test/dot.directory/render_file_with_ivar.erb +1 -0
  917. data/rails/actionview/test/fixtures/test/greeting.xml.erb +1 -0
  918. data/rails/actionview/test/fixtures/test/hello/hello.erb +1 -0
  919. data/rails/actionview/test/fixtures/test/hello.builder +4 -0
  920. data/rails/actionview/test/fixtures/test/hello_world.da.html.erb +1 -0
  921. data/rails/actionview/test/fixtures/test/hello_world.erb +1 -0
  922. data/rails/actionview/test/fixtures/test/hello_world.erb~ +1 -0
  923. data/rails/actionview/test/fixtures/test/hello_world.html+phone.erb +1 -0
  924. data/rails/actionview/test/fixtures/test/hello_world.pt-BR.html.erb +1 -0
  925. data/rails/actionview/test/fixtures/test/hello_world.text+phone.erb +1 -0
  926. data/rails/actionview/test/fixtures/test/hello_world_with_partial.html.erb +2 -0
  927. data/rails/actionview/test/fixtures/test/html_template.html.erb +1 -0
  928. data/rails/actionview/test/fixtures/test/layout_render_file.erb +2 -0
  929. data/rails/actionview/test/fixtures/test/layout_render_object.erb +1 -0
  930. data/rails/actionview/test/fixtures/test/list.erb +1 -0
  931. data/rails/actionview/test/fixtures/test/malformed/malformed.en.html.erb~ +1 -0
  932. data/rails/actionview/test/fixtures/test/malformed/malformed.erb~ +1 -0
  933. data/rails/actionview/test/fixtures/test/malformed/malformed.html.erb~ +1 -0
  934. data/rails/actionview/test/fixtures/test/malformed/malformed~ +1 -0
  935. data/rails/actionview/test/fixtures/test/nested_layout.erb +3 -0
  936. data/rails/actionview/test/fixtures/test/nested_streaming.erb +3 -0
  937. data/rails/actionview/test/fixtures/test/nil_return.erb +1 -0
  938. data/rails/actionview/test/fixtures/test/one.html.erb +1 -0
  939. data/rails/actionview/test/fixtures/test/render_file_with_ivar.erb +1 -0
  940. data/rails/actionview/test/fixtures/test/render_file_with_locals.erb +1 -0
  941. data/rails/actionview/test/fixtures/test/render_file_with_locals_and_default.erb +1 -0
  942. data/rails/actionview/test/fixtures/test/render_partial_inside_directory.html.erb +1 -0
  943. data/rails/actionview/test/fixtures/test/render_two_partials.html.erb +2 -0
  944. data/rails/actionview/test/fixtures/test/streaming.erb +3 -0
  945. data/rails/actionview/test/fixtures/test/streaming_buster.erb +3 -0
  946. data/rails/actionview/test/fixtures/test/sub_template_raise.html.erb +1 -0
  947. data/rails/actionview/test/fixtures/test/template.erb +1 -0
  948. data/rails/actionview/test/fixtures/test/update_element_with_capture.erb +9 -0
  949. data/rails/actionview/test/fixtures/test/utf8.html.erb +4 -0
  950. data/rails/actionview/test/fixtures/test/utf8_magic.html.erb +5 -0
  951. data/rails/actionview/test/fixtures/test/utf8_magic_with_bare_partial.html.erb +5 -0
  952. data/rails/actionview/test/fixtures/topic.rb +3 -0
  953. data/rails/actionview/test/fixtures/topics/_topic.html.erb +1 -0
  954. data/rails/actionview/test/fixtures/topics.yml +22 -0
  955. data/rails/actionview/test/fixtures/translations/templates/array.erb +1 -0
  956. data/rails/actionview/test/fixtures/translations/templates/default.erb +1 -0
  957. data/rails/actionview/test/fixtures/translations/templates/found.erb +1 -0
  958. data/rails/actionview/test/fixtures/translations/templates/missing.erb +1 -0
  959. data/rails/actionview/test/fixtures/with_format.json.erb +1 -0
  960. data/rails/actionview/test/lib/controller/fake_models.rb +201 -0
  961. data/rails/actionview/test/template/active_model_helper_test.rb +99 -0
  962. data/rails/actionview/test/template/asset_tag_helper_test.rb +796 -0
  963. data/rails/actionview/test/template/atom_feed_helper_test.rb +349 -0
  964. data/rails/actionview/test/template/capture_helper_test.rb +219 -0
  965. data/rails/actionview/test/template/compiled_templates_test.rb +59 -0
  966. data/rails/actionview/test/template/date_helper_i18n_test.rb +148 -0
  967. data/rails/actionview/test/template/date_helper_test.rb +3228 -0
  968. data/rails/actionview/test/template/dependency_tracker_test.rb +196 -0
  969. data/rails/actionview/test/template/digestor_test.rb +312 -0
  970. data/rails/actionview/test/template/erb/form_for_test.rb +11 -0
  971. data/rails/actionview/test/template/erb/helper.rb +24 -0
  972. data/rails/actionview/test/template/erb/tag_helper_test.rb +30 -0
  973. data/rails/actionview/test/template/erb_util_test.rb +107 -0
  974. data/rails/actionview/test/template/form_collections_helper_test.rb +459 -0
  975. data/rails/actionview/test/template/form_helper_test.rb +3461 -0
  976. data/rails/actionview/test/template/form_options_helper_i18n_test.rb +27 -0
  977. data/rails/actionview/test/template/form_options_helper_test.rb +1358 -0
  978. data/rails/actionview/test/template/form_tag_helper_test.rb +656 -0
  979. data/rails/actionview/test/template/html_test.rb +17 -0
  980. data/rails/actionview/test/template/javascript_helper_test.rb +69 -0
  981. data/rails/actionview/test/template/log_subscriber_test.rb +91 -0
  982. data/rails/actionview/test/template/lookup_context_test.rb +282 -0
  983. data/rails/actionview/test/template/number_helper_test.rb +197 -0
  984. data/rails/actionview/test/template/output_safety_helper_test.rb +35 -0
  985. data/rails/actionview/test/template/partial_iteration_test.rb +33 -0
  986. data/rails/actionview/test/template/record_identifier_test.rb +49 -0
  987. data/rails/actionview/test/template/record_tag_helper_test.rb +117 -0
  988. data/rails/actionview/test/template/render_test.rb +600 -0
  989. data/rails/actionview/test/template/resolver_patterns_test.rb +31 -0
  990. data/rails/actionview/test/template/sanitize_helper_test.rb +35 -0
  991. data/rails/actionview/test/template/streaming_render_test.rb +108 -0
  992. data/rails/actionview/test/template/tag_helper_test.rb +166 -0
  993. data/rails/actionview/test/template/template_error_test.rb +20 -0
  994. data/rails/actionview/test/template/template_test.rb +200 -0
  995. data/rails/actionview/test/template/test_case_test.rb +378 -0
  996. data/rails/actionview/test/template/test_test.rb +92 -0
  997. data/rails/actionview/test/template/testing/fixture_resolver_test.rb +18 -0
  998. data/rails/actionview/test/template/testing/null_resolver_test.rb +12 -0
  999. data/rails/actionview/test/template/text_helper_test.rb +510 -0
  1000. data/rails/actionview/test/template/text_test.rb +17 -0
  1001. data/rails/actionview/test/template/translation_helper_test.rb +193 -0
  1002. data/rails/actionview/test/template/url_helper_test.rb +798 -0
  1003. data/rails/actionview/test/tmp/.gitkeep +0 -0
  1004. data/rails/activejob/.gitignore +1 -0
  1005. data/rails/activejob/CHANGELOG.md +7 -0
  1006. data/rails/activejob/MIT-LICENSE +21 -0
  1007. data/rails/activejob/README.md +131 -0
  1008. data/rails/activejob/Rakefile +90 -0
  1009. data/rails/activejob/activejob.gemspec +23 -0
  1010. data/rails/activejob/lib/active_job/arguments.rb +144 -0
  1011. data/rails/activejob/lib/active_job/base.rb +66 -0
  1012. data/rails/activejob/lib/active_job/callbacks.rb +146 -0
  1013. data/rails/activejob/lib/active_job/configured_job.rb +16 -0
  1014. data/rails/activejob/lib/active_job/core.rb +88 -0
  1015. data/rails/activejob/lib/active_job/enqueuing.rb +77 -0
  1016. data/rails/activejob/lib/active_job/execution.rb +42 -0
  1017. data/rails/activejob/lib/active_job/gem_version.rb +15 -0
  1018. data/rails/activejob/lib/active_job/logging.rb +107 -0
  1019. data/rails/activejob/lib/active_job/queue_adapter.rb +35 -0
  1020. data/rails/activejob/lib/active_job/queue_adapters/backburner_adapter.rb +36 -0
  1021. data/rails/activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb +39 -0
  1022. data/rails/activejob/lib/active_job/queue_adapters/inline_adapter.rb +23 -0
  1023. data/rails/activejob/lib/active_job/queue_adapters/qu_adapter.rb +42 -0
  1024. data/rails/activejob/lib/active_job/queue_adapters/que_adapter.rb +35 -0
  1025. data/rails/activejob/lib/active_job/queue_adapters/queue_classic_adapter.rb +54 -0
  1026. data/rails/activejob/lib/active_job/queue_adapters/resque_adapter.rb +52 -0
  1027. data/rails/activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb +45 -0
  1028. data/rails/activejob/lib/active_job/queue_adapters/sneakers_adapter.rb +46 -0
  1029. data/rails/activejob/lib/active_job/queue_adapters/sucker_punch_adapter.rb +40 -0
  1030. data/rails/activejob/lib/active_job/queue_adapters/test_adapter.rb +51 -0
  1031. data/rails/activejob/lib/active_job/queue_adapters.rb +52 -0
  1032. data/rails/activejob/lib/active_job/queue_name.rb +51 -0
  1033. data/rails/activejob/lib/active_job/railtie.rb +23 -0
  1034. data/rails/activejob/lib/active_job/test_case.rb +7 -0
  1035. data/rails/activejob/lib/active_job/test_helper.rb +230 -0
  1036. data/rails/activejob/lib/active_job/version.rb +8 -0
  1037. data/rails/activejob/lib/active_job.rb +37 -0
  1038. data/rails/activejob/lib/rails/generators/job/job_generator.rb +24 -0
  1039. data/rails/activejob/lib/rails/generators/job/templates/job.rb +9 -0
  1040. data/rails/activejob/test/adapters/backburner.rb +3 -0
  1041. data/rails/activejob/test/adapters/delayed_job.rb +7 -0
  1042. data/rails/activejob/test/adapters/inline.rb +1 -0
  1043. data/rails/activejob/test/adapters/qu.rb +3 -0
  1044. data/rails/activejob/test/adapters/que.rb +4 -0
  1045. data/rails/activejob/test/adapters/queue_classic.rb +2 -0
  1046. data/rails/activejob/test/adapters/resque.rb +2 -0
  1047. data/rails/activejob/test/adapters/sidekiq.rb +2 -0
  1048. data/rails/activejob/test/adapters/sneakers.rb +2 -0
  1049. data/rails/activejob/test/adapters/sucker_punch.rb +2 -0
  1050. data/rails/activejob/test/adapters/test.rb +3 -0
  1051. data/rails/activejob/test/cases/adapter_test.rb +7 -0
  1052. data/rails/activejob/test/cases/argument_serialization_test.rb +105 -0
  1053. data/rails/activejob/test/cases/callbacks_test.rb +23 -0
  1054. data/rails/activejob/test/cases/job_serialization_test.rb +15 -0
  1055. data/rails/activejob/test/cases/logging_test.rb +114 -0
  1056. data/rails/activejob/test/cases/queue_naming_test.rb +102 -0
  1057. data/rails/activejob/test/cases/queuing_test.rb +44 -0
  1058. data/rails/activejob/test/cases/rescue_test.rb +34 -0
  1059. data/rails/activejob/test/cases/test_case_test.rb +14 -0
  1060. data/rails/activejob/test/cases/test_helper_test.rb +265 -0
  1061. data/rails/activejob/test/helper.rb +30 -0
  1062. data/rails/activejob/test/integration/queuing_test.rb +47 -0
  1063. data/rails/activejob/test/jobs/callback_job.rb +29 -0
  1064. data/rails/activejob/test/jobs/gid_job.rb +8 -0
  1065. data/rails/activejob/test/jobs/hello_job.rb +7 -0
  1066. data/rails/activejob/test/jobs/kwargs_job.rb +7 -0
  1067. data/rails/activejob/test/jobs/logging_job.rb +10 -0
  1068. data/rails/activejob/test/jobs/nested_job.rb +10 -0
  1069. data/rails/activejob/test/jobs/rescue_job.rb +27 -0
  1070. data/rails/activejob/test/models/person.rb +20 -0
  1071. data/rails/activejob/test/support/backburner/inline.rb +8 -0
  1072. data/rails/activejob/test/support/delayed_job/delayed/backend/test.rb +113 -0
  1073. data/rails/activejob/test/support/delayed_job/delayed/serialization/test.rb +0 -0
  1074. data/rails/activejob/test/support/integration/adapters/backburner.rb +38 -0
  1075. data/rails/activejob/test/support/integration/adapters/delayed_job.rb +20 -0
  1076. data/rails/activejob/test/support/integration/adapters/inline.rb +15 -0
  1077. data/rails/activejob/test/support/integration/adapters/qu.rb +38 -0
  1078. data/rails/activejob/test/support/integration/adapters/que.rb +37 -0
  1079. data/rails/activejob/test/support/integration/adapters/queue_classic.rb +39 -0
  1080. data/rails/activejob/test/support/integration/adapters/resque.rb +49 -0
  1081. data/rails/activejob/test/support/integration/adapters/sidekiq.rb +57 -0
  1082. data/rails/activejob/test/support/integration/adapters/sneakers.rb +90 -0
  1083. data/rails/activejob/test/support/integration/adapters/sucker_punch.rb +6 -0
  1084. data/rails/activejob/test/support/integration/dummy_app_template.rb +27 -0
  1085. data/rails/activejob/test/support/integration/helper.rb +30 -0
  1086. data/rails/activejob/test/support/integration/jobs_manager.rb +27 -0
  1087. data/rails/activejob/test/support/integration/test_case_helpers.rb +48 -0
  1088. data/rails/activejob/test/support/job_buffer.rb +19 -0
  1089. data/rails/activejob/test/support/que/inline.rb +9 -0
  1090. data/rails/activejob/test/support/queue_classic/inline.rb +23 -0
  1091. data/rails/activejob/test/support/sneakers/inline.rb +12 -0
  1092. data/rails/activemodel/CHANGELOG.md +61 -0
  1093. data/rails/activemodel/MIT-LICENSE +21 -0
  1094. data/rails/activemodel/README.rdoc +272 -0
  1095. data/rails/activemodel/Rakefile +36 -0
  1096. data/rails/activemodel/activemodel.gemspec +24 -0
  1097. data/rails/activemodel/lib/active_model/attribute_methods.rb +478 -0
  1098. data/rails/activemodel/lib/active_model/callbacks.rb +149 -0
  1099. data/rails/activemodel/lib/active_model/conversion.rb +100 -0
  1100. data/rails/activemodel/lib/active_model/dirty.rb +267 -0
  1101. data/rails/activemodel/lib/active_model/errors.rb +475 -0
  1102. data/rails/activemodel/lib/active_model/forbidden_attributes_protection.rb +28 -0
  1103. data/rails/activemodel/lib/active_model/gem_version.rb +15 -0
  1104. data/rails/activemodel/lib/active_model/lint.rb +113 -0
  1105. data/rails/activemodel/lib/active_model/locale/en.yml +35 -0
  1106. data/rails/activemodel/lib/active_model/model.rb +99 -0
  1107. data/rails/activemodel/lib/active_model/naming.rb +316 -0
  1108. data/rails/activemodel/lib/active_model/railtie.rb +12 -0
  1109. data/rails/activemodel/lib/active_model/secure_password.rb +134 -0
  1110. data/rails/activemodel/lib/active_model/serialization.rb +163 -0
  1111. data/rails/activemodel/lib/active_model/serializers/json.rb +145 -0
  1112. data/rails/activemodel/lib/active_model/serializers/xml.rb +238 -0
  1113. data/rails/activemodel/lib/active_model/test_case.rb +4 -0
  1114. data/rails/activemodel/lib/active_model/translation.rb +69 -0
  1115. data/rails/activemodel/lib/active_model/validations/absence.rb +31 -0
  1116. data/rails/activemodel/lib/active_model/validations/acceptance.rb +55 -0
  1117. data/rails/activemodel/lib/active_model/validations/callbacks.rb +117 -0
  1118. data/rails/activemodel/lib/active_model/validations/clusivity.rb +51 -0
  1119. data/rails/activemodel/lib/active_model/validations/confirmation.rb +67 -0
  1120. data/rails/activemodel/lib/active_model/validations/exclusion.rb +46 -0
  1121. data/rails/activemodel/lib/active_model/validations/format.rb +113 -0
  1122. data/rails/activemodel/lib/active_model/validations/inclusion.rb +46 -0
  1123. data/rails/activemodel/lib/active_model/validations/length.rb +126 -0
  1124. data/rails/activemodel/lib/active_model/validations/numericality.rb +159 -0
  1125. data/rails/activemodel/lib/active_model/validations/presence.rb +39 -0
  1126. data/rails/activemodel/lib/active_model/validations/validates.rb +173 -0
  1127. data/rails/activemodel/lib/active_model/validations/with.rb +153 -0
  1128. data/rails/activemodel/lib/active_model/validations.rb +401 -0
  1129. data/rails/activemodel/lib/active_model/validator.rb +182 -0
  1130. data/rails/activemodel/lib/active_model/version.rb +8 -0
  1131. data/rails/activemodel/lib/active_model.rb +71 -0
  1132. data/rails/activemodel/test/cases/attribute_methods_test.rb +281 -0
  1133. data/rails/activemodel/test/cases/callbacks_test.rb +114 -0
  1134. data/rails/activemodel/test/cases/conversion_test.rb +50 -0
  1135. data/rails/activemodel/test/cases/dirty_test.rb +228 -0
  1136. data/rails/activemodel/test/cases/errors_test.rb +326 -0
  1137. data/rails/activemodel/test/cases/forbidden_attributes_protection_test.rb +36 -0
  1138. data/rails/activemodel/test/cases/helper.rb +20 -0
  1139. data/rails/activemodel/test/cases/lint_test.rb +20 -0
  1140. data/rails/activemodel/test/cases/model_test.rb +75 -0
  1141. data/rails/activemodel/test/cases/naming_test.rb +280 -0
  1142. data/rails/activemodel/test/cases/railtie_test.rb +32 -0
  1143. data/rails/activemodel/test/cases/secure_password_test.rb +218 -0
  1144. data/rails/activemodel/test/cases/serialization_test.rb +168 -0
  1145. data/rails/activemodel/test/cases/serializers/json_serialization_test.rb +198 -0
  1146. data/rails/activemodel/test/cases/serializers/xml_serialization_test.rb +250 -0
  1147. data/rails/activemodel/test/cases/translation_test.rb +108 -0
  1148. data/rails/activemodel/test/cases/validations/absence_validation_test.rb +68 -0
  1149. data/rails/activemodel/test/cases/validations/acceptance_validation_test.rb +68 -0
  1150. data/rails/activemodel/test/cases/validations/callbacks_test.rb +98 -0
  1151. data/rails/activemodel/test/cases/validations/conditional_validation_test.rb +139 -0
  1152. data/rails/activemodel/test/cases/validations/confirmation_validation_test.rb +108 -0
  1153. data/rails/activemodel/test/cases/validations/exclusion_validation_test.rb +92 -0
  1154. data/rails/activemodel/test/cases/validations/format_validation_test.rb +149 -0
  1155. data/rails/activemodel/test/cases/validations/i18n_generate_message_validation_test.rb +150 -0
  1156. data/rails/activemodel/test/cases/validations/i18n_validation_test.rb +373 -0
  1157. data/rails/activemodel/test/cases/validations/inclusion_validation_test.rb +147 -0
  1158. data/rails/activemodel/test/cases/validations/length_validation_test.rb +424 -0
  1159. data/rails/activemodel/test/cases/validations/numericality_validation_test.rb +211 -0
  1160. data/rails/activemodel/test/cases/validations/presence_validation_test.rb +107 -0
  1161. data/rails/activemodel/test/cases/validations/validates_test.rb +158 -0
  1162. data/rails/activemodel/test/cases/validations/validations_context_test.rb +50 -0
  1163. data/rails/activemodel/test/cases/validations/with_validation_test.rb +172 -0
  1164. data/rails/activemodel/test/cases/validations_test.rb +429 -0
  1165. data/rails/activemodel/test/config.rb +3 -0
  1166. data/rails/activemodel/test/models/account.rb +5 -0
  1167. data/rails/activemodel/test/models/blog_post.rb +9 -0
  1168. data/rails/activemodel/test/models/contact.rb +41 -0
  1169. data/rails/activemodel/test/models/custom_reader.rb +15 -0
  1170. data/rails/activemodel/test/models/helicopter.rb +7 -0
  1171. data/rails/activemodel/test/models/person.rb +17 -0
  1172. data/rails/activemodel/test/models/person_with_validator.rb +24 -0
  1173. data/rails/activemodel/test/models/project.rb +3 -0
  1174. data/rails/activemodel/test/models/reply.rb +32 -0
  1175. data/rails/activemodel/test/models/sheep.rb +3 -0
  1176. data/rails/activemodel/test/models/topic.rb +40 -0
  1177. data/rails/activemodel/test/models/track_back.rb +11 -0
  1178. data/rails/activemodel/test/models/user.rb +10 -0
  1179. data/rails/activemodel/test/models/visitor.rb +10 -0
  1180. data/rails/activemodel/test/validators/email_validator.rb +6 -0
  1181. data/rails/activemodel/test/validators/namespace/email_validator.rb +6 -0
  1182. data/rails/activerecord/CHANGELOG.md +1568 -0
  1183. data/rails/activerecord/MIT-LICENSE +20 -0
  1184. data/rails/activerecord/README.rdoc +218 -0
  1185. data/rails/activerecord/RUNNING_UNIT_TESTS.rdoc +44 -0
  1186. data/rails/activerecord/Rakefile +168 -0
  1187. data/rails/activerecord/activerecord.gemspec +28 -0
  1188. data/rails/activerecord/examples/.gitignore +1 -0
  1189. data/rails/activerecord/examples/performance.rb +184 -0
  1190. data/rails/activerecord/examples/simple.rb +14 -0
  1191. data/rails/activerecord/lib/active_record/aggregations.rb +266 -0
  1192. data/rails/activerecord/lib/active_record/association_relation.rb +22 -0
  1193. data/rails/activerecord/lib/active_record/associations/alias_tracker.rb +87 -0
  1194. data/rails/activerecord/lib/active_record/associations/association.rb +253 -0
  1195. data/rails/activerecord/lib/active_record/associations/association_scope.rb +194 -0
  1196. data/rails/activerecord/lib/active_record/associations/belongs_to_association.rb +115 -0
  1197. data/rails/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +40 -0
  1198. data/rails/activerecord/lib/active_record/associations/builder/association.rb +149 -0
  1199. data/rails/activerecord/lib/active_record/associations/builder/belongs_to.rb +116 -0
  1200. data/rails/activerecord/lib/active_record/associations/builder/collection_association.rb +95 -0
  1201. data/rails/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb +124 -0
  1202. data/rails/activerecord/lib/active_record/associations/builder/has_many.rb +15 -0
  1203. data/rails/activerecord/lib/active_record/associations/builder/has_one.rb +23 -0
  1204. data/rails/activerecord/lib/active_record/associations/builder/singular_association.rb +38 -0
  1205. data/rails/activerecord/lib/active_record/associations/collection_association.rb +639 -0
  1206. data/rails/activerecord/lib/active_record/associations/collection_proxy.rb +1028 -0
  1207. data/rails/activerecord/lib/active_record/associations/foreign_association.rb +11 -0
  1208. data/rails/activerecord/lib/active_record/associations/has_many_association.rb +192 -0
  1209. data/rails/activerecord/lib/active_record/associations/has_many_through_association.rb +238 -0
  1210. data/rails/activerecord/lib/active_record/associations/has_one_association.rb +106 -0
  1211. data/rails/activerecord/lib/active_record/associations/has_one_through_association.rb +36 -0
  1212. data/rails/activerecord/lib/active_record/associations/join_dependency/join_association.rb +122 -0
  1213. data/rails/activerecord/lib/active_record/associations/join_dependency/join_base.rb +22 -0
  1214. data/rails/activerecord/lib/active_record/associations/join_dependency/join_part.rb +71 -0
  1215. data/rails/activerecord/lib/active_record/associations/join_dependency.rb +282 -0
  1216. data/rails/activerecord/lib/active_record/associations/preloader/association.rb +162 -0
  1217. data/rails/activerecord/lib/active_record/associations/preloader/belongs_to.rb +17 -0
  1218. data/rails/activerecord/lib/active_record/associations/preloader/collection_association.rb +24 -0
  1219. data/rails/activerecord/lib/active_record/associations/preloader/has_many.rb +17 -0
  1220. data/rails/activerecord/lib/active_record/associations/preloader/has_many_through.rb +19 -0
  1221. data/rails/activerecord/lib/active_record/associations/preloader/has_one.rb +23 -0
  1222. data/rails/activerecord/lib/active_record/associations/preloader/has_one_through.rb +9 -0
  1223. data/rails/activerecord/lib/active_record/associations/preloader/singular_association.rb +21 -0
  1224. data/rails/activerecord/lib/active_record/associations/preloader/through_association.rb +96 -0
  1225. data/rails/activerecord/lib/active_record/associations/preloader.rb +203 -0
  1226. data/rails/activerecord/lib/active_record/associations/singular_association.rb +86 -0
  1227. data/rails/activerecord/lib/active_record/associations/through_association.rb +107 -0
  1228. data/rails/activerecord/lib/active_record/associations.rb +1725 -0
  1229. data/rails/activerecord/lib/active_record/attribute.rb +163 -0
  1230. data/rails/activerecord/lib/active_record/attribute_assignment.rb +212 -0
  1231. data/rails/activerecord/lib/active_record/attribute_decorators.rb +66 -0
  1232. data/rails/activerecord/lib/active_record/attribute_methods/before_type_cast.rb +76 -0
  1233. data/rails/activerecord/lib/active_record/attribute_methods/dirty.rb +185 -0
  1234. data/rails/activerecord/lib/active_record/attribute_methods/primary_key.rb +128 -0
  1235. data/rails/activerecord/lib/active_record/attribute_methods/query.rb +40 -0
  1236. data/rails/activerecord/lib/active_record/attribute_methods/read.rb +103 -0
  1237. data/rails/activerecord/lib/active_record/attribute_methods/serialization.rb +70 -0
  1238. data/rails/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +69 -0
  1239. data/rails/activerecord/lib/active_record/attribute_methods/write.rb +83 -0
  1240. data/rails/activerecord/lib/active_record/attribute_methods.rb +439 -0
  1241. data/rails/activerecord/lib/active_record/attribute_set/builder.rb +96 -0
  1242. data/rails/activerecord/lib/active_record/attribute_set.rb +77 -0
  1243. data/rails/activerecord/lib/active_record/attributes.rb +146 -0
  1244. data/rails/activerecord/lib/active_record/autosave_association.rb +454 -0
  1245. data/rails/activerecord/lib/active_record/base.rb +317 -0
  1246. data/rails/activerecord/lib/active_record/callbacks.rb +313 -0
  1247. data/rails/activerecord/lib/active_record/coders/json.rb +13 -0
  1248. data/rails/activerecord/lib/active_record/coders/yaml_column.rb +38 -0
  1249. data/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +661 -0
  1250. data/rails/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb +67 -0
  1251. data/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +384 -0
  1252. data/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +95 -0
  1253. data/rails/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +133 -0
  1254. data/rails/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb +21 -0
  1255. data/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb +125 -0
  1256. data/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +592 -0
  1257. data/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb +50 -0
  1258. data/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +1023 -0
  1259. data/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +219 -0
  1260. data/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +494 -0
  1261. data/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +905 -0
  1262. data/rails/activerecord/lib/active_record/connection_adapters/column.rb +82 -0
  1263. data/rails/activerecord/lib/active_record/connection_adapters/connection_specification.rb +275 -0
  1264. data/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb +282 -0
  1265. data/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +491 -0
  1266. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/array_parser.rb +93 -0
  1267. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/column.rb +20 -0
  1268. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb +232 -0
  1269. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb +99 -0
  1270. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit.rb +52 -0
  1271. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb +13 -0
  1272. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +15 -0
  1273. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +46 -0
  1274. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/date.rb +11 -0
  1275. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +36 -0
  1276. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/decimal.rb +13 -0
  1277. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/enum.rb +17 -0
  1278. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/float.rb +21 -0
  1279. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +59 -0
  1280. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/inet.rb +13 -0
  1281. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/infinity.rb +13 -0
  1282. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/integer.rb +11 -0
  1283. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb +35 -0
  1284. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +23 -0
  1285. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb +43 -0
  1286. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb +43 -0
  1287. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rb +79 -0
  1288. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +19 -0
  1289. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/time.rb +11 -0
  1290. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +97 -0
  1291. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +21 -0
  1292. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/vector.rb +26 -0
  1293. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/xml.rb +28 -0
  1294. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb +36 -0
  1295. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb +108 -0
  1296. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +30 -0
  1297. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +152 -0
  1298. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +587 -0
  1299. data/rails/activerecord/lib/active_record/connection_adapters/postgresql/utils.rb +77 -0
  1300. data/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +754 -0
  1301. data/rails/activerecord/lib/active_record/connection_adapters/schema_cache.rb +94 -0
  1302. data/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +622 -0
  1303. data/rails/activerecord/lib/active_record/connection_adapters/statement_pool.rb +40 -0
  1304. data/rails/activerecord/lib/active_record/connection_handling.rb +132 -0
  1305. data/rails/activerecord/lib/active_record/core.rb +572 -0
  1306. data/rails/activerecord/lib/active_record/counter_cache.rb +175 -0
  1307. data/rails/activerecord/lib/active_record/dynamic_matchers.rb +140 -0
  1308. data/rails/activerecord/lib/active_record/enum.rb +198 -0
  1309. data/rails/activerecord/lib/active_record/errors.rb +252 -0
  1310. data/rails/activerecord/lib/active_record/explain.rb +38 -0
  1311. data/rails/activerecord/lib/active_record/explain_registry.rb +30 -0
  1312. data/rails/activerecord/lib/active_record/explain_subscriber.rb +29 -0
  1313. data/rails/activerecord/lib/active_record/fixture_set/file.rb +56 -0
  1314. data/rails/activerecord/lib/active_record/fixtures.rb +1007 -0
  1315. data/rails/activerecord/lib/active_record/gem_version.rb +15 -0
  1316. data/rails/activerecord/lib/active_record/inheritance.rb +247 -0
  1317. data/rails/activerecord/lib/active_record/integration.rb +113 -0
  1318. data/rails/activerecord/lib/active_record/locale/en.yml +47 -0
  1319. data/rails/activerecord/lib/active_record/locking/optimistic.rb +206 -0
  1320. data/rails/activerecord/lib/active_record/locking/pessimistic.rb +77 -0
  1321. data/rails/activerecord/lib/active_record/log_subscriber.rb +75 -0
  1322. data/rails/activerecord/lib/active_record/migration/command_recorder.rb +197 -0
  1323. data/rails/activerecord/lib/active_record/migration/join_table.rb +15 -0
  1324. data/rails/activerecord/lib/active_record/migration.rb +1051 -0
  1325. data/rails/activerecord/lib/active_record/model_schema.rb +340 -0
  1326. data/rails/activerecord/lib/active_record/nested_attributes.rb +548 -0
  1327. data/rails/activerecord/lib/active_record/no_touching.rb +52 -0
  1328. data/rails/activerecord/lib/active_record/null_relation.rb +81 -0
  1329. data/rails/activerecord/lib/active_record/persistence.rb +532 -0
  1330. data/rails/activerecord/lib/active_record/query_cache.rb +56 -0
  1331. data/rails/activerecord/lib/active_record/querying.rb +68 -0
  1332. data/rails/activerecord/lib/active_record/railtie.rb +162 -0
  1333. data/rails/activerecord/lib/active_record/railties/console_sandbox.rb +5 -0
  1334. data/rails/activerecord/lib/active_record/railties/controller_runtime.rb +50 -0
  1335. data/rails/activerecord/lib/active_record/railties/databases.rake +391 -0
  1336. data/rails/activerecord/lib/active_record/railties/jdbcmysql_error.rb +16 -0
  1337. data/rails/activerecord/lib/active_record/readonly_attributes.rb +23 -0
  1338. data/rails/activerecord/lib/active_record/reflection.rb +881 -0
  1339. data/rails/activerecord/lib/active_record/relation/batches.rb +138 -0
  1340. data/rails/activerecord/lib/active_record/relation/calculations.rb +403 -0
  1341. data/rails/activerecord/lib/active_record/relation/delegation.rb +140 -0
  1342. data/rails/activerecord/lib/active_record/relation/finder_methods.rb +528 -0
  1343. data/rails/activerecord/lib/active_record/relation/merger.rb +170 -0
  1344. data/rails/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb +47 -0
  1345. data/rails/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb +13 -0
  1346. data/rails/activerecord/lib/active_record/relation/predicate_builder.rb +141 -0
  1347. data/rails/activerecord/lib/active_record/relation/query_methods.rb +1177 -0
  1348. data/rails/activerecord/lib/active_record/relation/spawn_methods.rb +75 -0
  1349. data/rails/activerecord/lib/active_record/relation.rb +681 -0
  1350. data/rails/activerecord/lib/active_record/result.rb +131 -0
  1351. data/rails/activerecord/lib/active_record/runtime_registry.rb +22 -0
  1352. data/rails/activerecord/lib/active_record/sanitization.rb +191 -0
  1353. data/rails/activerecord/lib/active_record/schema.rb +64 -0
  1354. data/rails/activerecord/lib/active_record/schema_dumper.rb +251 -0
  1355. data/rails/activerecord/lib/active_record/schema_migration.rb +56 -0
  1356. data/rails/activerecord/lib/active_record/scoping/default.rb +134 -0
  1357. data/rails/activerecord/lib/active_record/scoping/named.rb +164 -0
  1358. data/rails/activerecord/lib/active_record/scoping.rb +87 -0
  1359. data/rails/activerecord/lib/active_record/serialization.rb +22 -0
  1360. data/rails/activerecord/lib/active_record/serializers/xml_serializer.rb +193 -0
  1361. data/rails/activerecord/lib/active_record/statement_cache.rb +111 -0
  1362. data/rails/activerecord/lib/active_record/store.rb +205 -0
  1363. data/rails/activerecord/lib/active_record/tasks/database_tasks.rb +296 -0
  1364. data/rails/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +145 -0
  1365. data/rails/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb +90 -0
  1366. data/rails/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb +55 -0
  1367. data/rails/activerecord/lib/active_record/timestamp.rb +121 -0
  1368. data/rails/activerecord/lib/active_record/transactions.rb +415 -0
  1369. data/rails/activerecord/lib/active_record/translation.rb +22 -0
  1370. data/rails/activerecord/lib/active_record/type/big_integer.rb +13 -0
  1371. data/rails/activerecord/lib/active_record/type/binary.rb +50 -0
  1372. data/rails/activerecord/lib/active_record/type/boolean.rb +30 -0
  1373. data/rails/activerecord/lib/active_record/type/date.rb +46 -0
  1374. data/rails/activerecord/lib/active_record/type/date_time.rb +54 -0
  1375. data/rails/activerecord/lib/active_record/type/decimal.rb +48 -0
  1376. data/rails/activerecord/lib/active_record/type/decimal_without_scale.rb +11 -0
  1377. data/rails/activerecord/lib/active_record/type/decorator.rb +14 -0
  1378. data/rails/activerecord/lib/active_record/type/float.rb +19 -0
  1379. data/rails/activerecord/lib/active_record/type/hash_lookup_type_map.rb +17 -0
  1380. data/rails/activerecord/lib/active_record/type/integer.rb +59 -0
  1381. data/rails/activerecord/lib/active_record/type/mutable.rb +16 -0
  1382. data/rails/activerecord/lib/active_record/type/numeric.rb +36 -0
  1383. data/rails/activerecord/lib/active_record/type/serialized.rb +56 -0
  1384. data/rails/activerecord/lib/active_record/type/string.rb +40 -0
  1385. data/rails/activerecord/lib/active_record/type/text.rb +11 -0
  1386. data/rails/activerecord/lib/active_record/type/time.rb +26 -0
  1387. data/rails/activerecord/lib/active_record/type/time_value.rb +38 -0
  1388. data/rails/activerecord/lib/active_record/type/type_map.rb +64 -0
  1389. data/rails/activerecord/lib/active_record/type/unsigned_integer.rb +15 -0
  1390. data/rails/activerecord/lib/active_record/type/value.rb +105 -0
  1391. data/rails/activerecord/lib/active_record/type.rb +23 -0
  1392. data/rails/activerecord/lib/active_record/validations/associated.rb +51 -0
  1393. data/rails/activerecord/lib/active_record/validations/presence.rb +67 -0
  1394. data/rails/activerecord/lib/active_record/validations/uniqueness.rb +229 -0
  1395. data/rails/activerecord/lib/active_record/validations.rb +90 -0
  1396. data/rails/activerecord/lib/active_record/version.rb +8 -0
  1397. data/rails/activerecord/lib/active_record.rb +173 -0
  1398. data/rails/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb +70 -0
  1399. data/rails/activerecord/lib/rails/generators/active_record/migration/templates/create_table_migration.rb +19 -0
  1400. data/rails/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb +39 -0
  1401. data/rails/activerecord/lib/rails/generators/active_record/migration.rb +18 -0
  1402. data/rails/activerecord/lib/rails/generators/active_record/model/model_generator.rb +52 -0
  1403. data/rails/activerecord/lib/rails/generators/active_record/model/templates/model.rb +10 -0
  1404. data/rails/activerecord/lib/rails/generators/active_record/model/templates/module.rb +7 -0
  1405. data/rails/activerecord/lib/rails/generators/active_record.rb +17 -0
  1406. data/rails/activerecord/test/.gitignore +1 -0
  1407. data/rails/activerecord/test/active_record/connection_adapters/fake_adapter.rb +46 -0
  1408. data/rails/activerecord/test/assets/example.log +1 -0
  1409. data/rails/activerecord/test/assets/flowers.jpg +0 -0
  1410. data/rails/activerecord/test/assets/test.txt +1 -0
  1411. data/rails/activerecord/test/cases/adapter_test.rb +261 -0
  1412. data/rails/activerecord/test/cases/adapters/mysql/active_schema_test.rb +155 -0
  1413. data/rails/activerecord/test/cases/adapters/mysql/case_sensitivity_test.rb +55 -0
  1414. data/rails/activerecord/test/cases/adapters/mysql/connection_test.rb +184 -0
  1415. data/rails/activerecord/test/cases/adapters/mysql/consistency_test.rb +49 -0
  1416. data/rails/activerecord/test/cases/adapters/mysql/datetime_test.rb +87 -0
  1417. data/rails/activerecord/test/cases/adapters/mysql/enum_test.rb +10 -0
  1418. data/rails/activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb +153 -0
  1419. data/rails/activerecord/test/cases/adapters/mysql/quoting_test.rb +25 -0
  1420. data/rails/activerecord/test/cases/adapters/mysql/reserved_word_test.rb +153 -0
  1421. data/rails/activerecord/test/cases/adapters/mysql/schema_test.rb +100 -0
  1422. data/rails/activerecord/test/cases/adapters/mysql/sp_test.rb +15 -0
  1423. data/rails/activerecord/test/cases/adapters/mysql/sql_types_test.rb +14 -0
  1424. data/rails/activerecord/test/cases/adapters/mysql/statement_pool_test.rb +23 -0
  1425. data/rails/activerecord/test/cases/adapters/mysql/unsigned_type_test.rb +30 -0
  1426. data/rails/activerecord/test/cases/adapters/mysql2/active_schema_test.rb +155 -0
  1427. data/rails/activerecord/test/cases/adapters/mysql2/bind_parameter_test.rb +50 -0
  1428. data/rails/activerecord/test/cases/adapters/mysql2/boolean_test.rb +92 -0
  1429. data/rails/activerecord/test/cases/adapters/mysql2/case_sensitivity_test.rb +55 -0
  1430. data/rails/activerecord/test/cases/adapters/mysql2/connection_test.rb +134 -0
  1431. data/rails/activerecord/test/cases/adapters/mysql2/datetime_test.rb +87 -0
  1432. data/rails/activerecord/test/cases/adapters/mysql2/enum_test.rb +10 -0
  1433. data/rails/activerecord/test/cases/adapters/mysql2/explain_test.rb +27 -0
  1434. data/rails/activerecord/test/cases/adapters/mysql2/reserved_word_test.rb +152 -0
  1435. data/rails/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb +47 -0
  1436. data/rails/activerecord/test/cases/adapters/mysql2/schema_test.rb +81 -0
  1437. data/rails/activerecord/test/cases/adapters/mysql2/sql_types_test.rb +14 -0
  1438. data/rails/activerecord/test/cases/adapters/mysql2/unsigned_type_test.rb +30 -0
  1439. data/rails/activerecord/test/cases/adapters/postgresql/active_schema_test.rb +58 -0
  1440. data/rails/activerecord/test/cases/adapters/postgresql/array_test.rb +295 -0
  1441. data/rails/activerecord/test/cases/adapters/postgresql/bit_string_test.rb +78 -0
  1442. data/rails/activerecord/test/cases/adapters/postgresql/bytea_test.rb +125 -0
  1443. data/rails/activerecord/test/cases/adapters/postgresql/change_schema_test.rb +31 -0
  1444. data/rails/activerecord/test/cases/adapters/postgresql/citext_test.rb +71 -0
  1445. data/rails/activerecord/test/cases/adapters/postgresql/composite_test.rb +131 -0
  1446. data/rails/activerecord/test/cases/adapters/postgresql/connection_test.rb +215 -0
  1447. data/rails/activerecord/test/cases/adapters/postgresql/datatype_test.rb +126 -0
  1448. data/rails/activerecord/test/cases/adapters/postgresql/domain_test.rb +47 -0
  1449. data/rails/activerecord/test/cases/adapters/postgresql/enum_test.rb +83 -0
  1450. data/rails/activerecord/test/cases/adapters/postgresql/explain_test.rb +26 -0
  1451. data/rails/activerecord/test/cases/adapters/postgresql/extension_migration_test.rb +63 -0
  1452. data/rails/activerecord/test/cases/adapters/postgresql/full_text_test.rb +26 -0
  1453. data/rails/activerecord/test/cases/adapters/postgresql/geometric_test.rb +72 -0
  1454. data/rails/activerecord/test/cases/adapters/postgresql/hstore_test.rb +345 -0
  1455. data/rails/activerecord/test/cases/adapters/postgresql/infinity_test.rb +60 -0
  1456. data/rails/activerecord/test/cases/adapters/postgresql/integer_test.rb +25 -0
  1457. data/rails/activerecord/test/cases/adapters/postgresql/json_test.rb +206 -0
  1458. data/rails/activerecord/test/cases/adapters/postgresql/ltree_test.rb +46 -0
  1459. data/rails/activerecord/test/cases/adapters/postgresql/money_test.rb +96 -0
  1460. data/rails/activerecord/test/cases/adapters/postgresql/network_test.rb +71 -0
  1461. data/rails/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb +462 -0
  1462. data/rails/activerecord/test/cases/adapters/postgresql/quoting_test.rb +74 -0
  1463. data/rails/activerecord/test/cases/adapters/postgresql/range_test.rb +323 -0
  1464. data/rails/activerecord/test/cases/adapters/postgresql/rename_table_test.rb +34 -0
  1465. data/rails/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb +114 -0
  1466. data/rails/activerecord/test/cases/adapters/postgresql/schema_test.rb +462 -0
  1467. data/rails/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb +41 -0
  1468. data/rails/activerecord/test/cases/adapters/postgresql/timestamp_test.rb +170 -0
  1469. data/rails/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb +33 -0
  1470. data/rails/activerecord/test/cases/adapters/postgresql/utils_test.rb +61 -0
  1471. data/rails/activerecord/test/cases/adapters/postgresql/uuid_test.rb +315 -0
  1472. data/rails/activerecord/test/cases/adapters/postgresql/view_test.rb +63 -0
  1473. data/rails/activerecord/test/cases/adapters/postgresql/xml_test.rb +48 -0
  1474. data/rails/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb +98 -0
  1475. data/rails/activerecord/test/cases/adapters/sqlite3/explain_test.rb +27 -0
  1476. data/rails/activerecord/test/cases/adapters/sqlite3/quoting_test.rb +116 -0
  1477. data/rails/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +461 -0
  1478. data/rails/activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb +21 -0
  1479. data/rails/activerecord/test/cases/adapters/sqlite3/statement_pool_test.rb +25 -0
  1480. data/rails/activerecord/test/cases/aggregations_test.rb +158 -0
  1481. data/rails/activerecord/test/cases/ar_schema_test.rb +161 -0
  1482. data/rails/activerecord/test/cases/associations/association_scope_test.rb +21 -0
  1483. data/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb +978 -0
  1484. data/rails/activerecord/test/cases/associations/callbacks_test.rb +190 -0
  1485. data/rails/activerecord/test/cases/associations/cascaded_eager_loading_test.rb +188 -0
  1486. data/rails/activerecord/test/cases/associations/deprecated_counter_cache_on_has_many_through_test.rb +26 -0
  1487. data/rails/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb +36 -0
  1488. data/rails/activerecord/test/cases/associations/eager_load_nested_include_test.rb +128 -0
  1489. data/rails/activerecord/test/cases/associations/eager_singularization_test.rb +148 -0
  1490. data/rails/activerecord/test/cases/associations/eager_test.rb +1366 -0
  1491. data/rails/activerecord/test/cases/associations/extension_test.rb +82 -0
  1492. data/rails/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +905 -0
  1493. data/rails/activerecord/test/cases/associations/has_many_associations_test.rb +2099 -0
  1494. data/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb +1163 -0
  1495. data/rails/activerecord/test/cases/associations/has_one_associations_test.rb +610 -0
  1496. data/rails/activerecord/test/cases/associations/has_one_through_associations_test.rb +346 -0
  1497. data/rails/activerecord/test/cases/associations/inner_join_association_test.rb +139 -0
  1498. data/rails/activerecord/test/cases/associations/inverse_associations_test.rb +693 -0
  1499. data/rails/activerecord/test/cases/associations/join_model_test.rb +751 -0
  1500. data/rails/activerecord/test/cases/associations/nested_through_associations_test.rb +579 -0
  1501. data/rails/activerecord/test/cases/associations/required_test.rb +82 -0
  1502. data/rails/activerecord/test/cases/associations_test.rb +380 -0
  1503. data/rails/activerecord/test/cases/attribute_decorators_test.rb +125 -0
  1504. data/rails/activerecord/test/cases/attribute_methods/read_test.rb +60 -0
  1505. data/rails/activerecord/test/cases/attribute_methods_test.rb +941 -0
  1506. data/rails/activerecord/test/cases/attribute_set_test.rb +200 -0
  1507. data/rails/activerecord/test/cases/attribute_test.rb +180 -0
  1508. data/rails/activerecord/test/cases/attributes_test.rb +115 -0
  1509. data/rails/activerecord/test/cases/autosave_association_test.rb +1588 -0
  1510. data/rails/activerecord/test/cases/base_test.rb +1627 -0
  1511. data/rails/activerecord/test/cases/batches_test.rb +212 -0
  1512. data/rails/activerecord/test/cases/binary_test.rb +49 -0
  1513. data/rails/activerecord/test/cases/bind_parameter_test.rb +100 -0
  1514. data/rails/activerecord/test/cases/calculations_test.rb +634 -0
  1515. data/rails/activerecord/test/cases/callbacks_test.rb +539 -0
  1516. data/rails/activerecord/test/cases/clone_test.rb +40 -0
  1517. data/rails/activerecord/test/cases/coders/yaml_column_test.rb +63 -0
  1518. data/rails/activerecord/test/cases/column_alias_test.rb +17 -0
  1519. data/rails/activerecord/test/cases/column_definition_test.rb +123 -0
  1520. data/rails/activerecord/test/cases/connection_adapters/adapter_leasing_test.rb +54 -0
  1521. data/rails/activerecord/test/cases/connection_adapters/connection_handler_test.rb +53 -0
  1522. data/rails/activerecord/test/cases/connection_adapters/connection_specification_test.rb +12 -0
  1523. data/rails/activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb +293 -0
  1524. data/rails/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb +65 -0
  1525. data/rails/activerecord/test/cases/connection_adapters/quoting_test.rb +13 -0
  1526. data/rails/activerecord/test/cases/connection_adapters/schema_cache_test.rb +56 -0
  1527. data/rails/activerecord/test/cases/connection_adapters/type_lookup_test.rb +106 -0
  1528. data/rails/activerecord/test/cases/connection_management_test.rb +122 -0
  1529. data/rails/activerecord/test/cases/connection_pool_test.rb +346 -0
  1530. data/rails/activerecord/test/cases/connection_specification/resolver_test.rb +116 -0
  1531. data/rails/activerecord/test/cases/core_test.rb +112 -0
  1532. data/rails/activerecord/test/cases/counter_cache_test.rb +201 -0
  1533. data/rails/activerecord/test/cases/custom_locking_test.rb +17 -0
  1534. data/rails/activerecord/test/cases/database_statements_test.rb +19 -0
  1535. data/rails/activerecord/test/cases/date_time_test.rb +61 -0
  1536. data/rails/activerecord/test/cases/defaults_test.rb +223 -0
  1537. data/rails/activerecord/test/cases/dirty_test.rb +759 -0
  1538. data/rails/activerecord/test/cases/disconnected_test.rb +28 -0
  1539. data/rails/activerecord/test/cases/dup_test.rb +157 -0
  1540. data/rails/activerecord/test/cases/enum_test.rb +290 -0
  1541. data/rails/activerecord/test/cases/explain_subscriber_test.rb +59 -0
  1542. data/rails/activerecord/test/cases/explain_test.rb +76 -0
  1543. data/rails/activerecord/test/cases/finder_respond_to_test.rb +60 -0
  1544. data/rails/activerecord/test/cases/finder_test.rb +1163 -0
  1545. data/rails/activerecord/test/cases/fixture_set/file_test.rb +138 -0
  1546. data/rails/activerecord/test/cases/fixtures_test.rb +869 -0
  1547. data/rails/activerecord/test/cases/forbidden_attributes_protection_test.rb +99 -0
  1548. data/rails/activerecord/test/cases/habtm_destroy_order_test.rb +61 -0
  1549. data/rails/activerecord/test/cases/helper.rb +210 -0
  1550. data/rails/activerecord/test/cases/hot_compatibility_test.rb +54 -0
  1551. data/rails/activerecord/test/cases/i18n_test.rb +45 -0
  1552. data/rails/activerecord/test/cases/inheritance_test.rb +369 -0
  1553. data/rails/activerecord/test/cases/integration_test.rb +139 -0
  1554. data/rails/activerecord/test/cases/invalid_connection_test.rb +22 -0
  1555. data/rails/activerecord/test/cases/invalid_date_test.rb +32 -0
  1556. data/rails/activerecord/test/cases/invertible_migration_test.rb +295 -0
  1557. data/rails/activerecord/test/cases/json_serialization_test.rb +300 -0
  1558. data/rails/activerecord/test/cases/locking_test.rb +477 -0
  1559. data/rails/activerecord/test/cases/log_subscriber_test.rb +136 -0
  1560. data/rails/activerecord/test/cases/migration/change_schema_test.rb +450 -0
  1561. data/rails/activerecord/test/cases/migration/change_table_test.rb +224 -0
  1562. data/rails/activerecord/test/cases/migration/column_attributes_test.rb +185 -0
  1563. data/rails/activerecord/test/cases/migration/column_positioning_test.rb +56 -0
  1564. data/rails/activerecord/test/cases/migration/columns_test.rb +299 -0
  1565. data/rails/activerecord/test/cases/migration/command_recorder_test.rb +305 -0
  1566. data/rails/activerecord/test/cases/migration/create_join_table_test.rb +148 -0
  1567. data/rails/activerecord/test/cases/migration/foreign_key_test.rb +250 -0
  1568. data/rails/activerecord/test/cases/migration/helper.rb +39 -0
  1569. data/rails/activerecord/test/cases/migration/index_test.rb +208 -0
  1570. data/rails/activerecord/test/cases/migration/logger_test.rb +36 -0
  1571. data/rails/activerecord/test/cases/migration/pending_migrations_test.rb +53 -0
  1572. data/rails/activerecord/test/cases/migration/references_foreign_key_test.rb +111 -0
  1573. data/rails/activerecord/test/cases/migration/references_index_test.rb +101 -0
  1574. data/rails/activerecord/test/cases/migration/references_statements_test.rb +116 -0
  1575. data/rails/activerecord/test/cases/migration/rename_table_test.rb +93 -0
  1576. data/rails/activerecord/test/cases/migration/table_and_index_test.rb +24 -0
  1577. data/rails/activerecord/test/cases/migration_test.rb +939 -0
  1578. data/rails/activerecord/test/cases/migrator_test.rb +388 -0
  1579. data/rails/activerecord/test/cases/mixin_test.rb +70 -0
  1580. data/rails/activerecord/test/cases/modules_test.rb +173 -0
  1581. data/rails/activerecord/test/cases/multiparameter_attributes_test.rb +350 -0
  1582. data/rails/activerecord/test/cases/multiple_db_test.rb +115 -0
  1583. data/rails/activerecord/test/cases/nested_attributes_test.rb +1057 -0
  1584. data/rails/activerecord/test/cases/nested_attributes_with_callbacks_test.rb +144 -0
  1585. data/rails/activerecord/test/cases/persistence_test.rb +881 -0
  1586. data/rails/activerecord/test/cases/pooled_connections_test.rb +81 -0
  1587. data/rails/activerecord/test/cases/primary_keys_test.rb +236 -0
  1588. data/rails/activerecord/test/cases/query_cache_test.rb +322 -0
  1589. data/rails/activerecord/test/cases/quoting_test.rb +156 -0
  1590. data/rails/activerecord/test/cases/readonly_test.rb +118 -0
  1591. data/rails/activerecord/test/cases/reaper_test.rb +85 -0
  1592. data/rails/activerecord/test/cases/reflection_test.rb +454 -0
  1593. data/rails/activerecord/test/cases/relation/delegation_test.rb +68 -0
  1594. data/rails/activerecord/test/cases/relation/merging_test.rb +161 -0
  1595. data/rails/activerecord/test/cases/relation/mutation_test.rb +165 -0
  1596. data/rails/activerecord/test/cases/relation/predicate_builder_test.rb +14 -0
  1597. data/rails/activerecord/test/cases/relation/where_chain_test.rb +181 -0
  1598. data/rails/activerecord/test/cases/relation/where_test.rb +278 -0
  1599. data/rails/activerecord/test/cases/relation_test.rb +267 -0
  1600. data/rails/activerecord/test/cases/relations_test.rb +1756 -0
  1601. data/rails/activerecord/test/cases/reload_models_test.rb +22 -0
  1602. data/rails/activerecord/test/cases/result_test.rb +80 -0
  1603. data/rails/activerecord/test/cases/sanitize_test.rb +83 -0
  1604. data/rails/activerecord/test/cases/schema_dumper_test.rb +445 -0
  1605. data/rails/activerecord/test/cases/scoping/default_scoping_test.rb +436 -0
  1606. data/rails/activerecord/test/cases/scoping/named_scoping_test.rb +524 -0
  1607. data/rails/activerecord/test/cases/scoping/relation_scoping_test.rb +357 -0
  1608. data/rails/activerecord/test/cases/serialization_test.rb +104 -0
  1609. data/rails/activerecord/test/cases/serialized_attribute_test.rb +267 -0
  1610. data/rails/activerecord/test/cases/statement_cache_test.rb +98 -0
  1611. data/rails/activerecord/test/cases/store_test.rb +194 -0
  1612. data/rails/activerecord/test/cases/tasks/database_tasks_test.rb +380 -0
  1613. data/rails/activerecord/test/cases/tasks/mysql_rake_test.rb +311 -0
  1614. data/rails/activerecord/test/cases/tasks/postgresql_rake_test.rb +245 -0
  1615. data/rails/activerecord/test/cases/tasks/sqlite_rake_test.rb +193 -0
  1616. data/rails/activerecord/test/cases/test_case.rb +123 -0
  1617. data/rails/activerecord/test/cases/timestamp_test.rb +446 -0
  1618. data/rails/activerecord/test/cases/transaction_callbacks_test.rb +444 -0
  1619. data/rails/activerecord/test/cases/transaction_isolation_test.rb +106 -0
  1620. data/rails/activerecord/test/cases/transactions_test.rb +792 -0
  1621. data/rails/activerecord/test/cases/type/decimal_test.rb +51 -0
  1622. data/rails/activerecord/test/cases/type/integer_test.rb +121 -0
  1623. data/rails/activerecord/test/cases/type/string_test.rb +36 -0
  1624. data/rails/activerecord/test/cases/type/type_map_test.rb +177 -0
  1625. data/rails/activerecord/test/cases/type/unsigned_integer_test.rb +18 -0
  1626. data/rails/activerecord/test/cases/types_test.rb +141 -0
  1627. data/rails/activerecord/test/cases/unconnected_test.rb +33 -0
  1628. data/rails/activerecord/test/cases/validations/association_validation_test.rb +86 -0
  1629. data/rails/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb +84 -0
  1630. data/rails/activerecord/test/cases/validations/i18n_validation_test.rb +90 -0
  1631. data/rails/activerecord/test/cases/validations/length_validation_test.rb +47 -0
  1632. data/rails/activerecord/test/cases/validations/presence_validation_test.rb +68 -0
  1633. data/rails/activerecord/test/cases/validations/uniqueness_validation_test.rb +406 -0
  1634. data/rails/activerecord/test/cases/validations_repair_helper.rb +23 -0
  1635. data/rails/activerecord/test/cases/validations_test.rb +165 -0
  1636. data/rails/activerecord/test/cases/view_test.rb +113 -0
  1637. data/rails/activerecord/test/cases/xml_serialization_test.rb +447 -0
  1638. data/rails/activerecord/test/cases/yaml_serialization_test.rb +86 -0
  1639. data/rails/activerecord/test/config.example.yml +106 -0
  1640. data/rails/activerecord/test/config.rb +5 -0
  1641. data/rails/activerecord/test/fixtures/.gitignore +1 -0
  1642. data/rails/activerecord/test/fixtures/accounts.yml +29 -0
  1643. data/rails/activerecord/test/fixtures/admin/accounts.yml +2 -0
  1644. data/rails/activerecord/test/fixtures/admin/randomly_named_a9.yml +7 -0
  1645. data/rails/activerecord/test/fixtures/admin/randomly_named_b0.yml +7 -0
  1646. data/rails/activerecord/test/fixtures/admin/users.yml +10 -0
  1647. data/rails/activerecord/test/fixtures/all/developers.yml +0 -0
  1648. data/rails/activerecord/test/fixtures/all/people.yml +0 -0
  1649. data/rails/activerecord/test/fixtures/all/tasks.yml +0 -0
  1650. data/rails/activerecord/test/fixtures/author_addresses.yml +5 -0
  1651. data/rails/activerecord/test/fixtures/author_favorites.yml +4 -0
  1652. data/rails/activerecord/test/fixtures/authors.yml +15 -0
  1653. data/rails/activerecord/test/fixtures/binaries.yml +133 -0
  1654. data/rails/activerecord/test/fixtures/books.yml +11 -0
  1655. data/rails/activerecord/test/fixtures/bulbs.yml +5 -0
  1656. data/rails/activerecord/test/fixtures/cars.yml +9 -0
  1657. data/rails/activerecord/test/fixtures/categories/special_categories.yml +9 -0
  1658. data/rails/activerecord/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
  1659. data/rails/activerecord/test/fixtures/categories.yml +19 -0
  1660. data/rails/activerecord/test/fixtures/categories_ordered.yml +7 -0
  1661. data/rails/activerecord/test/fixtures/categories_posts.yml +31 -0
  1662. data/rails/activerecord/test/fixtures/categorizations.yml +23 -0
  1663. data/rails/activerecord/test/fixtures/clubs.yml +8 -0
  1664. data/rails/activerecord/test/fixtures/collections.yml +3 -0
  1665. data/rails/activerecord/test/fixtures/colleges.yml +3 -0
  1666. data/rails/activerecord/test/fixtures/comments.yml +65 -0
  1667. data/rails/activerecord/test/fixtures/companies.yml +67 -0
  1668. data/rails/activerecord/test/fixtures/computers.yml +10 -0
  1669. data/rails/activerecord/test/fixtures/courses.yml +8 -0
  1670. data/rails/activerecord/test/fixtures/customers.yml +26 -0
  1671. data/rails/activerecord/test/fixtures/dashboards.yml +6 -0
  1672. data/rails/activerecord/test/fixtures/developers.yml +22 -0
  1673. data/rails/activerecord/test/fixtures/developers_projects.yml +17 -0
  1674. data/rails/activerecord/test/fixtures/dog_lovers.yml +7 -0
  1675. data/rails/activerecord/test/fixtures/dogs.yml +4 -0
  1676. data/rails/activerecord/test/fixtures/edges.yml +5 -0
  1677. data/rails/activerecord/test/fixtures/entrants.yml +14 -0
  1678. data/rails/activerecord/test/fixtures/essays.yml +6 -0
  1679. data/rails/activerecord/test/fixtures/faces.yml +11 -0
  1680. data/rails/activerecord/test/fixtures/fk_test_has_fk.yml +3 -0
  1681. data/rails/activerecord/test/fixtures/fk_test_has_pk.yml +2 -0
  1682. data/rails/activerecord/test/fixtures/friendships.yml +4 -0
  1683. data/rails/activerecord/test/fixtures/funny_jokes.yml +10 -0
  1684. data/rails/activerecord/test/fixtures/interests.yml +33 -0
  1685. data/rails/activerecord/test/fixtures/items.yml +3 -0
  1686. data/rails/activerecord/test/fixtures/jobs.yml +7 -0
  1687. data/rails/activerecord/test/fixtures/legacy_things.yml +3 -0
  1688. data/rails/activerecord/test/fixtures/mateys.yml +4 -0
  1689. data/rails/activerecord/test/fixtures/member_details.yml +8 -0
  1690. data/rails/activerecord/test/fixtures/member_types.yml +6 -0
  1691. data/rails/activerecord/test/fixtures/members.yml +11 -0
  1692. data/rails/activerecord/test/fixtures/memberships.yml +34 -0
  1693. data/rails/activerecord/test/fixtures/men.yml +5 -0
  1694. data/rails/activerecord/test/fixtures/minimalistics.yml +2 -0
  1695. data/rails/activerecord/test/fixtures/minivans.yml +5 -0
  1696. data/rails/activerecord/test/fixtures/mixed_case_monkeys.yml +6 -0
  1697. data/rails/activerecord/test/fixtures/mixins.yml +29 -0
  1698. data/rails/activerecord/test/fixtures/movies.yml +7 -0
  1699. data/rails/activerecord/test/fixtures/naked/csv/accounts.csv +1 -0
  1700. data/rails/activerecord/test/fixtures/naked/yml/accounts.yml +1 -0
  1701. data/rails/activerecord/test/fixtures/naked/yml/companies.yml +1 -0
  1702. data/rails/activerecord/test/fixtures/naked/yml/courses.yml +1 -0
  1703. data/rails/activerecord/test/fixtures/organizations.yml +5 -0
  1704. data/rails/activerecord/test/fixtures/other_topics.yml +42 -0
  1705. data/rails/activerecord/test/fixtures/owners.yml +9 -0
  1706. data/rails/activerecord/test/fixtures/parrots.yml +27 -0
  1707. data/rails/activerecord/test/fixtures/parrots_pirates.yml +7 -0
  1708. data/rails/activerecord/test/fixtures/people.yml +24 -0
  1709. data/rails/activerecord/test/fixtures/peoples_treasures.yml +3 -0
  1710. data/rails/activerecord/test/fixtures/pets.yml +19 -0
  1711. data/rails/activerecord/test/fixtures/pirates.yml +12 -0
  1712. data/rails/activerecord/test/fixtures/posts.yml +80 -0
  1713. data/rails/activerecord/test/fixtures/price_estimates.yml +7 -0
  1714. data/rails/activerecord/test/fixtures/products.yml +4 -0
  1715. data/rails/activerecord/test/fixtures/projects.yml +7 -0
  1716. data/rails/activerecord/test/fixtures/randomly_named_a9.yml +7 -0
  1717. data/rails/activerecord/test/fixtures/ratings.yml +14 -0
  1718. data/rails/activerecord/test/fixtures/readers.yml +11 -0
  1719. data/rails/activerecord/test/fixtures/references.yml +17 -0
  1720. data/rails/activerecord/test/fixtures/reserved_words/distinct.yml +5 -0
  1721. data/rails/activerecord/test/fixtures/reserved_words/distinct_select.yml +11 -0
  1722. data/rails/activerecord/test/fixtures/reserved_words/group.yml +14 -0
  1723. data/rails/activerecord/test/fixtures/reserved_words/select.yml +8 -0
  1724. data/rails/activerecord/test/fixtures/reserved_words/values.yml +7 -0
  1725. data/rails/activerecord/test/fixtures/ships.yml +6 -0
  1726. data/rails/activerecord/test/fixtures/speedometers.yml +8 -0
  1727. data/rails/activerecord/test/fixtures/sponsors.yml +12 -0
  1728. data/rails/activerecord/test/fixtures/string_key_objects.yml +7 -0
  1729. data/rails/activerecord/test/fixtures/subscribers.yml +11 -0
  1730. data/rails/activerecord/test/fixtures/subscriptions.yml +12 -0
  1731. data/rails/activerecord/test/fixtures/taggings.yml +78 -0
  1732. data/rails/activerecord/test/fixtures/tags.yml +11 -0
  1733. data/rails/activerecord/test/fixtures/tasks.yml +7 -0
  1734. data/rails/activerecord/test/fixtures/teapots.yml +3 -0
  1735. data/rails/activerecord/test/fixtures/to_be_linked/accounts.yml +2 -0
  1736. data/rails/activerecord/test/fixtures/to_be_linked/users.yml +10 -0
  1737. data/rails/activerecord/test/fixtures/topics.yml +49 -0
  1738. data/rails/activerecord/test/fixtures/toys.yml +14 -0
  1739. data/rails/activerecord/test/fixtures/traffic_lights.yml +10 -0
  1740. data/rails/activerecord/test/fixtures/treasures.yml +10 -0
  1741. data/rails/activerecord/test/fixtures/uuid_children.yml +3 -0
  1742. data/rails/activerecord/test/fixtures/uuid_parents.yml +2 -0
  1743. data/rails/activerecord/test/fixtures/variants.yml +4 -0
  1744. data/rails/activerecord/test/fixtures/vegetables.yml +20 -0
  1745. data/rails/activerecord/test/fixtures/vertices.yml +4 -0
  1746. data/rails/activerecord/test/fixtures/warehouse-things.yml +3 -0
  1747. data/rails/activerecord/test/fixtures/zines.yml +5 -0
  1748. data/rails/activerecord/test/migrations/10_urban/9_add_expressions.rb +11 -0
  1749. data/rails/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb +15 -0
  1750. data/rails/activerecord/test/migrations/empty/.gitkeep +0 -0
  1751. data/rails/activerecord/test/migrations/magic/1_currencies_have_symbols.rb +12 -0
  1752. data/rails/activerecord/test/migrations/missing/1000_people_have_middle_names.rb +9 -0
  1753. data/rails/activerecord/test/migrations/missing/1_people_have_last_names.rb +9 -0
  1754. data/rails/activerecord/test/migrations/missing/3_we_need_reminders.rb +12 -0
  1755. data/rails/activerecord/test/migrations/missing/4_innocent_jointable.rb +12 -0
  1756. data/rails/activerecord/test/migrations/rename/1_we_need_things.rb +11 -0
  1757. data/rails/activerecord/test/migrations/rename/2_rename_things.rb +9 -0
  1758. data/rails/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb +9 -0
  1759. data/rails/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb +9 -0
  1760. data/rails/activerecord/test/migrations/to_copy2/1_create_articles.rb +7 -0
  1761. data/rails/activerecord/test/migrations/to_copy2/2_create_comments.rb +7 -0
  1762. data/rails/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb +9 -0
  1763. data/rails/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb +9 -0
  1764. data/rails/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb +9 -0
  1765. data/rails/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb +7 -0
  1766. data/rails/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb +7 -0
  1767. data/rails/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb +9 -0
  1768. data/rails/activerecord/test/migrations/valid/2_we_need_reminders.rb +12 -0
  1769. data/rails/activerecord/test/migrations/valid/3_innocent_jointable.rb +12 -0
  1770. data/rails/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb +9 -0
  1771. data/rails/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb +12 -0
  1772. data/rails/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb +12 -0
  1773. data/rails/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb +9 -0
  1774. data/rails/activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb +12 -0
  1775. data/rails/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb +12 -0
  1776. data/rails/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb +8 -0
  1777. data/rails/activerecord/test/models/admin/account.rb +3 -0
  1778. data/rails/activerecord/test/models/admin/randomly_named_c1.rb +3 -0
  1779. data/rails/activerecord/test/models/admin/user.rb +40 -0
  1780. data/rails/activerecord/test/models/admin.rb +5 -0
  1781. data/rails/activerecord/test/models/aircraft.rb +4 -0
  1782. data/rails/activerecord/test/models/arunit2_model.rb +3 -0
  1783. data/rails/activerecord/test/models/author.rb +212 -0
  1784. data/rails/activerecord/test/models/auto_id.rb +4 -0
  1785. data/rails/activerecord/test/models/autoloadable/extra_firm.rb +2 -0
  1786. data/rails/activerecord/test/models/binary.rb +2 -0
  1787. data/rails/activerecord/test/models/bird.rb +12 -0
  1788. data/rails/activerecord/test/models/book.rb +18 -0
  1789. data/rails/activerecord/test/models/boolean.rb +2 -0
  1790. data/rails/activerecord/test/models/bulb.rb +51 -0
  1791. data/rails/activerecord/test/models/cake_designer.rb +3 -0
  1792. data/rails/activerecord/test/models/car.rb +26 -0
  1793. data/rails/activerecord/test/models/categorization.rb +19 -0
  1794. data/rails/activerecord/test/models/category.rb +35 -0
  1795. data/rails/activerecord/test/models/chef.rb +3 -0
  1796. data/rails/activerecord/test/models/citation.rb +3 -0
  1797. data/rails/activerecord/test/models/club.rb +23 -0
  1798. data/rails/activerecord/test/models/college.rb +10 -0
  1799. data/rails/activerecord/test/models/column.rb +3 -0
  1800. data/rails/activerecord/test/models/column_name.rb +3 -0
  1801. data/rails/activerecord/test/models/comment.rb +59 -0
  1802. data/rails/activerecord/test/models/company.rb +225 -0
  1803. data/rails/activerecord/test/models/company_in_module.rb +98 -0
  1804. data/rails/activerecord/test/models/computer.rb +3 -0
  1805. data/rails/activerecord/test/models/contact.rb +41 -0
  1806. data/rails/activerecord/test/models/contract.rb +20 -0
  1807. data/rails/activerecord/test/models/country.rb +7 -0
  1808. data/rails/activerecord/test/models/course.rb +6 -0
  1809. data/rails/activerecord/test/models/customer.rb +77 -0
  1810. data/rails/activerecord/test/models/dashboard.rb +3 -0
  1811. data/rails/activerecord/test/models/default.rb +2 -0
  1812. data/rails/activerecord/test/models/department.rb +4 -0
  1813. data/rails/activerecord/test/models/developer.rb +252 -0
  1814. data/rails/activerecord/test/models/dog.rb +5 -0
  1815. data/rails/activerecord/test/models/dog_lover.rb +5 -0
  1816. data/rails/activerecord/test/models/drink_designer.rb +3 -0
  1817. data/rails/activerecord/test/models/edge.rb +5 -0
  1818. data/rails/activerecord/test/models/electron.rb +5 -0
  1819. data/rails/activerecord/test/models/engine.rb +4 -0
  1820. data/rails/activerecord/test/models/entrant.rb +3 -0
  1821. data/rails/activerecord/test/models/essay.rb +5 -0
  1822. data/rails/activerecord/test/models/event.rb +3 -0
  1823. data/rails/activerecord/test/models/eye.rb +37 -0
  1824. data/rails/activerecord/test/models/face.rb +9 -0
  1825. data/rails/activerecord/test/models/friendship.rb +6 -0
  1826. data/rails/activerecord/test/models/guid.rb +2 -0
  1827. data/rails/activerecord/test/models/hotel.rb +6 -0
  1828. data/rails/activerecord/test/models/image.rb +3 -0
  1829. data/rails/activerecord/test/models/interest.rb +5 -0
  1830. data/rails/activerecord/test/models/invoice.rb +4 -0
  1831. data/rails/activerecord/test/models/item.rb +7 -0
  1832. data/rails/activerecord/test/models/job.rb +7 -0
  1833. data/rails/activerecord/test/models/joke.rb +7 -0
  1834. data/rails/activerecord/test/models/keyboard.rb +3 -0
  1835. data/rails/activerecord/test/models/legacy_thing.rb +3 -0
  1836. data/rails/activerecord/test/models/lesson.rb +11 -0
  1837. data/rails/activerecord/test/models/line_item.rb +3 -0
  1838. data/rails/activerecord/test/models/liquid.rb +4 -0
  1839. data/rails/activerecord/test/models/man.rb +11 -0
  1840. data/rails/activerecord/test/models/matey.rb +4 -0
  1841. data/rails/activerecord/test/models/member.rb +38 -0
  1842. data/rails/activerecord/test/models/member_detail.rb +7 -0
  1843. data/rails/activerecord/test/models/member_type.rb +3 -0
  1844. data/rails/activerecord/test/models/membership.rb +20 -0
  1845. data/rails/activerecord/test/models/minimalistic.rb +2 -0
  1846. data/rails/activerecord/test/models/minivan.rb +9 -0
  1847. data/rails/activerecord/test/models/mixed_case_monkey.rb +3 -0
  1848. data/rails/activerecord/test/models/molecule.rb +6 -0
  1849. data/rails/activerecord/test/models/movie.rb +5 -0
  1850. data/rails/activerecord/test/models/order.rb +4 -0
  1851. data/rails/activerecord/test/models/organization.rb +14 -0
  1852. data/rails/activerecord/test/models/owner.rb +34 -0
  1853. data/rails/activerecord/test/models/parrot.rb +29 -0
  1854. data/rails/activerecord/test/models/person.rb +143 -0
  1855. data/rails/activerecord/test/models/personal_legacy_thing.rb +4 -0
  1856. data/rails/activerecord/test/models/pet.rb +15 -0
  1857. data/rails/activerecord/test/models/pirate.rb +92 -0
  1858. data/rails/activerecord/test/models/possession.rb +3 -0
  1859. data/rails/activerecord/test/models/post.rb +243 -0
  1860. data/rails/activerecord/test/models/price_estimate.rb +4 -0
  1861. data/rails/activerecord/test/models/project.rb +29 -0
  1862. data/rails/activerecord/test/models/publisher/article.rb +4 -0
  1863. data/rails/activerecord/test/models/publisher/magazine.rb +3 -0
  1864. data/rails/activerecord/test/models/publisher.rb +2 -0
  1865. data/rails/activerecord/test/models/randomly_named_c1.rb +3 -0
  1866. data/rails/activerecord/test/models/rating.rb +4 -0
  1867. data/rails/activerecord/test/models/reader.rb +23 -0
  1868. data/rails/activerecord/test/models/record.rb +2 -0
  1869. data/rails/activerecord/test/models/reference.rb +22 -0
  1870. data/rails/activerecord/test/models/reply.rb +61 -0
  1871. data/rails/activerecord/test/models/ship.rb +26 -0
  1872. data/rails/activerecord/test/models/ship_part.rb +8 -0
  1873. data/rails/activerecord/test/models/shop.rb +17 -0
  1874. data/rails/activerecord/test/models/speedometer.rb +6 -0
  1875. data/rails/activerecord/test/models/sponsor.rb +7 -0
  1876. data/rails/activerecord/test/models/string_key_object.rb +3 -0
  1877. data/rails/activerecord/test/models/student.rb +4 -0
  1878. data/rails/activerecord/test/models/subject.rb +16 -0
  1879. data/rails/activerecord/test/models/subscriber.rb +8 -0
  1880. data/rails/activerecord/test/models/subscription.rb +4 -0
  1881. data/rails/activerecord/test/models/tag.rb +7 -0
  1882. data/rails/activerecord/test/models/tagging.rb +13 -0
  1883. data/rails/activerecord/test/models/task.rb +5 -0
  1884. data/rails/activerecord/test/models/topic.rb +124 -0
  1885. data/rails/activerecord/test/models/toy.rb +6 -0
  1886. data/rails/activerecord/test/models/traffic_light.rb +4 -0
  1887. data/rails/activerecord/test/models/treasure.rb +13 -0
  1888. data/rails/activerecord/test/models/treaty.rb +7 -0
  1889. data/rails/activerecord/test/models/tyre.rb +11 -0
  1890. data/rails/activerecord/test/models/uuid_child.rb +3 -0
  1891. data/rails/activerecord/test/models/uuid_parent.rb +3 -0
  1892. data/rails/activerecord/test/models/vegetables.rb +24 -0
  1893. data/rails/activerecord/test/models/vertex.rb +9 -0
  1894. data/rails/activerecord/test/models/warehouse_thing.rb +5 -0
  1895. data/rails/activerecord/test/models/wheel.rb +3 -0
  1896. data/rails/activerecord/test/models/without_table.rb +3 -0
  1897. data/rails/activerecord/test/models/zine.rb +3 -0
  1898. data/rails/activerecord/test/schema/mysql2_specific_schema.rb +58 -0
  1899. data/rails/activerecord/test/schema/mysql_specific_schema.rb +70 -0
  1900. data/rails/activerecord/test/schema/oracle_specific_schema.rb +43 -0
  1901. data/rails/activerecord/test/schema/postgresql_specific_schema.rb +198 -0
  1902. data/rails/activerecord/test/schema/schema.rb +905 -0
  1903. data/rails/activerecord/test/schema/sqlite_specific_schema.rb +22 -0
  1904. data/rails/activerecord/test/support/config.rb +43 -0
  1905. data/rails/activerecord/test/support/connection.rb +21 -0
  1906. data/rails/activerecord/test/support/connection_helper.rb +14 -0
  1907. data/rails/activerecord/test/support/ddl_helper.rb +8 -0
  1908. data/rails/activerecord/test/support/schema_dumping_helper.rb +20 -0
  1909. data/rails/activesupport/CHANGELOG.md +418 -0
  1910. data/rails/activesupport/MIT-LICENSE +20 -0
  1911. data/rails/activesupport/README.rdoc +40 -0
  1912. data/rails/activesupport/Rakefile +32 -0
  1913. data/rails/activesupport/activesupport.gemspec +28 -0
  1914. data/rails/activesupport/bin/generate_tables +144 -0
  1915. data/rails/activesupport/lib/active_support/all.rb +3 -0
  1916. data/rails/activesupport/lib/active_support/backtrace_cleaner.rb +103 -0
  1917. data/rails/activesupport/lib/active_support/benchmarkable.rb +49 -0
  1918. data/rails/activesupport/lib/active_support/builder.rb +6 -0
  1919. data/rails/activesupport/lib/active_support/cache/file_store.rb +190 -0
  1920. data/rails/activesupport/lib/active_support/cache/mem_cache_store.rb +198 -0
  1921. data/rails/activesupport/lib/active_support/cache/memory_store.rb +172 -0
  1922. data/rails/activesupport/lib/active_support/cache/null_store.rb +44 -0
  1923. data/rails/activesupport/lib/active_support/cache/strategy/local_cache.rb +161 -0
  1924. data/rails/activesupport/lib/active_support/cache/strategy/local_cache_middleware.rb +44 -0
  1925. data/rails/activesupport/lib/active_support/cache.rb +717 -0
  1926. data/rails/activesupport/lib/active_support/callbacks.rb +793 -0
  1927. data/rails/activesupport/lib/active_support/concern.rb +142 -0
  1928. data/rails/activesupport/lib/active_support/concurrency/latch.rb +27 -0
  1929. data/rails/activesupport/lib/active_support/configurable.rb +147 -0
  1930. data/rails/activesupport/lib/active_support/core_ext/array/access.rb +64 -0
  1931. data/rails/activesupport/lib/active_support/core_ext/array/conversions.rb +209 -0
  1932. data/rails/activesupport/lib/active_support/core_ext/array/extract_options.rb +29 -0
  1933. data/rails/activesupport/lib/active_support/core_ext/array/grouping.rb +116 -0
  1934. data/rails/activesupport/lib/active_support/core_ext/array/prepend_and_append.rb +7 -0
  1935. data/rails/activesupport/lib/active_support/core_ext/array/wrap.rb +45 -0
  1936. data/rails/activesupport/lib/active_support/core_ext/array.rb +6 -0
  1937. data/rails/activesupport/lib/active_support/core_ext/benchmark.rb +14 -0
  1938. data/rails/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb +16 -0
  1939. data/rails/activesupport/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +14 -0
  1940. data/rails/activesupport/lib/active_support/core_ext/big_decimal.rb +1 -0
  1941. data/rails/activesupport/lib/active_support/core_ext/class/attribute.rb +127 -0
  1942. data/rails/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +4 -0
  1943. data/rails/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb +45 -0
  1944. data/rails/activesupport/lib/active_support/core_ext/class/subclasses.rb +42 -0
  1945. data/rails/activesupport/lib/active_support/core_ext/class.rb +3 -0
  1946. data/rails/activesupport/lib/active_support/core_ext/date/acts_like.rb +8 -0
  1947. data/rails/activesupport/lib/active_support/core_ext/date/calculations.rb +143 -0
  1948. data/rails/activesupport/lib/active_support/core_ext/date/conversions.rb +88 -0
  1949. data/rails/activesupport/lib/active_support/core_ext/date/zones.rb +6 -0
  1950. data/rails/activesupport/lib/active_support/core_ext/date.rb +5 -0
  1951. data/rails/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb +251 -0
  1952. data/rails/activesupport/lib/active_support/core_ext/date_and_time/zones.rb +41 -0
  1953. data/rails/activesupport/lib/active_support/core_ext/date_time/acts_like.rb +14 -0
  1954. data/rails/activesupport/lib/active_support/core_ext/date_time/calculations.rb +173 -0
  1955. data/rails/activesupport/lib/active_support/core_ext/date_time/conversions.rb +103 -0
  1956. data/rails/activesupport/lib/active_support/core_ext/date_time/zones.rb +6 -0
  1957. data/rails/activesupport/lib/active_support/core_ext/date_time.rb +4 -0
  1958. data/rails/activesupport/lib/active_support/core_ext/digest/uuid.rb +51 -0
  1959. data/rails/activesupport/lib/active_support/core_ext/enumerable.rb +80 -0
  1960. data/rails/activesupport/lib/active_support/core_ext/file/atomic.rb +63 -0
  1961. data/rails/activesupport/lib/active_support/core_ext/file.rb +1 -0
  1962. data/rails/activesupport/lib/active_support/core_ext/hash/compact.rb +20 -0
  1963. data/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb +243 -0
  1964. data/rails/activesupport/lib/active_support/core_ext/hash/deep_merge.rb +38 -0
  1965. data/rails/activesupport/lib/active_support/core_ext/hash/except.rb +21 -0
  1966. data/rails/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +23 -0
  1967. data/rails/activesupport/lib/active_support/core_ext/hash/keys.rb +166 -0
  1968. data/rails/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb +22 -0
  1969. data/rails/activesupport/lib/active_support/core_ext/hash/slice.rb +48 -0
  1970. data/rails/activesupport/lib/active_support/core_ext/hash/transform_values.rb +23 -0
  1971. data/rails/activesupport/lib/active_support/core_ext/hash.rb +9 -0
  1972. data/rails/activesupport/lib/active_support/core_ext/integer/inflections.rb +29 -0
  1973. data/rails/activesupport/lib/active_support/core_ext/integer/multiple.rb +10 -0
  1974. data/rails/activesupport/lib/active_support/core_ext/integer/time.rb +44 -0
  1975. data/rails/activesupport/lib/active_support/core_ext/integer.rb +3 -0
  1976. data/rails/activesupport/lib/active_support/core_ext/kernel/agnostics.rb +11 -0
  1977. data/rails/activesupport/lib/active_support/core_ext/kernel/concern.rb +10 -0
  1978. data/rails/activesupport/lib/active_support/core_ext/kernel/debugger.rb +10 -0
  1979. data/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb +124 -0
  1980. data/rails/activesupport/lib/active_support/core_ext/kernel/singleton_class.rb +6 -0
  1981. data/rails/activesupport/lib/active_support/core_ext/kernel.rb +5 -0
  1982. data/rails/activesupport/lib/active_support/core_ext/load_error.rb +28 -0
  1983. data/rails/activesupport/lib/active_support/core_ext/marshal.rb +21 -0
  1984. data/rails/activesupport/lib/active_support/core_ext/module/aliasing.rb +69 -0
  1985. data/rails/activesupport/lib/active_support/core_ext/module/anonymous.rb +19 -0
  1986. data/rails/activesupport/lib/active_support/core_ext/module/attr_internal.rb +39 -0
  1987. data/rails/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +212 -0
  1988. data/rails/activesupport/lib/active_support/core_ext/module/concerning.rb +135 -0
  1989. data/rails/activesupport/lib/active_support/core_ext/module/delegation.rb +217 -0
  1990. data/rails/activesupport/lib/active_support/core_ext/module/deprecation.rb +23 -0
  1991. data/rails/activesupport/lib/active_support/core_ext/module/introspection.rb +62 -0
  1992. data/rails/activesupport/lib/active_support/core_ext/module/method_transplanting.rb +11 -0
  1993. data/rails/activesupport/lib/active_support/core_ext/module/qualified_const.rb +52 -0
  1994. data/rails/activesupport/lib/active_support/core_ext/module/reachable.rb +8 -0
  1995. data/rails/activesupport/lib/active_support/core_ext/module/remove_method.rb +12 -0
  1996. data/rails/activesupport/lib/active_support/core_ext/module.rb +11 -0
  1997. data/rails/activesupport/lib/active_support/core_ext/name_error.rb +18 -0
  1998. data/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb +44 -0
  1999. data/rails/activesupport/lib/active_support/core_ext/numeric/conversions.rb +135 -0
  2000. data/rails/activesupport/lib/active_support/core_ext/numeric/time.rb +69 -0
  2001. data/rails/activesupport/lib/active_support/core_ext/numeric.rb +3 -0
  2002. data/rails/activesupport/lib/active_support/core_ext/object/acts_like.rb +10 -0
  2003. data/rails/activesupport/lib/active_support/core_ext/object/blank.rb +131 -0
  2004. data/rails/activesupport/lib/active_support/core_ext/object/conversions.rb +4 -0
  2005. data/rails/activesupport/lib/active_support/core_ext/object/deep_dup.rb +46 -0
  2006. data/rails/activesupport/lib/active_support/core_ext/object/duplicable.rb +103 -0
  2007. data/rails/activesupport/lib/active_support/core_ext/object/inclusion.rb +27 -0
  2008. data/rails/activesupport/lib/active_support/core_ext/object/instance_variables.rb +28 -0
  2009. data/rails/activesupport/lib/active_support/core_ext/object/itself.rb +15 -0
  2010. data/rails/activesupport/lib/active_support/core_ext/object/json.rb +197 -0
  2011. data/rails/activesupport/lib/active_support/core_ext/object/to_param.rb +1 -0
  2012. data/rails/activesupport/lib/active_support/core_ext/object/to_query.rb +84 -0
  2013. data/rails/activesupport/lib/active_support/core_ext/object/try.rb +100 -0
  2014. data/rails/activesupport/lib/active_support/core_ext/object/with_options.rb +69 -0
  2015. data/rails/activesupport/lib/active_support/core_ext/object.rb +15 -0
  2016. data/rails/activesupport/lib/active_support/core_ext/range/conversions.rb +19 -0
  2017. data/rails/activesupport/lib/active_support/core_ext/range/each.rb +23 -0
  2018. data/rails/activesupport/lib/active_support/core_ext/range/include_range.rb +23 -0
  2019. data/rails/activesupport/lib/active_support/core_ext/range/overlaps.rb +8 -0
  2020. data/rails/activesupport/lib/active_support/core_ext/range.rb +4 -0
  2021. data/rails/activesupport/lib/active_support/core_ext/regexp.rb +5 -0
  2022. data/rails/activesupport/lib/active_support/core_ext/string/access.rb +104 -0
  2023. data/rails/activesupport/lib/active_support/core_ext/string/behavior.rb +6 -0
  2024. data/rails/activesupport/lib/active_support/core_ext/string/conversions.rb +56 -0
  2025. data/rails/activesupport/lib/active_support/core_ext/string/exclude.rb +11 -0
  2026. data/rails/activesupport/lib/active_support/core_ext/string/filters.rb +102 -0
  2027. data/rails/activesupport/lib/active_support/core_ext/string/indent.rb +43 -0
  2028. data/rails/activesupport/lib/active_support/core_ext/string/inflections.rb +217 -0
  2029. data/rails/activesupport/lib/active_support/core_ext/string/inquiry.rb +13 -0
  2030. data/rails/activesupport/lib/active_support/core_ext/string/multibyte.rb +49 -0
  2031. data/rails/activesupport/lib/active_support/core_ext/string/output_safety.rb +262 -0
  2032. data/rails/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb +4 -0
  2033. data/rails/activesupport/lib/active_support/core_ext/string/strip.rb +26 -0
  2034. data/rails/activesupport/lib/active_support/core_ext/string/zones.rb +14 -0
  2035. data/rails/activesupport/lib/active_support/core_ext/string.rb +13 -0
  2036. data/rails/activesupport/lib/active_support/core_ext/struct.rb +6 -0
  2037. data/rails/activesupport/lib/active_support/core_ext/thread.rb +86 -0
  2038. data/rails/activesupport/lib/active_support/core_ext/time/acts_like.rb +8 -0
  2039. data/rails/activesupport/lib/active_support/core_ext/time/calculations.rb +265 -0
  2040. data/rails/activesupport/lib/active_support/core_ext/time/conversions.rb +65 -0
  2041. data/rails/activesupport/lib/active_support/core_ext/time/marshal.rb +30 -0
  2042. data/rails/activesupport/lib/active_support/core_ext/time/zones.rb +79 -0
  2043. data/rails/activesupport/lib/active_support/core_ext/time.rb +5 -0
  2044. data/rails/activesupport/lib/active_support/core_ext/uri.rb +26 -0
  2045. data/rails/activesupport/lib/active_support/core_ext.rb +3 -0
  2046. data/rails/activesupport/lib/active_support/dependencies/autoload.rb +77 -0
  2047. data/rails/activesupport/lib/active_support/dependencies.rb +762 -0
  2048. data/rails/activesupport/lib/active_support/deprecation/behaviors.rb +76 -0
  2049. data/rails/activesupport/lib/active_support/deprecation/instance_delegator.rb +24 -0
  2050. data/rails/activesupport/lib/active_support/deprecation/method_wrappers.rb +44 -0
  2051. data/rails/activesupport/lib/active_support/deprecation/proxy_wrappers.rb +126 -0
  2052. data/rails/activesupport/lib/active_support/deprecation/reporting.rb +94 -0
  2053. data/rails/activesupport/lib/active_support/deprecation.rb +43 -0
  2054. data/rails/activesupport/lib/active_support/descendants_tracker.rb +60 -0
  2055. data/rails/activesupport/lib/active_support/duration.rb +136 -0
  2056. data/rails/activesupport/lib/active_support/file_update_checker.rb +137 -0
  2057. data/rails/activesupport/lib/active_support/gem_version.rb +15 -0
  2058. data/rails/activesupport/lib/active_support/gzip.rb +36 -0
  2059. data/rails/activesupport/lib/active_support/hash_with_indifferent_access.rb +281 -0
  2060. data/rails/activesupport/lib/active_support/i18n.rb +13 -0
  2061. data/rails/activesupport/lib/active_support/i18n_railtie.rb +94 -0
  2062. data/rails/activesupport/lib/active_support/inflections.rb +70 -0
  2063. data/rails/activesupport/lib/active_support/inflector/inflections.rb +211 -0
  2064. data/rails/activesupport/lib/active_support/inflector/methods.rb +383 -0
  2065. data/rails/activesupport/lib/active_support/inflector/transliterate.rb +97 -0
  2066. data/rails/activesupport/lib/active_support/inflector.rb +7 -0
  2067. data/rails/activesupport/lib/active_support/json/decoding.rb +73 -0
  2068. data/rails/activesupport/lib/active_support/json/encoding.rb +172 -0
  2069. data/rails/activesupport/lib/active_support/json.rb +2 -0
  2070. data/rails/activesupport/lib/active_support/key_generator.rb +73 -0
  2071. data/rails/activesupport/lib/active_support/lazy_load_hooks.rb +48 -0
  2072. data/rails/activesupport/lib/active_support/locale/en.yml +133 -0
  2073. data/rails/activesupport/lib/active_support/log_subscriber/test_helper.rb +104 -0
  2074. data/rails/activesupport/lib/active_support/log_subscriber.rb +109 -0
  2075. data/rails/activesupport/lib/active_support/logger.rb +57 -0
  2076. data/rails/activesupport/lib/active_support/logger_silence.rb +24 -0
  2077. data/rails/activesupport/lib/active_support/message_encryptor.rb +107 -0
  2078. data/rails/activesupport/lib/active_support/message_verifier.rb +72 -0
  2079. data/rails/activesupport/lib/active_support/multibyte/chars.rb +222 -0
  2080. data/rails/activesupport/lib/active_support/multibyte/unicode.rb +390 -0
  2081. data/rails/activesupport/lib/active_support/multibyte.rb +21 -0
  2082. data/rails/activesupport/lib/active_support/notifications/fanout.rb +157 -0
  2083. data/rails/activesupport/lib/active_support/notifications/instrumenter.rb +73 -0
  2084. data/rails/activesupport/lib/active_support/notifications.rb +212 -0
  2085. data/rails/activesupport/lib/active_support/number_helper/number_converter.rb +182 -0
  2086. data/rails/activesupport/lib/active_support/number_helper/number_to_currency_converter.rb +46 -0
  2087. data/rails/activesupport/lib/active_support/number_helper/number_to_delimited_converter.rb +23 -0
  2088. data/rails/activesupport/lib/active_support/number_helper/number_to_human_converter.rb +66 -0
  2089. data/rails/activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb +58 -0
  2090. data/rails/activesupport/lib/active_support/number_helper/number_to_percentage_converter.rb +12 -0
  2091. data/rails/activesupport/lib/active_support/number_helper/number_to_phone_converter.rb +49 -0
  2092. data/rails/activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb +87 -0
  2093. data/rails/activesupport/lib/active_support/number_helper.rb +345 -0
  2094. data/rails/activesupport/lib/active_support/option_merger.rb +25 -0
  2095. data/rails/activesupport/lib/active_support/ordered_hash.rb +48 -0
  2096. data/rails/activesupport/lib/active_support/ordered_options.rb +67 -0
  2097. data/rails/activesupport/lib/active_support/per_thread_registry.rb +53 -0
  2098. data/rails/activesupport/lib/active_support/proxy_object.rb +13 -0
  2099. data/rails/activesupport/lib/active_support/rails.rb +27 -0
  2100. data/rails/activesupport/lib/active_support/railtie.rb +46 -0
  2101. data/rails/activesupport/lib/active_support/rescuable.rb +119 -0
  2102. data/rails/activesupport/lib/active_support/security_utils.rb +20 -0
  2103. data/rails/activesupport/lib/active_support/string_inquirer.rb +26 -0
  2104. data/rails/activesupport/lib/active_support/subscriber.rb +125 -0
  2105. data/rails/activesupport/lib/active_support/tagged_logging.rb +76 -0
  2106. data/rails/activesupport/lib/active_support/test_case.rb +100 -0
  2107. data/rails/activesupport/lib/active_support/testing/assertions.rb +97 -0
  2108. data/rails/activesupport/lib/active_support/testing/autorun.rb +5 -0
  2109. data/rails/activesupport/lib/active_support/testing/constant_lookup.rb +50 -0
  2110. data/rails/activesupport/lib/active_support/testing/declarative.rb +26 -0
  2111. data/rails/activesupport/lib/active_support/testing/deprecation.rb +35 -0
  2112. data/rails/activesupport/lib/active_support/testing/isolation.rb +101 -0
  2113. data/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb +50 -0
  2114. data/rails/activesupport/lib/active_support/testing/tagged_logging.rb +25 -0
  2115. data/rails/activesupport/lib/active_support/testing/time_helpers.rb +131 -0
  2116. data/rails/activesupport/lib/active_support/time.rb +18 -0
  2117. data/rails/activesupport/lib/active_support/time_with_zone.rb +409 -0
  2118. data/rails/activesupport/lib/active_support/values/time_zone.rb +428 -0
  2119. data/rails/activesupport/lib/active_support/values/unicode_tables.dat +0 -0
  2120. data/rails/activesupport/lib/active_support/version.rb +8 -0
  2121. data/rails/activesupport/lib/active_support/xml_mini/jdom.rb +180 -0
  2122. data/rails/activesupport/lib/active_support/xml_mini/libxml.rb +79 -0
  2123. data/rails/activesupport/lib/active_support/xml_mini/libxmlsax.rb +85 -0
  2124. data/rails/activesupport/lib/active_support/xml_mini/nokogiri.rb +83 -0
  2125. data/rails/activesupport/lib/active_support/xml_mini/nokogirisax.rb +87 -0
  2126. data/rails/activesupport/lib/active_support/xml_mini/rexml.rb +129 -0
  2127. data/rails/activesupport/lib/active_support/xml_mini.rb +191 -0
  2128. data/rails/activesupport/lib/active_support.rb +85 -0
  2129. data/rails/activesupport/test/abstract_unit.rb +45 -0
  2130. data/rails/activesupport/test/autoload_test.rb +81 -0
  2131. data/rails/activesupport/test/autoloading_fixtures/a/b.rb +2 -0
  2132. data/rails/activesupport/test/autoloading_fixtures/a/c/d.rb +2 -0
  2133. data/rails/activesupport/test/autoloading_fixtures/a/c/e/f.rb +2 -0
  2134. data/rails/activesupport/test/autoloading_fixtures/application.rb +1 -0
  2135. data/rails/activesupport/test/autoloading_fixtures/circular1.rb +6 -0
  2136. data/rails/activesupport/test/autoloading_fixtures/circular2.rb +4 -0
  2137. data/rails/activesupport/test/autoloading_fixtures/class_folder/class_folder_subclass.rb +3 -0
  2138. data/rails/activesupport/test/autoloading_fixtures/class_folder/inline_class.rb +2 -0
  2139. data/rails/activesupport/test/autoloading_fixtures/class_folder/nested_class.rb +7 -0
  2140. data/rails/activesupport/test/autoloading_fixtures/class_folder.rb +3 -0
  2141. data/rails/activesupport/test/autoloading_fixtures/conflict.rb +1 -0
  2142. data/rails/activesupport/test/autoloading_fixtures/counting_loader.rb +5 -0
  2143. data/rails/activesupport/test/autoloading_fixtures/cross_site_dependency.rb +2 -0
  2144. data/rails/activesupport/test/autoloading_fixtures/e.rb +2 -0
  2145. data/rails/activesupport/test/autoloading_fixtures/html/some_class.rb +4 -0
  2146. data/rails/activesupport/test/autoloading_fixtures/load_path/loaded_constant.rb +3 -0
  2147. data/rails/activesupport/test/autoloading_fixtures/loads_constant.rb +5 -0
  2148. data/rails/activesupport/test/autoloading_fixtures/module_folder/inline_class.rb +2 -0
  2149. data/rails/activesupport/test/autoloading_fixtures/module_folder/nested_class.rb +4 -0
  2150. data/rails/activesupport/test/autoloading_fixtures/module_folder/nested_sibling.rb +2 -0
  2151. data/rails/activesupport/test/autoloading_fixtures/module_with_custom_const_missing/a/b.rb +1 -0
  2152. data/rails/activesupport/test/autoloading_fixtures/multiple_constant_file.rb +2 -0
  2153. data/rails/activesupport/test/autoloading_fixtures/raises_name_error.rb +3 -0
  2154. data/rails/activesupport/test/autoloading_fixtures/raises_no_method_error.rb +3 -0
  2155. data/rails/activesupport/test/autoloading_fixtures/requires_constant.rb +5 -0
  2156. data/rails/activesupport/test/autoloading_fixtures/should_not_be_required.rb +1 -0
  2157. data/rails/activesupport/test/autoloading_fixtures/typo.rb +2 -0
  2158. data/rails/activesupport/test/benchmarkable_test.rb +62 -0
  2159. data/rails/activesupport/test/broadcast_logger_test.rb +82 -0
  2160. data/rails/activesupport/test/caching_test.rb +1076 -0
  2161. data/rails/activesupport/test/callback_inheritance_test.rb +176 -0
  2162. data/rails/activesupport/test/callbacks_test.rb +1003 -0
  2163. data/rails/activesupport/test/class_cache_test.rb +78 -0
  2164. data/rails/activesupport/test/clean_backtrace_test.rb +75 -0
  2165. data/rails/activesupport/test/clean_logger_test.rb +29 -0
  2166. data/rails/activesupport/test/concern_test.rb +104 -0
  2167. data/rails/activesupport/test/configurable_test.rb +123 -0
  2168. data/rails/activesupport/test/constantize_test_cases.rb +116 -0
  2169. data/rails/activesupport/test/core_ext/array/access_test.rb +30 -0
  2170. data/rails/activesupport/test/core_ext/array/conversions_test.rb +197 -0
  2171. data/rails/activesupport/test/core_ext/array/extract_options_test.rb +45 -0
  2172. data/rails/activesupport/test/core_ext/array/grouping_test.rb +126 -0
  2173. data/rails/activesupport/test/core_ext/array/prepend_append_test.rb +12 -0
  2174. data/rails/activesupport/test/core_ext/array/wrap_test.rb +77 -0
  2175. data/rails/activesupport/test/core_ext/big_decimal/yaml_conversions_test.rb +11 -0
  2176. data/rails/activesupport/test/core_ext/bigdecimal_test.rb +9 -0
  2177. data/rails/activesupport/test/core_ext/class/attribute_test.rb +91 -0
  2178. data/rails/activesupport/test/core_ext/class/delegating_attributes_test.rb +122 -0
  2179. data/rails/activesupport/test/core_ext/class_test.rb +28 -0
  2180. data/rails/activesupport/test/core_ext/date_and_time_behavior.rb +241 -0
  2181. data/rails/activesupport/test/core_ext/date_ext_test.rb +373 -0
  2182. data/rails/activesupport/test/core_ext/date_time_ext_test.rb +358 -0
  2183. data/rails/activesupport/test/core_ext/digest/uuid_test.rb +24 -0
  2184. data/rails/activesupport/test/core_ext/duration_test.rb +223 -0
  2185. data/rails/activesupport/test/core_ext/enumerable_test.rb +106 -0
  2186. data/rails/activesupport/test/core_ext/file_test.rb +68 -0
  2187. data/rails/activesupport/test/core_ext/hash/transform_keys_test.rb +32 -0
  2188. data/rails/activesupport/test/core_ext/hash/transform_values_test.rb +61 -0
  2189. data/rails/activesupport/test/core_ext/hash_ext_test.rb +1688 -0
  2190. data/rails/activesupport/test/core_ext/integer_ext_test.rb +30 -0
  2191. data/rails/activesupport/test/core_ext/kernel/concern_test.rb +13 -0
  2192. data/rails/activesupport/test/core_ext/kernel_test.rb +138 -0
  2193. data/rails/activesupport/test/core_ext/load_error_test.rb +41 -0
  2194. data/rails/activesupport/test/core_ext/marshal_test.rb +124 -0
  2195. data/rails/activesupport/test/core_ext/module/anonymous_test.rb +14 -0
  2196. data/rails/activesupport/test/core_ext/module/attr_internal_test.rb +53 -0
  2197. data/rails/activesupport/test/core_ext/module/attribute_accessor_test.rb +79 -0
  2198. data/rails/activesupport/test/core_ext/module/attribute_aliasing_test.rb +59 -0
  2199. data/rails/activesupport/test/core_ext/module/concerning_test.rb +65 -0
  2200. data/rails/activesupport/test/core_ext/module/qualified_const_test.rb +108 -0
  2201. data/rails/activesupport/test/core_ext/module/reachable_test.rb +41 -0
  2202. data/rails/activesupport/test/core_ext/module/remove_method_test.rb +29 -0
  2203. data/rails/activesupport/test/core_ext/module_test.rb +509 -0
  2204. data/rails/activesupport/test/core_ext/name_error_test.rb +21 -0
  2205. data/rails/activesupport/test/core_ext/numeric_ext_test.rb +392 -0
  2206. data/rails/activesupport/test/core_ext/object/acts_like_test.rb +33 -0
  2207. data/rails/activesupport/test/core_ext/object/blank_test.rb +36 -0
  2208. data/rails/activesupport/test/core_ext/object/deep_dup_test.rb +53 -0
  2209. data/rails/activesupport/test/core_ext/object/duplicable_test.rb +31 -0
  2210. data/rails/activesupport/test/core_ext/object/inclusion_test.rb +59 -0
  2211. data/rails/activesupport/test/core_ext/object/instance_variables_test.rb +31 -0
  2212. data/rails/activesupport/test/core_ext/object/itself_test.rb +9 -0
  2213. data/rails/activesupport/test/core_ext/object/json_cherry_pick_test.rb +42 -0
  2214. data/rails/activesupport/test/core_ext/object/to_param_test.rb +37 -0
  2215. data/rails/activesupport/test/core_ext/object/to_query_test.rb +82 -0
  2216. data/rails/activesupport/test/core_ext/object/try_test.rb +99 -0
  2217. data/rails/activesupport/test/core_ext/range_ext_test.rb +125 -0
  2218. data/rails/activesupport/test/core_ext/regexp_ext_test.rb +10 -0
  2219. data/rails/activesupport/test/core_ext/string_ext_test.rb +864 -0
  2220. data/rails/activesupport/test/core_ext/struct_test.rb +10 -0
  2221. data/rails/activesupport/test/core_ext/thread_test.rb +75 -0
  2222. data/rails/activesupport/test/core_ext/time_ext_test.rb +901 -0
  2223. data/rails/activesupport/test/core_ext/time_with_zone_test.rb +1121 -0
  2224. data/rails/activesupport/test/core_ext/uri_ext_test.rb +13 -0
  2225. data/rails/activesupport/test/dependencies/check_warnings.rb +2 -0
  2226. data/rails/activesupport/test/dependencies/conflict.rb +1 -0
  2227. data/rails/activesupport/test/dependencies/cross_site_depender.rb +3 -0
  2228. data/rails/activesupport/test/dependencies/mutual_one.rb +4 -0
  2229. data/rails/activesupport/test/dependencies/mutual_two.rb +4 -0
  2230. data/rails/activesupport/test/dependencies/raises_exception.rb +3 -0
  2231. data/rails/activesupport/test/dependencies/raises_exception_without_blame_file.rb +5 -0
  2232. data/rails/activesupport/test/dependencies/requires_nonexistent0.rb +1 -0
  2233. data/rails/activesupport/test/dependencies/requires_nonexistent1.rb +1 -0
  2234. data/rails/activesupport/test/dependencies/service_one.rb +5 -0
  2235. data/rails/activesupport/test/dependencies/service_two.rb +2 -0
  2236. data/rails/activesupport/test/dependencies_test.rb +1059 -0
  2237. data/rails/activesupport/test/dependencies_test_helpers.rb +28 -0
  2238. data/rails/activesupport/test/deprecation/proxy_wrappers_test.rb +22 -0
  2239. data/rails/activesupport/test/deprecation_test.rb +375 -0
  2240. data/rails/activesupport/test/descendants_tracker_test_cases.rb +65 -0
  2241. data/rails/activesupport/test/descendants_tracker_with_autoloading_test.rb +34 -0
  2242. data/rails/activesupport/test/descendants_tracker_without_autoloading_test.rb +17 -0
  2243. data/rails/activesupport/test/file_update_checker_test.rb +112 -0
  2244. data/rails/activesupport/test/fixtures/autoload/another_class.rb +2 -0
  2245. data/rails/activesupport/test/fixtures/autoload/some_class.rb +2 -0
  2246. data/rails/activesupport/test/fixtures/xml/jdom_doctype.dtd +1 -0
  2247. data/rails/activesupport/test/fixtures/xml/jdom_entities.txt +1 -0
  2248. data/rails/activesupport/test/fixtures/xml/jdom_include.txt +1 -0
  2249. data/rails/activesupport/test/gzip_test.rb +33 -0
  2250. data/rails/activesupport/test/hash_with_indifferent_access_test.rb +10 -0
  2251. data/rails/activesupport/test/i18n_test.rb +104 -0
  2252. data/rails/activesupport/test/inflector_test.rb +537 -0
  2253. data/rails/activesupport/test/inflector_test_cases.rb +324 -0
  2254. data/rails/activesupport/test/json/decoding_test.rb +113 -0
  2255. data/rails/activesupport/test/json/encoding_test.rb +547 -0
  2256. data/rails/activesupport/test/key_generator_test.rb +62 -0
  2257. data/rails/activesupport/test/lazy_load_hooks_test.rb +96 -0
  2258. data/rails/activesupport/test/load_paths_test.rb +16 -0
  2259. data/rails/activesupport/test/log_subscriber_test.rb +123 -0
  2260. data/rails/activesupport/test/logger_test.rb +133 -0
  2261. data/rails/activesupport/test/message_encryptor_test.rb +101 -0
  2262. data/rails/activesupport/test/message_verifier_test.rb +86 -0
  2263. data/rails/activesupport/test/multibyte_chars_test.rb +714 -0
  2264. data/rails/activesupport/test/multibyte_conformance_test.rb +133 -0
  2265. data/rails/activesupport/test/multibyte_proxy_test.rb +34 -0
  2266. data/rails/activesupport/test/multibyte_test_helpers.rb +19 -0
  2267. data/rails/activesupport/test/multibyte_unicode_database_test.rb +26 -0
  2268. data/rails/activesupport/test/notifications/evented_notification_test.rb +87 -0
  2269. data/rails/activesupport/test/notifications/instrumenter_test.rb +58 -0
  2270. data/rails/activesupport/test/notifications_test.rb +266 -0
  2271. data/rails/activesupport/test/number_helper_i18n_test.rb +148 -0
  2272. data/rails/activesupport/test/number_helper_test.rb +396 -0
  2273. data/rails/activesupport/test/option_merger_test.rb +95 -0
  2274. data/rails/activesupport/test/ordered_hash_test.rb +322 -0
  2275. data/rails/activesupport/test/ordered_options_test.rb +88 -0
  2276. data/rails/activesupport/test/rescuable_test.rb +105 -0
  2277. data/rails/activesupport/test/safe_buffer_test.rb +180 -0
  2278. data/rails/activesupport/test/security_utils_test.rb +9 -0
  2279. data/rails/activesupport/test/string_inquirer_test.rb +23 -0
  2280. data/rails/activesupport/test/subscriber_test.rb +54 -0
  2281. data/rails/activesupport/test/tagged_logging_test.rb +102 -0
  2282. data/rails/activesupport/test/test_case_test.rb +221 -0
  2283. data/rails/activesupport/test/testing/constant_lookup_test.rb +76 -0
  2284. data/rails/activesupport/test/time_travel_test.rb +72 -0
  2285. data/rails/activesupport/test/time_zone_test.rb +422 -0
  2286. data/rails/activesupport/test/time_zone_test_helpers.rb +16 -0
  2287. data/rails/activesupport/test/transliterate_test.rb +35 -0
  2288. data/rails/activesupport/test/xml_mini/jdom_engine_test.rb +188 -0
  2289. data/rails/activesupport/test/xml_mini/libxml_engine_test.rb +204 -0
  2290. data/rails/activesupport/test/xml_mini/libxmlsax_engine_test.rb +195 -0
  2291. data/rails/activesupport/test/xml_mini/nokogiri_engine_test.rb +217 -0
  2292. data/rails/activesupport/test/xml_mini/nokogirisax_engine_test.rb +218 -0
  2293. data/rails/activesupport/test/xml_mini/rexml_engine_test.rb +37 -0
  2294. data/rails/activesupport/test/xml_mini_test.rb +353 -0
  2295. data/rails/ci/travis.rb +145 -0
  2296. data/rails/guides/.document +0 -0
  2297. data/rails/guides/CHANGELOG.md +31 -0
  2298. data/rails/guides/Rakefile +79 -0
  2299. data/rails/guides/assets/images/akshaysurve.jpg +0 -0
  2300. data/rails/guides/assets/images/belongs_to.png +0 -0
  2301. data/rails/guides/assets/images/book_icon.gif +0 -0
  2302. data/rails/guides/assets/images/bullet.gif +0 -0
  2303. data/rails/guides/assets/images/chapters_icon.gif +0 -0
  2304. data/rails/guides/assets/images/check_bullet.gif +0 -0
  2305. data/rails/guides/assets/images/credits_pic_blank.gif +0 -0
  2306. data/rails/guides/assets/images/csrf.png +0 -0
  2307. data/rails/guides/assets/images/edge_badge.png +0 -0
  2308. data/rails/guides/assets/images/favicon.ico +0 -0
  2309. data/rails/guides/assets/images/feature_tile.gif +0 -0
  2310. data/rails/guides/assets/images/footer_tile.gif +0 -0
  2311. data/rails/guides/assets/images/fxn.png +0 -0
  2312. data/rails/guides/assets/images/getting_started/article_with_comments.png +0 -0
  2313. data/rails/guides/assets/images/getting_started/challenge.png +0 -0
  2314. data/rails/guides/assets/images/getting_started/confirm_dialog.png +0 -0
  2315. data/rails/guides/assets/images/getting_started/forbidden_attributes_for_new_article.png +0 -0
  2316. data/rails/guides/assets/images/getting_started/form_with_errors.png +0 -0
  2317. data/rails/guides/assets/images/getting_started/index_action_with_edit_link.png +0 -0
  2318. data/rails/guides/assets/images/getting_started/new_article.png +0 -0
  2319. data/rails/guides/assets/images/getting_started/rails_welcome.png +0 -0
  2320. data/rails/guides/assets/images/getting_started/routing_error_no_controller.png +0 -0
  2321. data/rails/guides/assets/images/getting_started/routing_error_no_route_matches.png +0 -0
  2322. data/rails/guides/assets/images/getting_started/show_action_for_articles.png +0 -0
  2323. data/rails/guides/assets/images/getting_started/template_is_missing_articles_new.png +0 -0
  2324. data/rails/guides/assets/images/getting_started/unknown_action_create_for_articles.png +0 -0
  2325. data/rails/guides/assets/images/getting_started/unknown_action_new_for_articles.png +0 -0
  2326. data/rails/guides/assets/images/grey_bullet.gif +0 -0
  2327. data/rails/guides/assets/images/habtm.png +0 -0
  2328. data/rails/guides/assets/images/has_many.png +0 -0
  2329. data/rails/guides/assets/images/has_many_through.png +0 -0
  2330. data/rails/guides/assets/images/has_one.png +0 -0
  2331. data/rails/guides/assets/images/has_one_through.png +0 -0
  2332. data/rails/guides/assets/images/header_backdrop.png +0 -0
  2333. data/rails/guides/assets/images/header_tile.gif +0 -0
  2334. data/rails/guides/assets/images/i18n/demo_html_safe.png +0 -0
  2335. data/rails/guides/assets/images/i18n/demo_localized_pirate.png +0 -0
  2336. data/rails/guides/assets/images/i18n/demo_translated_en.png +0 -0
  2337. data/rails/guides/assets/images/i18n/demo_translated_pirate.png +0 -0
  2338. data/rails/guides/assets/images/i18n/demo_translation_missing.png +0 -0
  2339. data/rails/guides/assets/images/i18n/demo_untranslated.png +0 -0
  2340. data/rails/guides/assets/images/icons/README +5 -0
  2341. data/rails/guides/assets/images/icons/callouts/1.png +0 -0
  2342. data/rails/guides/assets/images/icons/callouts/10.png +0 -0
  2343. data/rails/guides/assets/images/icons/callouts/11.png +0 -0
  2344. data/rails/guides/assets/images/icons/callouts/12.png +0 -0
  2345. data/rails/guides/assets/images/icons/callouts/13.png +0 -0
  2346. data/rails/guides/assets/images/icons/callouts/14.png +0 -0
  2347. data/rails/guides/assets/images/icons/callouts/15.png +0 -0
  2348. data/rails/guides/assets/images/icons/callouts/2.png +0 -0
  2349. data/rails/guides/assets/images/icons/callouts/3.png +0 -0
  2350. data/rails/guides/assets/images/icons/callouts/4.png +0 -0
  2351. data/rails/guides/assets/images/icons/callouts/5.png +0 -0
  2352. data/rails/guides/assets/images/icons/callouts/6.png +0 -0
  2353. data/rails/guides/assets/images/icons/callouts/7.png +0 -0
  2354. data/rails/guides/assets/images/icons/callouts/8.png +0 -0
  2355. data/rails/guides/assets/images/icons/callouts/9.png +0 -0
  2356. data/rails/guides/assets/images/icons/caution.png +0 -0
  2357. data/rails/guides/assets/images/icons/example.png +0 -0
  2358. data/rails/guides/assets/images/icons/home.png +0 -0
  2359. data/rails/guides/assets/images/icons/important.png +0 -0
  2360. data/rails/guides/assets/images/icons/next.png +0 -0
  2361. data/rails/guides/assets/images/icons/note.png +0 -0
  2362. data/rails/guides/assets/images/icons/prev.png +0 -0
  2363. data/rails/guides/assets/images/icons/tip.png +0 -0
  2364. data/rails/guides/assets/images/icons/up.png +0 -0
  2365. data/rails/guides/assets/images/icons/warning.png +0 -0
  2366. data/rails/guides/assets/images/nav_arrow.gif +0 -0
  2367. data/rails/guides/assets/images/oscardelben.jpg +0 -0
  2368. data/rails/guides/assets/images/polymorphic.png +0 -0
  2369. data/rails/guides/assets/images/radar.png +0 -0
  2370. data/rails/guides/assets/images/rails4_features.png +0 -0
  2371. data/rails/guides/assets/images/rails_guides_kindle_cover.jpg +0 -0
  2372. data/rails/guides/assets/images/rails_guides_logo.gif +0 -0
  2373. data/rails/guides/assets/images/rails_logo_remix.gif +0 -0
  2374. data/rails/guides/assets/images/session_fixation.png +0 -0
  2375. data/rails/guides/assets/images/tab_grey.gif +0 -0
  2376. data/rails/guides/assets/images/tab_info.gif +0 -0
  2377. data/rails/guides/assets/images/tab_note.gif +0 -0
  2378. data/rails/guides/assets/images/tab_red.gif +0 -0
  2379. data/rails/guides/assets/images/tab_yellow.gif +0 -0
  2380. data/rails/guides/assets/images/tab_yellow.png +0 -0
  2381. data/rails/guides/assets/images/vijaydev.jpg +0 -0
  2382. data/rails/guides/assets/javascripts/guides.js +59 -0
  2383. data/rails/guides/assets/javascripts/jquery.min.js +4 -0
  2384. data/rails/guides/assets/javascripts/responsive-tables.js +43 -0
  2385. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushAS3.js +59 -0
  2386. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushAppleScript.js +75 -0
  2387. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushBash.js +59 -0
  2388. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushCSharp.js +65 -0
  2389. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushColdFusion.js +100 -0
  2390. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushCpp.js +97 -0
  2391. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushCss.js +91 -0
  2392. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushDelphi.js +55 -0
  2393. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushDiff.js +41 -0
  2394. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushErlang.js +52 -0
  2395. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushGroovy.js +67 -0
  2396. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushJScript.js +52 -0
  2397. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushJava.js +57 -0
  2398. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushJavaFX.js +58 -0
  2399. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushPerl.js +72 -0
  2400. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushPhp.js +88 -0
  2401. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushPlain.js +33 -0
  2402. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushPowerShell.js +74 -0
  2403. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushPython.js +64 -0
  2404. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushRuby.js +55 -0
  2405. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushSass.js +94 -0
  2406. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushScala.js +51 -0
  2407. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushSql.js +66 -0
  2408. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushVb.js +56 -0
  2409. data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushXml.js +69 -0
  2410. data/rails/guides/assets/javascripts/syntaxhighlighter/shCore.js +17 -0
  2411. data/rails/guides/assets/stylesheets/fixes.css +16 -0
  2412. data/rails/guides/assets/stylesheets/kindle.css +11 -0
  2413. data/rails/guides/assets/stylesheets/main.css +713 -0
  2414. data/rails/guides/assets/stylesheets/print.css +52 -0
  2415. data/rails/guides/assets/stylesheets/reset.css +43 -0
  2416. data/rails/guides/assets/stylesheets/responsive-tables.css +50 -0
  2417. data/rails/guides/assets/stylesheets/style.css +13 -0
  2418. data/rails/guides/assets/stylesheets/syntaxhighlighter/shCore.css +226 -0
  2419. data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreDefault.css +328 -0
  2420. data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreDjango.css +331 -0
  2421. data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreEclipse.css +339 -0
  2422. data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreEmacs.css +324 -0
  2423. data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +328 -0
  2424. data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreMDUltra.css +324 -0
  2425. data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreMidnight.css +324 -0
  2426. data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreRDark.css +324 -0
  2427. data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeDefault.css +117 -0
  2428. data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeDjango.css +120 -0
  2429. data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeEclipse.css +128 -0
  2430. data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeEmacs.css +113 -0
  2431. data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +117 -0
  2432. data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeMDUltra.css +113 -0
  2433. data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeMidnight.css +113 -0
  2434. data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeRDark.css +113 -0
  2435. data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +116 -0
  2436. data/rails/guides/bug_report_templates/action_controller_gem.rb +47 -0
  2437. data/rails/guides/bug_report_templates/action_controller_master.rb +54 -0
  2438. data/rails/guides/bug_report_templates/active_record_gem.rb +40 -0
  2439. data/rails/guides/bug_report_templates/active_record_master.rb +49 -0
  2440. data/rails/guides/rails_guides/generator.rb +248 -0
  2441. data/rails/guides/rails_guides/helpers.rb +53 -0
  2442. data/rails/guides/rails_guides/indexer.rb +68 -0
  2443. data/rails/guides/rails_guides/kindle.rb +119 -0
  2444. data/rails/guides/rails_guides/levenshtein.rb +39 -0
  2445. data/rails/guides/rails_guides/markdown/renderer.rb +82 -0
  2446. data/rails/guides/rails_guides/markdown.rb +167 -0
  2447. data/rails/guides/rails_guides.rb +63 -0
  2448. data/rails/guides/source/2_2_release_notes.md +435 -0
  2449. data/rails/guides/source/2_3_release_notes.md +621 -0
  2450. data/rails/guides/source/3_0_release_notes.md +611 -0
  2451. data/rails/guides/source/3_1_release_notes.md +559 -0
  2452. data/rails/guides/source/3_2_release_notes.md +568 -0
  2453. data/rails/guides/source/4_0_release_notes.md +279 -0
  2454. data/rails/guides/source/4_1_release_notes.md +730 -0
  2455. data/rails/guides/source/4_2_release_notes.md +853 -0
  2456. data/rails/guides/source/_license.html.erb +2 -0
  2457. data/rails/guides/source/_welcome.html.erb +19 -0
  2458. data/rails/guides/source/action_controller_overview.md +1192 -0
  2459. data/rails/guides/source/action_mailer_basics.md +754 -0
  2460. data/rails/guides/source/action_view_overview.md +1620 -0
  2461. data/rails/guides/source/active_job_basics.md +318 -0
  2462. data/rails/guides/source/active_model_basics.md +554 -0
  2463. data/rails/guides/source/active_record_basics.md +374 -0
  2464. data/rails/guides/source/active_record_callbacks.md +413 -0
  2465. data/rails/guides/source/active_record_migrations.md +1018 -0
  2466. data/rails/guides/source/active_record_postgresql.md +433 -0
  2467. data/rails/guides/source/active_record_querying.md +1783 -0
  2468. data/rails/guides/source/active_record_validations.md +1178 -0
  2469. data/rails/guides/source/active_support_core_extensions.md +3904 -0
  2470. data/rails/guides/source/active_support_instrumentation.md +499 -0
  2471. data/rails/guides/source/api_documentation_guidelines.md +361 -0
  2472. data/rails/guides/source/asset_pipeline.md +1360 -0
  2473. data/rails/guides/source/association_basics.md +2235 -0
  2474. data/rails/guides/source/autoloading_and_reloading_constants.md +1310 -0
  2475. data/rails/guides/source/caching_with_rails.md +379 -0
  2476. data/rails/guides/source/command_line.md +625 -0
  2477. data/rails/guides/source/configuring.md +1045 -0
  2478. data/rails/guides/source/contributing_to_ruby_on_rails.md +628 -0
  2479. data/rails/guides/source/credits.html.erb +80 -0
  2480. data/rails/guides/source/debugging_rails_applications.md +861 -0
  2481. data/rails/guides/source/development_dependencies_install.md +289 -0
  2482. data/rails/guides/source/documents.yaml +205 -0
  2483. data/rails/guides/source/engines.md +1412 -0
  2484. data/rails/guides/source/form_helpers.md +1024 -0
  2485. data/rails/guides/source/generators.md +676 -0
  2486. data/rails/guides/source/getting_started.md +2091 -0
  2487. data/rails/guides/source/i18n.md +1087 -0
  2488. data/rails/guides/source/index.html.erb +28 -0
  2489. data/rails/guides/source/initialization.md +704 -0
  2490. data/rails/guides/source/kindle/copyright.html.erb +1 -0
  2491. data/rails/guides/source/kindle/layout.html.erb +27 -0
  2492. data/rails/guides/source/kindle/rails_guides.opf.erb +52 -0
  2493. data/rails/guides/source/kindle/toc.html.erb +24 -0
  2494. data/rails/guides/source/kindle/toc.ncx.erb +64 -0
  2495. data/rails/guides/source/kindle/welcome.html.erb +5 -0
  2496. data/rails/guides/source/layout.html.erb +143 -0
  2497. data/rails/guides/source/layouts_and_rendering.md +1227 -0
  2498. data/rails/guides/source/maintenance_policy.md +78 -0
  2499. data/rails/guides/source/nested_model_forms.md +228 -0
  2500. data/rails/guides/source/plugins.md +444 -0
  2501. data/rails/guides/source/rails_application_templates.md +266 -0
  2502. data/rails/guides/source/rails_on_rack.md +336 -0
  2503. data/rails/guides/source/routing.md +1141 -0
  2504. data/rails/guides/source/ruby_on_rails_guides_guidelines.md +127 -0
  2505. data/rails/guides/source/security.md +1024 -0
  2506. data/rails/guides/source/testing.md +1132 -0
  2507. data/rails/guides/source/upgrading_ruby_on_rails.md +1170 -0
  2508. data/rails/guides/source/working_with_javascript_in_rails.md +407 -0
  2509. data/rails/guides/w3c_validator.rb +97 -0
  2510. data/rails/install.rb +16 -0
  2511. data/rails/load_paths.rb +3 -0
  2512. data/rails/rails.gemspec +32 -0
  2513. data/rails/railties/.gitignore +1 -0
  2514. data/rails/railties/CHANGELOG.md +233 -0
  2515. data/rails/railties/MIT-LICENSE +20 -0
  2516. data/rails/railties/RDOC_MAIN.rdoc +73 -0
  2517. data/rails/railties/README.rdoc +41 -0
  2518. data/rails/railties/Rakefile +50 -0
  2519. data/rails/railties/bin/rails +9 -0
  2520. data/rails/railties/lib/rails/all.rb +16 -0
  2521. data/rails/railties/lib/rails/api/task.rb +170 -0
  2522. data/rails/railties/lib/rails/app_rails_loader.rb +63 -0
  2523. data/rails/railties/lib/rails/application/bootstrap.rb +94 -0
  2524. data/rails/railties/lib/rails/application/configuration.rb +208 -0
  2525. data/rails/railties/lib/rails/application/default_middleware_stack.rb +103 -0
  2526. data/rails/railties/lib/rails/application/finisher.rb +113 -0
  2527. data/rails/railties/lib/rails/application/routes_reloader.rb +56 -0
  2528. data/rails/railties/lib/rails/application.rb +539 -0
  2529. data/rails/railties/lib/rails/application_controller.rb +16 -0
  2530. data/rails/railties/lib/rails/backtrace_cleaner.rb +32 -0
  2531. data/rails/railties/lib/rails/cli.rb +15 -0
  2532. data/rails/railties/lib/rails/code_statistics.rb +104 -0
  2533. data/rails/railties/lib/rails/code_statistics_calculator.rb +79 -0
  2534. data/rails/railties/lib/rails/commands/application.rb +17 -0
  2535. data/rails/railties/lib/rails/commands/commands_tasks.rb +169 -0
  2536. data/rails/railties/lib/rails/commands/console.rb +113 -0
  2537. data/rails/railties/lib/rails/commands/dbconsole.rb +192 -0
  2538. data/rails/railties/lib/rails/commands/destroy.rb +11 -0
  2539. data/rails/railties/lib/rails/commands/generate.rb +13 -0
  2540. data/rails/railties/lib/rails/commands/plugin.rb +23 -0
  2541. data/rails/railties/lib/rails/commands/runner.rb +63 -0
  2542. data/rails/railties/lib/rails/commands/server.rb +148 -0
  2543. data/rails/railties/lib/rails/commands.rb +17 -0
  2544. data/rails/railties/lib/rails/configuration.rb +119 -0
  2545. data/rails/railties/lib/rails/console/app.rb +32 -0
  2546. data/rails/railties/lib/rails/console/helpers.rb +17 -0
  2547. data/rails/railties/lib/rails/deprecation.rb +19 -0
  2548. data/rails/railties/lib/rails/engine/commands.rb +41 -0
  2549. data/rails/railties/lib/rails/engine/configuration.rb +91 -0
  2550. data/rails/railties/lib/rails/engine/railties.rb +21 -0
  2551. data/rails/railties/lib/rails/engine.rb +694 -0
  2552. data/rails/railties/lib/rails/gem_version.rb +15 -0
  2553. data/rails/railties/lib/rails/generators/actions/create_migration.rb +69 -0
  2554. data/rails/railties/lib/rails/generators/actions.rb +282 -0
  2555. data/rails/railties/lib/rails/generators/active_model.rb +78 -0
  2556. data/rails/railties/lib/rails/generators/app_base.rb +354 -0
  2557. data/rails/railties/lib/rails/generators/base.rb +379 -0
  2558. data/rails/railties/lib/rails/generators/css/assets/assets_generator.rb +13 -0
  2559. data/rails/railties/lib/rails/generators/css/assets/templates/stylesheet.css +4 -0
  2560. data/rails/railties/lib/rails/generators/css/scaffold/scaffold_generator.rb +16 -0
  2561. data/rails/railties/lib/rails/generators/erb/controller/controller_generator.rb +22 -0
  2562. data/rails/railties/lib/rails/generators/erb/controller/templates/view.html.erb +2 -0
  2563. data/rails/railties/lib/rails/generators/erb/mailer/mailer_generator.rb +36 -0
  2564. data/rails/railties/lib/rails/generators/erb/mailer/templates/layout.html.erb +5 -0
  2565. data/rails/railties/lib/rails/generators/erb/mailer/templates/layout.text.erb +1 -0
  2566. data/rails/railties/lib/rails/generators/erb/mailer/templates/view.html.erb +5 -0
  2567. data/rails/railties/lib/rails/generators/erb/mailer/templates/view.text.erb +3 -0
  2568. data/rails/railties/lib/rails/generators/erb/scaffold/scaffold_generator.rb +31 -0
  2569. data/rails/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb +32 -0
  2570. data/rails/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb +6 -0
  2571. data/rails/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb +31 -0
  2572. data/rails/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb +5 -0
  2573. data/rails/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb +11 -0
  2574. data/rails/railties/lib/rails/generators/erb.rb +25 -0
  2575. data/rails/railties/lib/rails/generators/generated_attribute.rb +170 -0
  2576. data/rails/railties/lib/rails/generators/js/assets/assets_generator.rb +13 -0
  2577. data/rails/railties/lib/rails/generators/js/assets/templates/javascript.js +2 -0
  2578. data/rails/railties/lib/rails/generators/migration.rb +69 -0
  2579. data/rails/railties/lib/rails/generators/model_helpers.rb +28 -0
  2580. data/rails/railties/lib/rails/generators/named_base.rb +205 -0
  2581. data/rails/railties/lib/rails/generators/rails/app/USAGE +15 -0
  2582. data/rails/railties/lib/rails/generators/rails/app/app_generator.rb +407 -0
  2583. data/rails/railties/lib/rails/generators/rails/app/templates/Gemfile +46 -0
  2584. data/rails/railties/lib/rails/generators/rails/app/templates/README.rdoc +28 -0
  2585. data/rails/railties/lib/rails/generators/rails/app/templates/Rakefile +6 -0
  2586. data/rails/railties/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +20 -0
  2587. data/rails/railties/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +15 -0
  2588. data/rails/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +5 -0
  2589. data/rails/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb +2 -0
  2590. data/rails/railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +23 -0
  2591. data/rails/railties/lib/rails/generators/rails/app/templates/bin/bundle +2 -0
  2592. data/rails/railties/lib/rails/generators/rails/app/templates/bin/rails +3 -0
  2593. data/rails/railties/lib/rails/generators/rails/app/templates/bin/rake +3 -0
  2594. data/rails/railties/lib/rails/generators/rails/app/templates/bin/setup +28 -0
  2595. data/rails/railties/lib/rails/generators/rails/app/templates/config/application.rb +41 -0
  2596. data/rails/railties/lib/rails/generators/rails/app/templates/config/boot.rb +3 -0
  2597. data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml +49 -0
  2598. data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +85 -0
  2599. data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml +68 -0
  2600. data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +52 -0
  2601. data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +68 -0
  2602. data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml +23 -0
  2603. data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +58 -0
  2604. data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +58 -0
  2605. data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +85 -0
  2606. data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml +25 -0
  2607. data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml +68 -0
  2608. data/rails/railties/lib/rails/generators/rails/app/templates/config/environment.rb +5 -0
  2609. data/rails/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +45 -0
  2610. data/rails/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +83 -0
  2611. data/rails/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +42 -0
  2612. data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +11 -0
  2613. data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb +7 -0
  2614. data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb +3 -0
  2615. data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb +4 -0
  2616. data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb +16 -0
  2617. data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb +4 -0
  2618. data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +3 -0
  2619. data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +16 -0
  2620. data/rails/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml +23 -0
  2621. data/rails/railties/lib/rails/generators/rails/app/templates/config/routes.rb +56 -0
  2622. data/rails/railties/lib/rails/generators/rails/app/templates/config/secrets.yml +22 -0
  2623. data/rails/railties/lib/rails/generators/rails/app/templates/config.ru +4 -0
  2624. data/rails/railties/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +7 -0
  2625. data/rails/railties/lib/rails/generators/rails/app/templates/gitignore +19 -0
  2626. data/rails/railties/lib/rails/generators/rails/app/templates/public/404.html +67 -0
  2627. data/rails/railties/lib/rails/generators/rails/app/templates/public/422.html +67 -0
  2628. data/rails/railties/lib/rails/generators/rails/app/templates/public/500.html +66 -0
  2629. data/rails/railties/lib/rails/generators/rails/app/templates/public/favicon.ico +0 -0
  2630. data/rails/railties/lib/rails/generators/rails/app/templates/public/robots.txt +5 -0
  2631. data/rails/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb +12 -0
  2632. data/rails/railties/lib/rails/generators/rails/assets/USAGE +20 -0
  2633. data/rails/railties/lib/rails/generators/rails/assets/assets_generator.rb +25 -0
  2634. data/rails/railties/lib/rails/generators/rails/assets/templates/javascript.js +2 -0
  2635. data/rails/railties/lib/rails/generators/rails/assets/templates/stylesheet.css +4 -0
  2636. data/rails/railties/lib/rails/generators/rails/controller/USAGE +18 -0
  2637. data/rails/railties/lib/rails/generators/rails/controller/controller_generator.rb +58 -0
  2638. data/rails/railties/lib/rails/generators/rails/controller/templates/controller.rb +13 -0
  2639. data/rails/railties/lib/rails/generators/rails/generator/USAGE +13 -0
  2640. data/rails/railties/lib/rails/generators/rails/generator/generator_generator.rb +27 -0
  2641. data/rails/railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +3 -0
  2642. data/rails/railties/lib/rails/generators/rails/generator/templates/USAGE.tt +8 -0
  2643. data/rails/railties/lib/rails/generators/rails/generator/templates/templates/.empty_directory +0 -0
  2644. data/rails/railties/lib/rails/generators/rails/helper/USAGE +13 -0
  2645. data/rails/railties/lib/rails/generators/rails/helper/helper_generator.rb +13 -0
  2646. data/rails/railties/lib/rails/generators/rails/helper/templates/helper.rb +4 -0
  2647. data/rails/railties/lib/rails/generators/rails/integration_test/USAGE +10 -0
  2648. data/rails/railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb +7 -0
  2649. data/rails/railties/lib/rails/generators/rails/migration/USAGE +35 -0
  2650. data/rails/railties/lib/rails/generators/rails/migration/migration_generator.rb +8 -0
  2651. data/rails/railties/lib/rails/generators/rails/model/USAGE +109 -0
  2652. data/rails/railties/lib/rails/generators/rails/model/model_generator.rb +12 -0
  2653. data/rails/railties/lib/rails/generators/rails/plugin/USAGE +10 -0
  2654. data/rails/railties/lib/rails/generators/rails/plugin/plugin_generator.rb +393 -0
  2655. data/rails/railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec +27 -0
  2656. data/rails/railties/lib/rails/generators/rails/plugin/templates/Gemfile +51 -0
  2657. data/rails/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE +20 -0
  2658. data/rails/railties/lib/rails/generators/rails/plugin/templates/README.rdoc +3 -0
  2659. data/rails/railties/lib/rails/generators/rails/plugin/templates/Rakefile +29 -0
  2660. data/rails/railties/lib/rails/generators/rails/plugin/templates/app/controllers/%name%/application_controller.rb.tt +4 -0
  2661. data/rails/railties/lib/rails/generators/rails/plugin/templates/app/helpers/%name%/application_helper.rb.tt +4 -0
  2662. data/rails/railties/lib/rails/generators/rails/plugin/templates/app/mailers/.empty_directory +0 -0
  2663. data/rails/railties/lib/rails/generators/rails/plugin/templates/app/models/.empty_directory +0 -0
  2664. data/rails/railties/lib/rails/generators/rails/plugin/templates/app/views/layouts/%name%/application.html.erb.tt +14 -0
  2665. data/rails/railties/lib/rails/generators/rails/plugin/templates/bin/rails.tt +11 -0
  2666. data/rails/railties/lib/rails/generators/rails/plugin/templates/config/routes.rb +6 -0
  2667. data/rails/railties/lib/rails/generators/rails/plugin/templates/gitignore +10 -0
  2668. data/rails/railties/lib/rails/generators/rails/plugin/templates/lib/%name%/engine.rb +7 -0
  2669. data/rails/railties/lib/rails/generators/rails/plugin/templates/lib/%name%/version.rb +3 -0
  2670. data/rails/railties/lib/rails/generators/rails/plugin/templates/lib/%name%.rb +6 -0
  2671. data/rails/railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%name%_tasks.rake +4 -0
  2672. data/rails/railties/lib/rails/generators/rails/plugin/templates/rails/application.rb +18 -0
  2673. data/rails/railties/lib/rails/generators/rails/plugin/templates/rails/boot.rb +5 -0
  2674. data/rails/railties/lib/rails/generators/rails/plugin/templates/rails/javascripts.js +13 -0
  2675. data/rails/railties/lib/rails/generators/rails/plugin/templates/rails/routes.rb +4 -0
  2676. data/rails/railties/lib/rails/generators/rails/plugin/templates/rails/stylesheets.css +15 -0
  2677. data/rails/railties/lib/rails/generators/rails/plugin/templates/test/%name%_test.rb +7 -0
  2678. data/rails/railties/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb +12 -0
  2679. data/rails/railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb +24 -0
  2680. data/rails/railties/lib/rails/generators/rails/resource/USAGE +23 -0
  2681. data/rails/railties/lib/rails/generators/rails/resource/resource_generator.rb +20 -0
  2682. data/rails/railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb +50 -0
  2683. data/rails/railties/lib/rails/generators/rails/scaffold/USAGE +41 -0
  2684. data/rails/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb +32 -0
  2685. data/rails/railties/lib/rails/generators/rails/scaffold/templates/scaffold.css +56 -0
  2686. data/rails/railties/lib/rails/generators/rails/scaffold_controller/USAGE +19 -0
  2687. data/rails/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +28 -0
  2688. data/rails/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +68 -0
  2689. data/rails/railties/lib/rails/generators/rails/task/USAGE +9 -0
  2690. data/rails/railties/lib/rails/generators/rails/task/task_generator.rb +12 -0
  2691. data/rails/railties/lib/rails/generators/rails/task/templates/task.rb +8 -0
  2692. data/rails/railties/lib/rails/generators/resource_helpers.rb +82 -0
  2693. data/rails/railties/lib/rails/generators/test_case.rb +36 -0
  2694. data/rails/railties/lib/rails/generators/test_unit/controller/controller_generator.rb +15 -0
  2695. data/rails/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb +19 -0
  2696. data/rails/railties/lib/rails/generators/test_unit/generator/generator_generator.rb +26 -0
  2697. data/rails/railties/lib/rails/generators/test_unit/generator/templates/generator_test.rb +16 -0
  2698. data/rails/railties/lib/rails/generators/test_unit/helper/helper_generator.rb +9 -0
  2699. data/rails/railties/lib/rails/generators/test_unit/integration/integration_generator.rb +13 -0
  2700. data/rails/railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb +7 -0
  2701. data/rails/railties/lib/rails/generators/test_unit/job/job_generator.rb +13 -0
  2702. data/rails/railties/lib/rails/generators/test_unit/job/templates/unit_test.rb.erb +9 -0
  2703. data/rails/railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb +21 -0
  2704. data/rails/railties/lib/rails/generators/test_unit/mailer/templates/functional_test.rb +21 -0
  2705. data/rails/railties/lib/rails/generators/test_unit/mailer/templates/preview.rb +13 -0
  2706. data/rails/railties/lib/rails/generators/test_unit/model/model_generator.rb +36 -0
  2707. data/rails/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml +27 -0
  2708. data/rails/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb +9 -0
  2709. data/rails/railties/lib/rails/generators/test_unit/plugin/plugin_generator.rb +13 -0
  2710. data/rails/railties/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +7 -0
  2711. data/rails/railties/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +2 -0
  2712. data/rails/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +33 -0
  2713. data/rails/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +51 -0
  2714. data/rails/railties/lib/rails/generators/test_unit.rb +8 -0
  2715. data/rails/railties/lib/rails/generators/testing/assertions.rb +123 -0
  2716. data/rails/railties/lib/rails/generators/testing/behaviour.rb +123 -0
  2717. data/rails/railties/lib/rails/generators/testing/setup_and_teardown.rb +18 -0
  2718. data/rails/railties/lib/rails/generators.rb +373 -0
  2719. data/rails/railties/lib/rails/info.rb +102 -0
  2720. data/rails/railties/lib/rails/info_controller.rb +23 -0
  2721. data/rails/railties/lib/rails/initializable.rb +89 -0
  2722. data/rails/railties/lib/rails/mailers_controller.rb +73 -0
  2723. data/rails/railties/lib/rails/paths.rb +211 -0
  2724. data/rails/railties/lib/rails/rack/debugger.rb +24 -0
  2725. data/rails/railties/lib/rails/rack/log_tailer.rb +38 -0
  2726. data/rails/railties/lib/rails/rack/logger.rb +86 -0
  2727. data/rails/railties/lib/rails/rack.rb +7 -0
  2728. data/rails/railties/lib/rails/railtie/configurable.rb +35 -0
  2729. data/rails/railties/lib/rails/railtie/configuration.rb +100 -0
  2730. data/rails/railties/lib/rails/railtie.rb +250 -0
  2731. data/rails/railties/lib/rails/ruby_version_check.rb +13 -0
  2732. data/rails/railties/lib/rails/source_annotation_extractor.rb +133 -0
  2733. data/rails/railties/lib/rails/tasks/annotations.rake +20 -0
  2734. data/rails/railties/lib/rails/tasks/documentation.rake +70 -0
  2735. data/rails/railties/lib/rails/tasks/engine.rake +72 -0
  2736. data/rails/railties/lib/rails/tasks/framework.rake +66 -0
  2737. data/rails/railties/lib/rails/tasks/log.rake +23 -0
  2738. data/rails/railties/lib/rails/tasks/middleware.rake +7 -0
  2739. data/rails/railties/lib/rails/tasks/misc.rake +60 -0
  2740. data/rails/railties/lib/rails/tasks/routes.rake +7 -0
  2741. data/rails/railties/lib/rails/tasks/statistics.rake +29 -0
  2742. data/rails/railties/lib/rails/tasks/tmp.rake +45 -0
  2743. data/rails/railties/lib/rails/tasks.rb +14 -0
  2744. data/rails/railties/lib/rails/templates/layouts/application.html.erb +36 -0
  2745. data/rails/railties/lib/rails/templates/rails/info/properties.html.erb +1 -0
  2746. data/rails/railties/lib/rails/templates/rails/info/routes.html.erb +9 -0
  2747. data/rails/railties/lib/rails/templates/rails/mailers/email.html.erb +105 -0
  2748. data/rails/railties/lib/rails/templates/rails/mailers/index.html.erb +8 -0
  2749. data/rails/railties/lib/rails/templates/rails/mailers/mailer.html.erb +6 -0
  2750. data/rails/railties/lib/rails/templates/rails/welcome/index.html.erb +261 -0
  2751. data/rails/railties/lib/rails/test_help.rb +43 -0
  2752. data/rails/railties/lib/rails/test_unit/railtie.rb +18 -0
  2753. data/rails/railties/lib/rails/test_unit/sub_test_task.rb +126 -0
  2754. data/rails/railties/lib/rails/test_unit/testing.rake +66 -0
  2755. data/rails/railties/lib/rails/version.rb +8 -0
  2756. data/rails/railties/lib/rails/welcome_controller.rb +8 -0
  2757. data/rails/railties/lib/rails.rb +93 -0
  2758. data/rails/railties/railties.gemspec +33 -0
  2759. data/rails/railties/test/abstract_unit.rb +53 -0
  2760. data/rails/railties/test/app_rails_loader_test.rb +89 -0
  2761. data/rails/railties/test/application/asset_debugging_test.rb +64 -0
  2762. data/rails/railties/test/application/assets_test.rb +493 -0
  2763. data/rails/railties/test/application/build_original_fullpath_test.rb +27 -0
  2764. data/rails/railties/test/application/configuration/base_test.rb +37 -0
  2765. data/rails/railties/test/application/configuration/custom_test.rb +22 -0
  2766. data/rails/railties/test/application/configuration_test.rb +1344 -0
  2767. data/rails/railties/test/application/console_test.rb +153 -0
  2768. data/rails/railties/test/application/generators_test.rb +129 -0
  2769. data/rails/railties/test/application/initializers/frameworks_test.rb +231 -0
  2770. data/rails/railties/test/application/initializers/hooks_test.rb +90 -0
  2771. data/rails/railties/test/application/initializers/i18n_test.rb +216 -0
  2772. data/rails/railties/test/application/initializers/load_path_test.rb +110 -0
  2773. data/rails/railties/test/application/initializers/notifications_test.rb +56 -0
  2774. data/rails/railties/test/application/loading_test.rb +341 -0
  2775. data/rails/railties/test/application/mailer_previews_test.rb +494 -0
  2776. data/rails/railties/test/application/middleware/cache_test.rb +180 -0
  2777. data/rails/railties/test/application/middleware/cookies_test.rb +47 -0
  2778. data/rails/railties/test/application/middleware/exceptions_test.rb +126 -0
  2779. data/rails/railties/test/application/middleware/remote_ip_test.rb +78 -0
  2780. data/rails/railties/test/application/middleware/sendfile_test.rb +74 -0
  2781. data/rails/railties/test/application/middleware/session_test.rb +343 -0
  2782. data/rails/railties/test/application/middleware/static_test.rb +31 -0
  2783. data/rails/railties/test/application/middleware_test.rb +240 -0
  2784. data/rails/railties/test/application/multiple_applications_test.rb +176 -0
  2785. data/rails/railties/test/application/paths_test.rb +83 -0
  2786. data/rails/railties/test/application/rack/logger_test.rb +56 -0
  2787. data/rails/railties/test/application/rackup_test.rb +43 -0
  2788. data/rails/railties/test/application/rake/dbs_test.rb +233 -0
  2789. data/rails/railties/test/application/rake/migrations_test.rb +204 -0
  2790. data/rails/railties/test/application/rake/notes_test.rb +156 -0
  2791. data/rails/railties/test/application/rake_test.rb +286 -0
  2792. data/rails/railties/test/application/rendering_test.rb +45 -0
  2793. data/rails/railties/test/application/routing_test.rb +468 -0
  2794. data/rails/railties/test/application/runner_test.rb +89 -0
  2795. data/rails/railties/test/application/test_runner_test.rb +331 -0
  2796. data/rails/railties/test/application/test_test.rb +322 -0
  2797. data/rails/railties/test/application/url_generation_test.rb +46 -0
  2798. data/rails/railties/test/backtrace_cleaner_test.rb +24 -0
  2799. data/rails/railties/test/code_statistics_calculator_test.rb +288 -0
  2800. data/rails/railties/test/commands/console_test.rb +176 -0
  2801. data/rails/railties/test/commands/dbconsole_test.rb +274 -0
  2802. data/rails/railties/test/commands/server_test.rb +88 -0
  2803. data/rails/railties/test/configuration/middleware_stack_proxy_test.rb +61 -0
  2804. data/rails/railties/test/engine_test.rb +25 -0
  2805. data/rails/railties/test/env_helpers.rb +30 -0
  2806. data/rails/railties/test/fixtures/about_yml_plugins/bad_about_yml/about.yml +1 -0
  2807. data/rails/railties/test/fixtures/about_yml_plugins/bad_about_yml/init.rb +1 -0
  2808. data/rails/railties/test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb +1 -0
  2809. data/rails/railties/test/fixtures/lib/create_test_dummy_template.rb +1 -0
  2810. data/rails/railties/test/fixtures/lib/generators/active_record/fixjour_generator.rb +8 -0
  2811. data/rails/railties/test/fixtures/lib/generators/fixjour_generator.rb +2 -0
  2812. data/rails/railties/test/fixtures/lib/generators/model_generator.rb +1 -0
  2813. data/rails/railties/test/fixtures/lib/generators/usage_template/USAGE +1 -0
  2814. data/rails/railties/test/fixtures/lib/generators/usage_template/usage_template_generator.rb +5 -0
  2815. data/rails/railties/test/fixtures/lib/rails/generators/foobar/foobar_generator.rb +4 -0
  2816. data/rails/railties/test/fixtures/lib/template.rb +1 -0
  2817. data/rails/railties/test/generators/actions_test.rb +259 -0
  2818. data/rails/railties/test/generators/app_generator_test.rb +528 -0
  2819. data/rails/railties/test/generators/argv_scrubber_test.rb +136 -0
  2820. data/rails/railties/test/generators/assets_generator_test.rb +19 -0
  2821. data/rails/railties/test/generators/controller_generator_test.rb +101 -0
  2822. data/rails/railties/test/generators/create_migration_test.rb +134 -0
  2823. data/rails/railties/test/generators/generated_attribute_test.rb +152 -0
  2824. data/rails/railties/test/generators/generator_generator_test.rb +71 -0
  2825. data/rails/railties/test/generators/generator_test.rb +85 -0
  2826. data/rails/railties/test/generators/generators_test_helper.rb +52 -0
  2827. data/rails/railties/test/generators/helper_generator_test.rb +39 -0
  2828. data/rails/railties/test/generators/integration_test_generator_test.rb +12 -0
  2829. data/rails/railties/test/generators/mailer_generator_test.rb +170 -0
  2830. data/rails/railties/test/generators/migration_generator_test.rb +288 -0
  2831. data/rails/railties/test/generators/model_generator_test.rb +446 -0
  2832. data/rails/railties/test/generators/named_base_test.rb +145 -0
  2833. data/rails/railties/test/generators/namespaced_generators_test.rb +398 -0
  2834. data/rails/railties/test/generators/orm_test.rb +38 -0
  2835. data/rails/railties/test/generators/plugin_generator_test.rb +442 -0
  2836. data/rails/railties/test/generators/resource_generator_test.rb +88 -0
  2837. data/rails/railties/test/generators/scaffold_controller_generator_test.rb +177 -0
  2838. data/rails/railties/test/generators/scaffold_generator_test.rb +386 -0
  2839. data/rails/railties/test/generators/shared_generator_tests.rb +144 -0
  2840. data/rails/railties/test/generators/task_generator_test.rb +24 -0
  2841. data/rails/railties/test/generators_test.rb +234 -0
  2842. data/rails/railties/test/initializable_test.rb +230 -0
  2843. data/rails/railties/test/isolation/abstract_unit.rb +359 -0
  2844. data/rails/railties/test/path_generation_test.rb +88 -0
  2845. data/rails/railties/test/paths_test.rb +234 -0
  2846. data/rails/railties/test/rack_logger_test.rb +75 -0
  2847. data/rails/railties/test/rails_info_controller_test.rb +57 -0
  2848. data/rails/railties/test/rails_info_test.rb +71 -0
  2849. data/rails/railties/test/railties/engine_test.rb +1317 -0
  2850. data/rails/railties/test/railties/generators_test.rb +126 -0
  2851. data/rails/railties/test/railties/mounted_engine_test.rb +274 -0
  2852. data/rails/railties/test/railties/railtie_test.rb +208 -0
  2853. data/rails/railties/test/test_info_test.rb +60 -0
  2854. data/rails/railties/test/version_test.rb +12 -0
  2855. data/rails/tasks/release.rb +128 -0
  2856. data/rails/tools/README.md +7 -0
  2857. data/rails/tools/console +7 -0
  2858. data/rails/tools/line_statistics +42 -0
  2859. data/rails/tools/profile +136 -0
  2860. data/rails/version.rb +15 -0
  2861. data/test/cases/lock_test.rb +29 -0
  2862. data/test/helper.rb +30 -0
  2863. data/test/integration/lock_queuing_test.rb +43 -0
  2864. metadata +3007 -0
@@ -0,0 +1,3228 @@
1
+ require 'abstract_unit'
2
+
3
+ class DateHelperTest < ActionView::TestCase
4
+ tests ActionView::Helpers::DateHelper
5
+
6
+ silence_warnings do
7
+ Post = Struct.new("Post", :id, :written_on, :updated_at)
8
+ Post.class_eval do
9
+ def id
10
+ 123
11
+ end
12
+ def id_before_type_cast
13
+ 123
14
+ end
15
+ def to_param
16
+ '123'
17
+ end
18
+ end
19
+ end
20
+
21
+ def assert_distance_of_time_in_words(from, to=nil)
22
+ to ||= from
23
+
24
+ # 0..1 minute with :include_seconds => true
25
+ assert_equal "less than 5 seconds", distance_of_time_in_words(from, to + 0.seconds, :include_seconds => true)
26
+ assert_equal "less than 5 seconds", distance_of_time_in_words(from, to + 4.seconds, :include_seconds => true)
27
+ assert_equal "less than 10 seconds", distance_of_time_in_words(from, to + 5.seconds, :include_seconds => true)
28
+ assert_equal "less than 10 seconds", distance_of_time_in_words(from, to + 9.seconds, :include_seconds => true)
29
+ assert_equal "less than 20 seconds", distance_of_time_in_words(from, to + 10.seconds, :include_seconds => true)
30
+ assert_equal "less than 20 seconds", distance_of_time_in_words(from, to + 19.seconds, :include_seconds => true)
31
+ assert_equal "half a minute", distance_of_time_in_words(from, to + 20.seconds, :include_seconds => true)
32
+ assert_equal "half a minute", distance_of_time_in_words(from, to + 39.seconds, :include_seconds => true)
33
+ assert_equal "less than a minute", distance_of_time_in_words(from, to + 40.seconds, :include_seconds => true)
34
+ assert_equal "less than a minute", distance_of_time_in_words(from, to + 59.seconds, :include_seconds => true)
35
+ assert_equal "1 minute", distance_of_time_in_words(from, to + 60.seconds, :include_seconds => true)
36
+ assert_equal "1 minute", distance_of_time_in_words(from, to + 89.seconds, :include_seconds => true)
37
+
38
+ # 0..1 minute with :include_seconds => false
39
+ assert_equal "less than a minute", distance_of_time_in_words(from, to + 0.seconds, :include_seconds => false)
40
+ assert_equal "less than a minute", distance_of_time_in_words(from, to + 4.seconds, :include_seconds => false)
41
+ assert_equal "less than a minute", distance_of_time_in_words(from, to + 5.seconds, :include_seconds => false)
42
+ assert_equal "less than a minute", distance_of_time_in_words(from, to + 9.seconds, :include_seconds => false)
43
+ assert_equal "less than a minute", distance_of_time_in_words(from, to + 10.seconds, :include_seconds => false)
44
+ assert_equal "less than a minute", distance_of_time_in_words(from, to + 19.seconds, :include_seconds => false)
45
+ assert_equal "less than a minute", distance_of_time_in_words(from, to + 20.seconds, :include_seconds => false)
46
+ assert_equal "1 minute", distance_of_time_in_words(from, to + 39.seconds, :include_seconds => false)
47
+ assert_equal "1 minute", distance_of_time_in_words(from, to + 40.seconds, :include_seconds => false)
48
+ assert_equal "1 minute", distance_of_time_in_words(from, to + 59.seconds, :include_seconds => false)
49
+ assert_equal "1 minute", distance_of_time_in_words(from, to + 60.seconds, :include_seconds => false)
50
+ assert_equal "1 minute", distance_of_time_in_words(from, to + 89.seconds, :include_seconds => false)
51
+
52
+ # Note that we are including a 30-second boundary around the interval we
53
+ # want to test. For instance, "1 minute" is actually 30s to 1m29s. The
54
+ # reason for doing this is simple -- in `distance_of_time_to_words`, when we
55
+ # take the distance between our two Time objects in seconds and convert it
56
+ # to minutes, we round the number. So 29s gets rounded down to 0m, 30s gets
57
+ # rounded up to 1m, and 1m29s gets rounded down to 1m. A similar thing
58
+ # happens with the other cases.
59
+
60
+ # First case 0..1 minute
61
+ assert_equal "less than a minute", distance_of_time_in_words(from, to + 0.seconds)
62
+ assert_equal "less than a minute", distance_of_time_in_words(from, to + 29.seconds)
63
+ assert_equal "1 minute", distance_of_time_in_words(from, to + 30.seconds)
64
+ assert_equal "1 minute", distance_of_time_in_words(from, to + 1.minutes + 29.seconds)
65
+
66
+ # 2 minutes up to 45 minutes
67
+ assert_equal "2 minutes", distance_of_time_in_words(from, to + 1.minutes + 30.seconds)
68
+ assert_equal "44 minutes", distance_of_time_in_words(from, to + 44.minutes + 29.seconds)
69
+
70
+ # 45 minutes up to 90 minutes
71
+ assert_equal "about 1 hour", distance_of_time_in_words(from, to + 44.minutes + 30.seconds)
72
+ assert_equal "about 1 hour", distance_of_time_in_words(from, to + 89.minutes + 29.seconds)
73
+
74
+ # 90 minutes up to 24 hours
75
+ assert_equal "about 2 hours", distance_of_time_in_words(from, to + 89.minutes + 30.seconds)
76
+ assert_equal "about 24 hours", distance_of_time_in_words(from, to + 23.hours + 59.minutes + 29.seconds)
77
+
78
+ # 24 hours up to 42 hours
79
+ assert_equal "1 day", distance_of_time_in_words(from, to + 23.hours + 59.minutes + 30.seconds)
80
+ assert_equal "1 day", distance_of_time_in_words(from, to + 41.hours + 59.minutes + 29.seconds)
81
+
82
+ # 42 hours up to 30 days
83
+ assert_equal "2 days", distance_of_time_in_words(from, to + 41.hours + 59.minutes + 30.seconds)
84
+ assert_equal "3 days", distance_of_time_in_words(from, to + 2.days + 12.hours)
85
+ assert_equal "30 days", distance_of_time_in_words(from, to + 29.days + 23.hours + 59.minutes + 29.seconds)
86
+
87
+ # 30 days up to 60 days
88
+ assert_equal "about 1 month", distance_of_time_in_words(from, to + 29.days + 23.hours + 59.minutes + 30.seconds)
89
+ assert_equal "about 1 month", distance_of_time_in_words(from, to + 44.days + 23.hours + 59.minutes + 29.seconds)
90
+ assert_equal "about 2 months", distance_of_time_in_words(from, to + 44.days + 23.hours + 59.minutes + 30.seconds)
91
+ assert_equal "about 2 months", distance_of_time_in_words(from, to + 59.days + 23.hours + 59.minutes + 29.seconds)
92
+
93
+ # 60 days up to 365 days
94
+ assert_equal "2 months", distance_of_time_in_words(from, to + 59.days + 23.hours + 59.minutes + 30.seconds)
95
+ assert_equal "12 months", distance_of_time_in_words(from, to + 1.years - 31.seconds)
96
+
97
+ # >= 365 days
98
+ assert_equal "about 1 year", distance_of_time_in_words(from, to + 1.years - 30.seconds)
99
+ assert_equal "about 1 year", distance_of_time_in_words(from, to + 1.years + 3.months - 1.day)
100
+ assert_equal "over 1 year", distance_of_time_in_words(from, to + 1.years + 6.months)
101
+
102
+ assert_equal "almost 2 years", distance_of_time_in_words(from, to + 2.years - 3.months + 1.day)
103
+ assert_equal "about 2 years", distance_of_time_in_words(from, to + 2.years + 3.months - 1.day)
104
+ assert_equal "over 2 years", distance_of_time_in_words(from, to + 2.years + 3.months + 1.day)
105
+ assert_equal "over 2 years", distance_of_time_in_words(from, to + 2.years + 9.months - 1.day)
106
+ assert_equal "almost 3 years", distance_of_time_in_words(from, to + 2.years + 9.months + 1.day)
107
+
108
+ assert_equal "almost 5 years", distance_of_time_in_words(from, to + 5.years - 3.months + 1.day)
109
+ assert_equal "about 5 years", distance_of_time_in_words(from, to + 5.years + 3.months - 1.day)
110
+ assert_equal "over 5 years", distance_of_time_in_words(from, to + 5.years + 3.months + 1.day)
111
+ assert_equal "over 5 years", distance_of_time_in_words(from, to + 5.years + 9.months - 1.day)
112
+ assert_equal "almost 6 years", distance_of_time_in_words(from, to + 5.years + 9.months + 1.day)
113
+
114
+ assert_equal "almost 10 years", distance_of_time_in_words(from, to + 10.years - 3.months + 1.day)
115
+ assert_equal "about 10 years", distance_of_time_in_words(from, to + 10.years + 3.months - 1.day)
116
+ assert_equal "over 10 years", distance_of_time_in_words(from, to + 10.years + 3.months + 1.day)
117
+ assert_equal "over 10 years", distance_of_time_in_words(from, to + 10.years + 9.months - 1.day)
118
+ assert_equal "almost 11 years", distance_of_time_in_words(from, to + 10.years + 9.months + 1.day)
119
+
120
+ # test to < from
121
+ assert_equal "about 4 hours", distance_of_time_in_words(from + 4.hours, to)
122
+ assert_equal "less than 20 seconds", distance_of_time_in_words(from + 19.seconds, to, :include_seconds => true)
123
+ assert_equal "less than a minute", distance_of_time_in_words(from + 19.seconds, to, :include_seconds => false)
124
+ end
125
+
126
+ def test_distance_in_words
127
+ from = Time.utc(2004, 6, 6, 21, 45, 0)
128
+ assert_distance_of_time_in_words(from)
129
+ end
130
+
131
+ def test_distance_in_words_with_mathn_required
132
+ # test we avoid Integer#/ (redefined by mathn)
133
+ require 'mathn'
134
+ from = Time.utc(2004, 6, 6, 21, 45, 0)
135
+ assert_distance_of_time_in_words(from)
136
+ end
137
+
138
+ def test_time_ago_in_words_passes_include_seconds
139
+ assert_equal "less than 20 seconds", time_ago_in_words(15.seconds.ago, :include_seconds => true)
140
+ assert_equal "less than a minute", time_ago_in_words(15.seconds.ago, :include_seconds => false)
141
+ end
142
+
143
+ def test_distance_in_words_with_time_zones
144
+ from = Time.mktime(2004, 6, 6, 21, 45, 0)
145
+ assert_distance_of_time_in_words(from.in_time_zone('Alaska'))
146
+ assert_distance_of_time_in_words(from.in_time_zone('Hawaii'))
147
+ end
148
+
149
+ def test_distance_in_words_with_different_time_zones
150
+ from = Time.mktime(2004, 6, 6, 21, 45, 0)
151
+ assert_distance_of_time_in_words(
152
+ from.in_time_zone('Alaska'),
153
+ from.in_time_zone('Hawaii')
154
+ )
155
+ end
156
+
157
+ def test_distance_in_words_with_dates
158
+ start_date = Date.new 1975, 1, 31
159
+ end_date = Date.new 1977, 1, 31
160
+ assert_equal("about 2 years", distance_of_time_in_words(start_date, end_date))
161
+
162
+ start_date = Date.new 1982, 12, 3
163
+ end_date = Date.new 2010, 11, 30
164
+ assert_equal("almost 28 years", distance_of_time_in_words(start_date, end_date))
165
+ assert_equal("almost 28 years", distance_of_time_in_words(end_date, start_date))
166
+ end
167
+
168
+ def test_distance_in_words_with_integers
169
+ assert_equal "1 minute", distance_of_time_in_words(59)
170
+ assert_equal "about 1 hour", distance_of_time_in_words(60*60)
171
+ assert_equal "1 minute", distance_of_time_in_words(0, 59)
172
+ assert_equal "about 1 hour", distance_of_time_in_words(60*60, 0)
173
+ assert_equal "about 3 years", distance_of_time_in_words(10**8)
174
+ assert_equal "about 3 years", distance_of_time_in_words(0, 10**8)
175
+ end
176
+
177
+ def test_distance_in_words_with_times
178
+ assert_equal "1 minute", distance_of_time_in_words(30.seconds)
179
+ assert_equal "1 minute", distance_of_time_in_words(59.seconds)
180
+ assert_equal "2 minutes", distance_of_time_in_words(119.seconds)
181
+ assert_equal "2 minutes", distance_of_time_in_words(1.minute + 59.seconds)
182
+ assert_equal "3 minutes", distance_of_time_in_words(2.minute + 30.seconds)
183
+ assert_equal "44 minutes", distance_of_time_in_words(44.minutes + 29.seconds)
184
+ assert_equal "about 1 hour", distance_of_time_in_words(44.minutes + 30.seconds)
185
+ assert_equal "about 1 hour", distance_of_time_in_words(60.minutes)
186
+
187
+ # include seconds
188
+ assert_equal "half a minute", distance_of_time_in_words(39.seconds, 0, :include_seconds => true)
189
+ assert_equal "less than a minute", distance_of_time_in_words(40.seconds, 0, :include_seconds => true)
190
+ assert_equal "less than a minute", distance_of_time_in_words(59.seconds, 0, :include_seconds => true)
191
+ assert_equal "1 minute", distance_of_time_in_words(60.seconds, 0, :include_seconds => true)
192
+ end
193
+
194
+ def test_time_ago_in_words
195
+ assert_equal "about 1 year", time_ago_in_words(1.year.ago - 1.day)
196
+ end
197
+
198
+ def test_select_day
199
+ expected = %(<select id="date_day" name="date[day]">\n)
200
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
201
+ expected << "</select>\n"
202
+
203
+ assert_dom_equal expected, select_day(Time.mktime(2003, 8, 16))
204
+ assert_dom_equal expected, select_day(16)
205
+ end
206
+
207
+ def test_select_day_with_blank
208
+ expected = %(<select id="date_day" name="date[day]">\n)
209
+ expected << %(<option value=""></option>\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
210
+ expected << "</select>\n"
211
+
212
+ assert_dom_equal expected, select_day(Time.mktime(2003, 8, 16), :include_blank => true)
213
+ assert_dom_equal expected, select_day(16, :include_blank => true)
214
+ end
215
+
216
+ def test_select_day_nil_with_blank
217
+ expected = %(<select id="date_day" name="date[day]">\n)
218
+ expected << %(<option value=""></option>\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
219
+ expected << "</select>\n"
220
+
221
+ assert_dom_equal expected, select_day(nil, :include_blank => true)
222
+ end
223
+
224
+ def test_select_day_with_two_digit_numbers
225
+ expected = %(<select id="date_day" name="date[day]">\n)
226
+ expected << %(<option value="1">01</option>\n<option selected="selected" value="2">02</option>\n<option value="3">03</option>\n<option value="4">04</option>\n<option value="5">05</option>\n<option value="6">06</option>\n<option value="7">07</option>\n<option value="8">08</option>\n<option value="9">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
227
+ expected << "</select>\n"
228
+
229
+ assert_dom_equal expected, select_day(Time.mktime(2011, 8, 2), :use_two_digit_numbers => true)
230
+ assert_dom_equal expected, select_day(2, :use_two_digit_numbers => true)
231
+ end
232
+
233
+ def test_select_day_with_html_options
234
+ expected = %(<select id="date_day" name="date[day]" class="selector">\n)
235
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
236
+ expected << "</select>\n"
237
+
238
+ assert_dom_equal expected, select_day(Time.mktime(2003, 8, 16), {}, :class => 'selector')
239
+ assert_dom_equal expected, select_day(16, {}, :class => 'selector')
240
+ end
241
+
242
+ def test_select_day_with_default_prompt
243
+ expected = %(<select id="date_day" name="date[day]">\n)
244
+ expected << %(<option value="">Day</option>\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
245
+ expected << "</select>\n"
246
+
247
+ assert_dom_equal expected, select_day(16, :prompt => true)
248
+ end
249
+
250
+ def test_select_day_with_custom_prompt
251
+ expected = %(<select id="date_day" name="date[day]">\n)
252
+ expected << %(<option value="">Choose day</option>\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
253
+ expected << "</select>\n"
254
+
255
+ assert_dom_equal expected, select_day(16, :prompt => 'Choose day')
256
+ end
257
+
258
+ def test_select_month
259
+ expected = %(<select id="date_month" name="date[month]">\n)
260
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
261
+ expected << "</select>\n"
262
+
263
+ assert_dom_equal expected, select_month(Time.mktime(2003, 8, 16))
264
+ assert_dom_equal expected, select_month(8)
265
+ end
266
+
267
+ def test_select_month_with_two_digit_numbers
268
+ expected = %(<select id="date_month" name="date[month]">\n)
269
+ expected << %(<option value="1">01</option>\n<option value="2">02</option>\n<option value="3">03</option>\n<option value="4">04</option>\n<option value="5">05</option>\n<option value="6">06</option>\n<option value="7">07</option>\n<option value="8" selected="selected">08</option>\n<option value="9">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n)
270
+ expected << "</select>\n"
271
+
272
+ assert_dom_equal expected, select_month(Time.mktime(2011, 8, 16), :use_two_digit_numbers => true)
273
+ assert_dom_equal expected, select_month(8, :use_two_digit_numbers => true)
274
+ end
275
+
276
+ def test_select_month_with_disabled
277
+ expected = %(<select id="date_month" name="date[month]" disabled="disabled">\n)
278
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
279
+ expected << "</select>\n"
280
+
281
+ assert_dom_equal expected, select_month(Time.mktime(2003, 8, 16), :disabled => true)
282
+ assert_dom_equal expected, select_month(8, :disabled => true)
283
+ end
284
+
285
+ def test_select_month_with_field_name_override
286
+ expected = %(<select id="date_mois" name="date[mois]">\n)
287
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
288
+ expected << "</select>\n"
289
+
290
+ assert_dom_equal expected, select_month(Time.mktime(2003, 8, 16), :field_name => 'mois')
291
+ assert_dom_equal expected, select_month(8, :field_name => 'mois')
292
+ end
293
+
294
+ def test_select_month_with_blank
295
+ expected = %(<select id="date_month" name="date[month]">\n)
296
+ expected << %(<option value=""></option>\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
297
+ expected << "</select>\n"
298
+
299
+ assert_dom_equal expected, select_month(Time.mktime(2003, 8, 16), :include_blank => true)
300
+ assert_dom_equal expected, select_month(8, :include_blank => true)
301
+ end
302
+
303
+ def test_select_month_nil_with_blank
304
+ expected = %(<select id="date_month" name="date[month]">\n)
305
+ expected << %(<option value=""></option>\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
306
+ expected << "</select>\n"
307
+
308
+ assert_dom_equal expected, select_month(nil, :include_blank => true)
309
+ end
310
+
311
+ def test_select_month_with_numbers
312
+ expected = %(<select id="date_month" name="date[month]">\n)
313
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8" selected="selected">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n)
314
+ expected << "</select>\n"
315
+
316
+ assert_dom_equal expected, select_month(Time.mktime(2003, 8, 16), :use_month_numbers => true)
317
+ assert_dom_equal expected, select_month(8, :use_month_numbers => true)
318
+ end
319
+
320
+ def test_select_month_with_numbers_and_names
321
+ expected = %(<select id="date_month" name="date[month]">\n)
322
+ expected << %(<option value="1">1 - January</option>\n<option value="2">2 - February</option>\n<option value="3">3 - March</option>\n<option value="4">4 - April</option>\n<option value="5">5 - May</option>\n<option value="6">6 - June</option>\n<option value="7">7 - July</option>\n<option value="8" selected="selected">8 - August</option>\n<option value="9">9 - September</option>\n<option value="10">10 - October</option>\n<option value="11">11 - November</option>\n<option value="12">12 - December</option>\n)
323
+ expected << "</select>\n"
324
+
325
+ assert_dom_equal expected, select_month(Time.mktime(2003, 8, 16), :add_month_numbers => true)
326
+ assert_dom_equal expected, select_month(8, :add_month_numbers => true)
327
+ end
328
+
329
+ def test_select_month_with_format_string
330
+ expected = %(<select id="date_month" name="date[month]">\n)
331
+ expected << %(<option value="1">January (01)</option>\n<option value="2">February (02)</option>\n<option value="3">March (03)</option>\n<option value="4">April (04)</option>\n<option value="5">May (05)</option>\n<option value="6">June (06)</option>\n<option value="7">July (07)</option>\n<option value="8" selected="selected">August (08)</option>\n<option value="9">September (09)</option>\n<option value="10">October (10)</option>\n<option value="11">November (11)</option>\n<option value="12">December (12)</option>\n)
332
+ expected << "</select>\n"
333
+
334
+ format_string = '%{name} (%<number>02d)'
335
+ assert_dom_equal expected, select_month(Time.mktime(2003, 8, 16), :month_format_string => format_string)
336
+ assert_dom_equal expected, select_month(8, :month_format_string => format_string)
337
+ end
338
+
339
+ def test_select_month_with_numbers_and_names_with_abbv
340
+ expected = %(<select id="date_month" name="date[month]">\n)
341
+ expected << %(<option value="1">1 - Jan</option>\n<option value="2">2 - Feb</option>\n<option value="3">3 - Mar</option>\n<option value="4">4 - Apr</option>\n<option value="5">5 - May</option>\n<option value="6">6 - Jun</option>\n<option value="7">7 - Jul</option>\n<option value="8" selected="selected">8 - Aug</option>\n<option value="9">9 - Sep</option>\n<option value="10">10 - Oct</option>\n<option value="11">11 - Nov</option>\n<option value="12">12 - Dec</option>\n)
342
+ expected << "</select>\n"
343
+
344
+ assert_dom_equal expected, select_month(Time.mktime(2003, 8, 16), :add_month_numbers => true, :use_short_month => true)
345
+ assert_dom_equal expected, select_month(8, :add_month_numbers => true, :use_short_month => true)
346
+ end
347
+
348
+ def test_select_month_with_abbv
349
+ expected = %(<select id="date_month" name="date[month]">\n)
350
+ expected << %(<option value="1">Jan</option>\n<option value="2">Feb</option>\n<option value="3">Mar</option>\n<option value="4">Apr</option>\n<option value="5">May</option>\n<option value="6">Jun</option>\n<option value="7">Jul</option>\n<option value="8" selected="selected">Aug</option>\n<option value="9">Sep</option>\n<option value="10">Oct</option>\n<option value="11">Nov</option>\n<option value="12">Dec</option>\n)
351
+ expected << "</select>\n"
352
+
353
+ assert_dom_equal expected, select_month(Time.mktime(2003, 8, 16), :use_short_month => true)
354
+ assert_dom_equal expected, select_month(8, :use_short_month => true)
355
+ end
356
+
357
+ def test_select_month_with_custom_names
358
+ month_names = %w(nil Januar Februar Marts April Maj Juni Juli August September Oktober November December)
359
+
360
+ expected = %(<select id="date_month" name="date[month]">\n)
361
+ 1.upto(12) { |month| expected << %(<option value="#{month}"#{' selected="selected"' if month == 8}>#{month_names[month]}</option>\n) }
362
+ expected << "</select>\n"
363
+
364
+ assert_dom_equal expected, select_month(Time.mktime(2003, 8, 16), :use_month_names => month_names)
365
+ assert_dom_equal expected, select_month(8, :use_month_names => month_names)
366
+ end
367
+
368
+ def test_select_month_with_zero_indexed_custom_names
369
+ month_names = %w(Januar Februar Marts April Maj Juni Juli August September Oktober November December)
370
+
371
+ expected = %(<select id="date_month" name="date[month]">\n)
372
+ 1.upto(12) { |month| expected << %(<option value="#{month}"#{' selected="selected"' if month == 8}>#{month_names[month-1]}</option>\n) }
373
+ expected << "</select>\n"
374
+
375
+ assert_dom_equal expected, select_month(Time.mktime(2003, 8, 16), :use_month_names => month_names)
376
+ assert_dom_equal expected, select_month(8, :use_month_names => month_names)
377
+ end
378
+
379
+ def test_select_month_with_hidden
380
+ assert_dom_equal "<input type=\"hidden\" id=\"date_month\" name=\"date[month]\" value=\"8\" />\n", select_month(8, :use_hidden => true)
381
+ end
382
+
383
+ def test_select_month_with_hidden_and_field_name
384
+ assert_dom_equal "<input type=\"hidden\" id=\"date_mois\" name=\"date[mois]\" value=\"8\" />\n", select_month(8, :use_hidden => true, :field_name => 'mois')
385
+ end
386
+
387
+ def test_select_month_with_html_options
388
+ expected = %(<select id="date_month" name="date[month]" class="selector" accesskey="M">\n)
389
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
390
+ expected << "</select>\n"
391
+
392
+ assert_dom_equal expected, select_month(Time.mktime(2003, 8, 16), {}, :class => 'selector', :accesskey => 'M')
393
+ #result = select_month(Time.mktime(2003, 8, 16), {}, :class => 'selector', :accesskey => 'M')
394
+ #assert result.include?('<select id="date_month" name="date[month]"')
395
+ #assert result.include?('class="selector"')
396
+ #assert result.include?('accesskey="M"')
397
+ #assert result.include?('<option value="1">January')
398
+ end
399
+
400
+ def test_select_month_with_default_prompt
401
+ expected = %(<select id="date_month" name="date[month]">\n)
402
+ expected << %(<option value="">Month</option>\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
403
+ expected << "</select>\n"
404
+
405
+ assert_dom_equal expected, select_month(8, :prompt => true)
406
+ end
407
+
408
+ def test_select_month_with_custom_prompt
409
+ expected = %(<select id="date_month" name="date[month]">\n)
410
+ expected << %(<option value="">Choose month</option>\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
411
+ expected << "</select>\n"
412
+
413
+ assert_dom_equal expected, select_month(8, :prompt => 'Choose month')
414
+ end
415
+
416
+ def test_select_year
417
+ expected = %(<select id="date_year" name="date[year]">\n)
418
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
419
+ expected << "</select>\n"
420
+
421
+ assert_dom_equal expected, select_year(Time.mktime(2003, 8, 16), :start_year => 2003, :end_year => 2005)
422
+ assert_dom_equal expected, select_year(2003, :start_year => 2003, :end_year => 2005)
423
+ end
424
+
425
+ def test_select_year_with_disabled
426
+ expected = %(<select id="date_year" name="date[year]" disabled="disabled">\n)
427
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
428
+ expected << "</select>\n"
429
+
430
+ assert_dom_equal expected, select_year(Time.mktime(2003, 8, 16), :disabled => true, :start_year => 2003, :end_year => 2005)
431
+ assert_dom_equal expected, select_year(2003, :disabled => true, :start_year => 2003, :end_year => 2005)
432
+ end
433
+
434
+ def test_select_year_with_field_name_override
435
+ expected = %(<select id="date_annee" name="date[annee]">\n)
436
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
437
+ expected << "</select>\n"
438
+
439
+ assert_dom_equal expected, select_year(Time.mktime(2003, 8, 16), :start_year => 2003, :end_year => 2005, :field_name => 'annee')
440
+ assert_dom_equal expected, select_year(2003, :start_year => 2003, :end_year => 2005, :field_name => 'annee')
441
+ end
442
+
443
+ def test_select_year_with_type_discarding
444
+ expected = %(<select id="date_year" name="date_year">\n)
445
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
446
+ expected << "</select>\n"
447
+
448
+ assert_dom_equal expected, select_year(
449
+ Time.mktime(2003, 8, 16), :prefix => "date_year", :discard_type => true, :start_year => 2003, :end_year => 2005)
450
+ assert_dom_equal expected, select_year(
451
+ 2003, :prefix => "date_year", :discard_type => true, :start_year => 2003, :end_year => 2005)
452
+ end
453
+
454
+ def test_select_year_descending
455
+ expected = %(<select id="date_year" name="date[year]">\n)
456
+ expected << %(<option value="2005" selected="selected">2005</option>\n<option value="2004">2004</option>\n<option value="2003">2003</option>\n)
457
+ expected << "</select>\n"
458
+
459
+ assert_dom_equal expected, select_year(Time.mktime(2005, 8, 16), :start_year => 2005, :end_year => 2003)
460
+ assert_dom_equal expected, select_year(2005, :start_year => 2005, :end_year => 2003)
461
+ end
462
+
463
+ def test_select_year_with_hidden
464
+ assert_dom_equal "<input type=\"hidden\" id=\"date_year\" name=\"date[year]\" value=\"2007\" />\n", select_year(2007, :use_hidden => true)
465
+ end
466
+
467
+ def test_select_year_with_hidden_and_field_name
468
+ assert_dom_equal "<input type=\"hidden\" id=\"date_anno\" name=\"date[anno]\" value=\"2007\" />\n", select_year(2007, :use_hidden => true, :field_name => 'anno')
469
+ end
470
+
471
+ def test_select_year_with_html_options
472
+ expected = %(<select id="date_year" name="date[year]" class="selector" accesskey="M">\n)
473
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
474
+ expected << "</select>\n"
475
+
476
+ assert_dom_equal expected, select_year(Time.mktime(2003, 8, 16), {:start_year => 2003, :end_year => 2005}, :class => 'selector', :accesskey => 'M')
477
+ #result = select_year(Time.mktime(2003, 8, 16), {:start_year => 2003, :end_year => 2005}, :class => 'selector', :accesskey => 'M')
478
+ #assert result.include?('<select id="date_year" name="date[year]"')
479
+ #assert result.include?('class="selector"')
480
+ #assert result.include?('accesskey="M"')
481
+ #assert result.include?('<option value="2003"')
482
+ end
483
+
484
+ def test_select_year_with_default_prompt
485
+ expected = %(<select id="date_year" name="date[year]">\n)
486
+ expected << %(<option value="">Year</option>\n<option value="2003">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
487
+ expected << "</select>\n"
488
+
489
+ assert_dom_equal expected, select_year(nil, :start_year => 2003, :end_year => 2005, :prompt => true)
490
+ end
491
+
492
+ def test_select_year_with_custom_prompt
493
+ expected = %(<select id="date_year" name="date[year]">\n)
494
+ expected << %(<option value="">Choose year</option>\n<option value="2003">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
495
+ expected << "</select>\n"
496
+
497
+ assert_dom_equal expected, select_year(nil, :start_year => 2003, :end_year => 2005, :prompt => 'Choose year')
498
+ end
499
+
500
+ def test_select_hour
501
+ expected = %(<select id="date_hour" name="date[hour]">\n)
502
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
503
+ expected << "</select>\n"
504
+
505
+ assert_dom_equal expected, select_hour(Time.mktime(2003, 8, 16, 8, 4, 18))
506
+ end
507
+
508
+ def test_select_hour_with_ampm
509
+ expected = %(<select id="date_hour" name="date[hour]">\n)
510
+ expected << %(<option value="00">12 AM</option>\n<option value="01">01 AM</option>\n<option value="02">02 AM</option>\n<option value="03">03 AM</option>\n<option value="04">04 AM</option>\n<option value="05">05 AM</option>\n<option value="06">06 AM</option>\n<option value="07">07 AM</option>\n<option value="08" selected="selected">08 AM</option>\n<option value="09">09 AM</option>\n<option value="10">10 AM</option>\n<option value="11">11 AM</option>\n<option value="12">12 PM</option>\n<option value="13">01 PM</option>\n<option value="14">02 PM</option>\n<option value="15">03 PM</option>\n<option value="16">04 PM</option>\n<option value="17">05 PM</option>\n<option value="18">06 PM</option>\n<option value="19">07 PM</option>\n<option value="20">08 PM</option>\n<option value="21">09 PM</option>\n<option value="22">10 PM</option>\n<option value="23">11 PM</option>\n)
511
+ expected << "</select>\n"
512
+
513
+ assert_dom_equal expected, select_hour(Time.mktime(2003, 8, 16, 8, 4, 18), :ampm => true)
514
+ end
515
+
516
+ def test_select_hour_with_disabled
517
+ expected = %(<select id="date_hour" name="date[hour]" disabled="disabled">\n)
518
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
519
+ expected << "</select>\n"
520
+
521
+ assert_dom_equal expected, select_hour(Time.mktime(2003, 8, 16, 8, 4, 18), :disabled => true)
522
+ end
523
+
524
+ def test_select_hour_with_field_name_override
525
+ expected = %(<select id="date_heure" name="date[heure]">\n)
526
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
527
+ expected << "</select>\n"
528
+
529
+ assert_dom_equal expected, select_hour(Time.mktime(2003, 8, 16, 8, 4, 18), :field_name => 'heure')
530
+ end
531
+
532
+ def test_select_hour_with_blank
533
+ expected = %(<select id="date_hour" name="date[hour]">\n)
534
+ expected << %(<option value=""></option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
535
+ expected << "</select>\n"
536
+
537
+ assert_dom_equal expected, select_hour(Time.mktime(2003, 8, 16, 8, 4, 18), :include_blank => true)
538
+ end
539
+
540
+ def test_select_hour_nil_with_blank
541
+ expected = %(<select id="date_hour" name="date[hour]">\n)
542
+ expected << %(<option value=""></option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
543
+ expected << "</select>\n"
544
+
545
+ assert_dom_equal expected, select_hour(nil, :include_blank => true)
546
+ end
547
+
548
+ def test_select_hour_with_html_options
549
+ expected = %(<select id="date_hour" name="date[hour]" class="selector" accesskey="M">\n)
550
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
551
+ expected << "</select>\n"
552
+
553
+ assert_dom_equal expected, select_hour(Time.mktime(2003, 8, 16, 8, 4, 18), {}, :class => 'selector', :accesskey => 'M')
554
+ end
555
+
556
+ def test_select_hour_with_default_prompt
557
+ expected = %(<select id="date_hour" name="date[hour]">\n)
558
+ expected << %(<option value="">Hour</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
559
+ expected << "</select>\n"
560
+
561
+ assert_dom_equal expected, select_hour(Time.mktime(2003, 8, 16, 8, 4, 18), :prompt => true)
562
+ end
563
+
564
+ def test_select_hour_with_custom_prompt
565
+ expected = %(<select id="date_hour" name="date[hour]">\n)
566
+ expected << %(<option value="">Choose hour</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
567
+ expected << "</select>\n"
568
+
569
+ assert_dom_equal expected, select_hour(Time.mktime(2003, 8, 16, 8, 4, 18), :prompt => 'Choose hour')
570
+ end
571
+
572
+ def test_select_minute
573
+ expected = %(<select id="date_minute" name="date[minute]">\n)
574
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
575
+ expected << "</select>\n"
576
+
577
+ assert_dom_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18))
578
+ end
579
+
580
+ def test_select_minute_with_disabled
581
+ expected = %(<select id="date_minute" name="date[minute]" disabled="disabled">\n)
582
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
583
+ expected << "</select>\n"
584
+
585
+ assert_dom_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18), :disabled => true)
586
+ end
587
+
588
+ def test_select_minute_with_field_name_override
589
+ expected = %(<select id="date_minuto" name="date[minuto]">\n)
590
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
591
+ expected << "</select>\n"
592
+
593
+ assert_dom_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18), :field_name => 'minuto')
594
+ end
595
+
596
+ def test_select_minute_with_blank
597
+ expected = %(<select id="date_minute" name="date[minute]">\n)
598
+ expected << %(<option value=""></option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
599
+ expected << "</select>\n"
600
+
601
+ assert_dom_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18), :include_blank => true)
602
+ end
603
+
604
+ def test_select_minute_with_blank_and_step
605
+ expected = %(<select id="date_minute" name="date[minute]">\n)
606
+ expected << %(<option value=""></option>\n<option value="00">00</option>\n<option value="15">15</option>\n<option value="30">30</option>\n<option value="45">45</option>\n)
607
+ expected << "</select>\n"
608
+
609
+ assert_dom_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18), { :include_blank => true , :minute_step => 15 })
610
+ end
611
+
612
+ def test_select_minute_nil_with_blank
613
+ expected = %(<select id="date_minute" name="date[minute]">\n)
614
+ expected << %(<option value=""></option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
615
+ expected << "</select>\n"
616
+
617
+ assert_dom_equal expected, select_minute(nil, :include_blank => true)
618
+ end
619
+
620
+ def test_select_minute_nil_with_blank_and_step
621
+ expected = %(<select id="date_minute" name="date[minute]">\n)
622
+ expected << %(<option value=""></option>\n<option value="00">00</option>\n<option value="15">15</option>\n<option value="30">30</option>\n<option value="45">45</option>\n)
623
+ expected << "</select>\n"
624
+
625
+ assert_dom_equal expected, select_minute(nil, { :include_blank => true , :minute_step => 15 })
626
+ end
627
+
628
+ def test_select_minute_with_hidden
629
+ assert_dom_equal "<input type=\"hidden\" id=\"date_minute\" name=\"date[minute]\" value=\"8\" />\n", select_minute(8, :use_hidden => true)
630
+ end
631
+
632
+ def test_select_minute_with_hidden_and_field_name
633
+ assert_dom_equal "<input type=\"hidden\" id=\"date_minuto\" name=\"date[minuto]\" value=\"8\" />\n", select_minute(8, :use_hidden => true, :field_name => 'minuto')
634
+ end
635
+
636
+ def test_select_minute_with_html_options
637
+ expected = %(<select id="date_minute" name="date[minute]" class="selector" accesskey="M">\n)
638
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
639
+ expected << "</select>\n"
640
+
641
+ assert_dom_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18), {}, :class => 'selector', :accesskey => 'M')
642
+
643
+ #result = select_minute(Time.mktime(2003, 8, 16, 8, 4, 18), {}, :class => 'selector', :accesskey => 'M')
644
+ #assert result.include?('<select id="date_minute" name="date[minute]"')
645
+ #assert result.include?('class="selector"')
646
+ #assert result.include?('accesskey="M"')
647
+ #assert result.include?('<option value="00">00')
648
+ end
649
+
650
+ def test_select_minute_with_default_prompt
651
+ expected = %(<select id="date_minute" name="date[minute]">\n)
652
+ expected << %(<option value="">Minute</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
653
+ expected << "</select>\n"
654
+
655
+ assert_dom_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18), :prompt => true)
656
+ end
657
+
658
+ def test_select_minute_with_custom_prompt
659
+ expected = %(<select id="date_minute" name="date[minute]">\n)
660
+ expected << %(<option value="">Choose minute</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
661
+ expected << "</select>\n"
662
+
663
+ assert_dom_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18), :prompt => 'Choose minute')
664
+ end
665
+
666
+ def test_select_second
667
+ expected = %(<select id="date_second" name="date[second]">\n)
668
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18" selected="selected">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
669
+ expected << "</select>\n"
670
+
671
+ assert_dom_equal expected, select_second(Time.mktime(2003, 8, 16, 8, 4, 18))
672
+ end
673
+
674
+ def test_select_second_with_disabled
675
+ expected = %(<select id="date_second" name="date[second]" disabled="disabled">\n)
676
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18" selected="selected">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
677
+ expected << "</select>\n"
678
+
679
+ assert_dom_equal expected, select_second(Time.mktime(2003, 8, 16, 8, 4, 18), :disabled => true)
680
+ end
681
+
682
+ def test_select_second_with_field_name_override
683
+ expected = %(<select id="date_segundo" name="date[segundo]">\n)
684
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18" selected="selected">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
685
+ expected << "</select>\n"
686
+
687
+ assert_dom_equal expected, select_second(Time.mktime(2003, 8, 16, 8, 4, 18), :field_name => 'segundo')
688
+ end
689
+
690
+ def test_select_second_with_blank
691
+ expected = %(<select id="date_second" name="date[second]">\n)
692
+ expected << %(<option value=""></option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18" selected="selected">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
693
+ expected << "</select>\n"
694
+
695
+ assert_dom_equal expected, select_second(Time.mktime(2003, 8, 16, 8, 4, 18), :include_blank => true)
696
+ end
697
+
698
+ def test_select_second_nil_with_blank
699
+ expected = %(<select id="date_second" name="date[second]">\n)
700
+ expected << %(<option value=""></option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
701
+ expected << "</select>\n"
702
+
703
+ assert_dom_equal expected, select_second(nil, :include_blank => true)
704
+ end
705
+
706
+ def test_select_second_with_html_options
707
+ expected = %(<select id="date_second" name="date[second]" class="selector" accesskey="M">\n)
708
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18" selected="selected">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
709
+ expected << "</select>\n"
710
+
711
+ assert_dom_equal expected, select_second(Time.mktime(2003, 8, 16, 8, 4, 18), {}, :class => 'selector', :accesskey => 'M')
712
+
713
+ #result = select_second(Time.mktime(2003, 8, 16, 8, 4, 18), {}, :class => 'selector', :accesskey => 'M')
714
+ #assert result.include?('<select id="date_second" name="date[second]"')
715
+ #assert result.include?('class="selector"')
716
+ #assert result.include?('accesskey="M"')
717
+ #assert result.include?('<option value="00">00')
718
+ end
719
+
720
+ def test_select_second_with_default_prompt
721
+ expected = %(<select id="date_second" name="date[second]">\n)
722
+ expected << %(<option value="">Seconds</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18" selected="selected">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
723
+ expected << "</select>\n"
724
+
725
+ assert_dom_equal expected, select_second(Time.mktime(2003, 8, 16, 8, 4, 18), :prompt => true)
726
+ end
727
+
728
+ def test_select_second_with_custom_prompt
729
+ expected = %(<select id="date_second" name="date[second]">\n)
730
+ expected << %(<option value="">Choose seconds</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18" selected="selected">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
731
+ expected << "</select>\n"
732
+
733
+ assert_dom_equal expected, select_second(Time.mktime(2003, 8, 16, 8, 4, 18), :prompt => 'Choose seconds')
734
+ end
735
+
736
+ def test_select_date
737
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
738
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
739
+ expected << "</select>\n"
740
+
741
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
742
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
743
+ expected << "</select>\n"
744
+
745
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
746
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
747
+ expected << "</select>\n"
748
+
749
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), :start_year => 2003, :end_year => 2005, :prefix => "date[first]")
750
+ end
751
+
752
+ def test_select_date_with_too_big_range_between_start_year_and_end_year
753
+ assert_raise(ArgumentError) { select_date(Time.mktime(2003, 8, 16), :start_year => 2000, :end_year => 20000, :prefix => "date[first]", :order => [:month, :day, :year]) }
754
+ assert_raise(ArgumentError) { select_date(Time.mktime(2003, 8, 16), :start_year => Date.today.year - 100.years, :end_year => 2000, :prefix => "date[first]", :order => [:month, :day, :year]) }
755
+ end
756
+
757
+ def test_select_date_can_have_more_then_1000_years_interval_if_forced_via_parameter
758
+ assert_nothing_raised { select_date(Time.mktime(2003, 8, 16), :start_year => 2000, :end_year => 3100, :max_years_allowed => 2000) }
759
+ end
760
+
761
+ def test_select_date_with_order
762
+ expected = %(<select id="date_first_month" name="date[first][month]">\n)
763
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
764
+ expected << "</select>\n"
765
+
766
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
767
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
768
+ expected << "</select>\n"
769
+
770
+ expected << %(<select id="date_first_year" name="date[first][year]">\n)
771
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
772
+ expected << "</select>\n"
773
+
774
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), :start_year => 2003, :end_year => 2005, :prefix => "date[first]", :order => [:month, :day, :year])
775
+ end
776
+
777
+ def test_select_date_with_incomplete_order
778
+ # Since the order is incomplete nothing will be shown
779
+ expected = %(<input id="date_first_year" name="date[first][year]" type="hidden" value="2003" />\n)
780
+ expected << %(<input id="date_first_month" name="date[first][month]" type="hidden" value="8" />\n)
781
+ expected << %(<input id="date_first_day" name="date[first][day]" type="hidden" value="1" />\n)
782
+
783
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), :start_year => 2003, :end_year => 2005, :prefix => "date[first]", :order => [:day])
784
+ end
785
+
786
+ def test_select_date_with_disabled
787
+ expected = %(<select id="date_first_year" name="date[first][year]" disabled="disabled">\n)
788
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
789
+ expected << "</select>\n"
790
+
791
+ expected << %(<select id="date_first_month" name="date[first][month]" disabled="disabled">\n)
792
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
793
+ expected << "</select>\n"
794
+
795
+ expected << %(<select id="date_first_day" name="date[first][day]" disabled="disabled">\n)
796
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
797
+ expected << "</select>\n"
798
+
799
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), :start_year => 2003, :end_year => 2005, :prefix => "date[first]", :disabled => true)
800
+ end
801
+
802
+ def test_select_date_with_no_start_year
803
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
804
+ (Date.today.year-5).upto(Date.today.year+1) do |y|
805
+ if y == Date.today.year
806
+ expected << %(<option value="#{y}" selected="selected">#{y}</option>\n)
807
+ else
808
+ expected << %(<option value="#{y}">#{y}</option>\n)
809
+ end
810
+ end
811
+ expected << "</select>\n"
812
+
813
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
814
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
815
+ expected << "</select>\n"
816
+
817
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
818
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
819
+ expected << "</select>\n"
820
+
821
+ assert_dom_equal expected, select_date(
822
+ Time.mktime(Date.today.year, 8, 16), :end_year => Date.today.year+1, :prefix => "date[first]"
823
+ )
824
+ end
825
+
826
+ def test_select_date_with_no_end_year
827
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
828
+ 2003.upto(2008) do |y|
829
+ if y == 2003
830
+ expected << %(<option value="#{y}" selected="selected">#{y}</option>\n)
831
+ else
832
+ expected << %(<option value="#{y}">#{y}</option>\n)
833
+ end
834
+ end
835
+ expected << "</select>\n"
836
+
837
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
838
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
839
+ expected << "</select>\n"
840
+
841
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
842
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
843
+ expected << "</select>\n"
844
+
845
+ assert_dom_equal expected, select_date(
846
+ Time.mktime(2003, 8, 16), :start_year => 2003, :prefix => "date[first]"
847
+ )
848
+ end
849
+
850
+ def test_select_date_with_no_start_or_end_year
851
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
852
+ (Date.today.year-5).upto(Date.today.year+5) do |y|
853
+ if y == Date.today.year
854
+ expected << %(<option value="#{y}" selected="selected">#{y}</option>\n)
855
+ else
856
+ expected << %(<option value="#{y}">#{y}</option>\n)
857
+ end
858
+ end
859
+ expected << "</select>\n"
860
+
861
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
862
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
863
+ expected << "</select>\n"
864
+
865
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
866
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
867
+ expected << "</select>\n"
868
+
869
+ assert_dom_equal expected, select_date(
870
+ Time.mktime(Date.today.year, 8, 16), :prefix => "date[first]"
871
+ )
872
+ end
873
+
874
+ def test_select_date_with_zero_value
875
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
876
+ expected << %(<option value="2003">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
877
+ expected << "</select>\n"
878
+
879
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
880
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
881
+ expected << "</select>\n"
882
+
883
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
884
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
885
+ expected << "</select>\n"
886
+
887
+ assert_dom_equal expected, select_date(0, :start_year => 2003, :end_year => 2005, :prefix => "date[first]")
888
+ end
889
+
890
+ def test_select_date_with_zero_value_and_no_start_year
891
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
892
+ (Date.today.year-5).upto(Date.today.year+1) { |y| expected << %(<option value="#{y}">#{y}</option>\n) }
893
+ expected << "</select>\n"
894
+
895
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
896
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
897
+ expected << "</select>\n"
898
+
899
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
900
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
901
+ expected << "</select>\n"
902
+
903
+ assert_dom_equal expected, select_date(0, :end_year => Date.today.year+1, :prefix => "date[first]")
904
+ end
905
+
906
+ def test_select_date_with_zero_value_and_no_end_year
907
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
908
+ last_year = Time.now.year + 5
909
+ 2003.upto(last_year) { |y| expected << %(<option value="#{y}">#{y}</option>\n) }
910
+ expected << "</select>\n"
911
+
912
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
913
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
914
+ expected << "</select>\n"
915
+
916
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
917
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
918
+ expected << "</select>\n"
919
+
920
+ assert_dom_equal expected, select_date(0, :start_year => 2003, :prefix => "date[first]")
921
+ end
922
+
923
+ def test_select_date_with_zero_value_and_no_start_and_end_year
924
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
925
+ (Date.today.year-5).upto(Date.today.year+5) { |y| expected << %(<option value="#{y}">#{y}</option>\n) }
926
+ expected << "</select>\n"
927
+
928
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
929
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
930
+ expected << "</select>\n"
931
+
932
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
933
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
934
+ expected << "</select>\n"
935
+
936
+ assert_dom_equal expected, select_date(0, :prefix => "date[first]")
937
+ end
938
+
939
+ def test_select_date_with_nil_value_and_no_start_and_end_year
940
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
941
+ (Date.today.year-5).upto(Date.today.year+5) { |y| expected << %(<option value="#{y}">#{y}</option>\n) }
942
+ expected << "</select>\n"
943
+
944
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
945
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
946
+ expected << "</select>\n"
947
+
948
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
949
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
950
+ expected << "</select>\n"
951
+
952
+ assert_dom_equal expected, select_date(nil, :prefix => "date[first]")
953
+ end
954
+
955
+ def test_select_date_with_html_options
956
+ expected = %(<select id="date_first_year" name="date[first][year]" class="selector">\n)
957
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
958
+ expected << "</select>\n"
959
+
960
+ expected << %(<select id="date_first_month" name="date[first][month]" class="selector">\n)
961
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
962
+ expected << "</select>\n"
963
+
964
+ expected << %(<select id="date_first_day" name="date[first][day]" class="selector">\n)
965
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
966
+ expected << "</select>\n"
967
+
968
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), {:start_year => 2003, :end_year => 2005, :prefix => "date[first]"}, :class => "selector")
969
+ end
970
+
971
+ def test_select_date_with_separator
972
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
973
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
974
+ expected << "</select>\n"
975
+
976
+ expected << " / "
977
+
978
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
979
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
980
+ expected << "</select>\n"
981
+
982
+ expected << " / "
983
+
984
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
985
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
986
+ expected << "</select>\n"
987
+
988
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { :date_separator => " / ", :start_year => 2003, :end_year => 2005, :prefix => "date[first]"})
989
+ end
990
+
991
+ def test_select_date_with_separator_and_discard_day
992
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
993
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
994
+ expected << "</select>\n"
995
+
996
+ expected << " / "
997
+
998
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
999
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
1000
+ expected << "</select>\n"
1001
+
1002
+ expected << %(<input type="hidden" id="date_first_day" name="date[first][day]" value="1" />\n)
1003
+
1004
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { :date_separator => " / ", :discard_day => true, :start_year => 2003, :end_year => 2005, :prefix => "date[first]"})
1005
+ end
1006
+
1007
+ def test_select_date_with_separator_discard_month_and_day
1008
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
1009
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
1010
+ expected << "</select>\n"
1011
+
1012
+ expected << %(<input type="hidden" id="date_first_month" name="date[first][month]" value="8" />\n)
1013
+ expected << %(<input type="hidden" id="date_first_day" name="date[first][day]" value="1" />\n)
1014
+
1015
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { :date_separator => " / ", :discard_month => true, :discard_day => true, :start_year => 2003, :end_year => 2005, :prefix => "date[first]"})
1016
+ end
1017
+
1018
+ def test_select_date_with_hidden
1019
+ expected = %(<input id="date_first_year" name="date[first][year]" type="hidden" value="2003"/>\n)
1020
+ expected << %(<input id="date_first_month" name="date[first][month]" type="hidden" value="8" />\n)
1021
+ expected << %(<input id="date_first_day" name="date[first][day]" type="hidden" value="16" />\n)
1022
+
1023
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { :prefix => "date[first]", :use_hidden => true })
1024
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { :date_separator => " / ", :prefix => "date[first]", :use_hidden => true })
1025
+ end
1026
+
1027
+ def test_select_date_with_css_classes_option
1028
+ expected = %(<select id="date_first_year" name="date[first][year]" class="year">\n)
1029
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
1030
+ expected << "</select>\n"
1031
+
1032
+ expected << %(<select id="date_first_month" name="date[first][month]" class="month">\n)
1033
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
1034
+ expected << "</select>\n"
1035
+
1036
+ expected << %(<select id="date_first_day" name="date[first][day]" class="day">\n)
1037
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
1038
+ expected << "</select>\n"
1039
+
1040
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), {:start_year => 2003, :end_year => 2005, :prefix => "date[first]", :with_css_classes => true})
1041
+ end
1042
+
1043
+ def test_select_date_with_css_classes_option_and_html_class_option
1044
+ expected = %(<select id="date_first_year" name="date[first][year]" class="datetime optional year">\n)
1045
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
1046
+ expected << "</select>\n"
1047
+
1048
+ expected << %(<select id="date_first_month" name="date[first][month]" class="datetime optional month">\n)
1049
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
1050
+ expected << "</select>\n"
1051
+
1052
+ expected << %(<select id="date_first_day" name="date[first][day]" class="datetime optional day">\n)
1053
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
1054
+ expected << "</select>\n"
1055
+
1056
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), {:start_year => 2003, :end_year => 2005, :prefix => "date[first]", :with_css_classes => true}, { class: 'datetime optional' })
1057
+ end
1058
+
1059
+ def test_select_datetime
1060
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
1061
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
1062
+ expected << "</select>\n"
1063
+
1064
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
1065
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
1066
+ expected << "</select>\n"
1067
+
1068
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
1069
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
1070
+ expected << "</select>\n"
1071
+
1072
+ expected << " &mdash; "
1073
+
1074
+ expected << %(<select id="date_first_hour" name="date[first][hour]">\n)
1075
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
1076
+ expected << "</select>\n"
1077
+
1078
+ expected << " : "
1079
+
1080
+ expected << %(<select id="date_first_minute" name="date[first][minute]">\n)
1081
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1082
+ expected << "</select>\n"
1083
+
1084
+ assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), :start_year => 2003, :end_year => 2005, :prefix => "date[first]")
1085
+ end
1086
+
1087
+ def test_select_datetime_with_ampm
1088
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
1089
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
1090
+ expected << "</select>\n"
1091
+
1092
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
1093
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
1094
+ expected << "</select>\n"
1095
+
1096
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
1097
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
1098
+ expected << "</select>\n"
1099
+
1100
+ expected << " &mdash; "
1101
+
1102
+ expected << %(<select id="date_first_hour" name="date[first][hour]">\n)
1103
+ expected << %(<option value="00">12 AM</option>\n<option value="01">01 AM</option>\n<option value="02">02 AM</option>\n<option value="03">03 AM</option>\n<option value="04">04 AM</option>\n<option value="05">05 AM</option>\n<option value="06">06 AM</option>\n<option value="07">07 AM</option>\n<option value="08" selected="selected">08 AM</option>\n<option value="09">09 AM</option>\n<option value="10">10 AM</option>\n<option value="11">11 AM</option>\n<option value="12">12 PM</option>\n<option value="13">01 PM</option>\n<option value="14">02 PM</option>\n<option value="15">03 PM</option>\n<option value="16">04 PM</option>\n<option value="17">05 PM</option>\n<option value="18">06 PM</option>\n<option value="19">07 PM</option>\n<option value="20">08 PM</option>\n<option value="21">09 PM</option>\n<option value="22">10 PM</option>\n<option value="23">11 PM</option>\n)
1104
+ expected << "</select>\n"
1105
+
1106
+ expected << " : "
1107
+
1108
+ expected << %(<select id="date_first_minute" name="date[first][minute]">\n)
1109
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1110
+ expected << "</select>\n"
1111
+
1112
+ assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), :start_year => 2003, :end_year => 2005, :prefix => "date[first]", :ampm => true)
1113
+ end
1114
+
1115
+ def test_select_datetime_with_separators
1116
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
1117
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
1118
+ expected << "</select>\n"
1119
+
1120
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
1121
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
1122
+ expected << "</select>\n"
1123
+
1124
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
1125
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
1126
+ expected << "</select>\n"
1127
+
1128
+ expected << " &mdash; "
1129
+
1130
+ expected << %(<select id="date_first_hour" name="date[first][hour]">\n)
1131
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
1132
+ expected << "</select>\n"
1133
+
1134
+ expected << " : "
1135
+
1136
+ expected << %(<select id="date_first_minute" name="date[first][minute]">\n)
1137
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1138
+ expected << "</select>\n"
1139
+
1140
+ assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), :start_year => 2003, :end_year => 2005, :prefix => "date[first]", :datetime_separator => ' &mdash; ', :time_separator => ' : ')
1141
+ end
1142
+
1143
+ def test_select_datetime_with_nil_value_and_no_start_and_end_year
1144
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
1145
+ (Date.today.year-5).upto(Date.today.year+5) { |y| expected << %(<option value="#{y}">#{y}</option>\n) }
1146
+ expected << "</select>\n"
1147
+
1148
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
1149
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
1150
+ expected << "</select>\n"
1151
+
1152
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
1153
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
1154
+ expected << "</select>\n"
1155
+
1156
+ expected << " &mdash; "
1157
+
1158
+ expected << %(<select id="date_first_hour" name="date[first][hour]">\n)
1159
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
1160
+ expected << "</select>\n"
1161
+
1162
+ expected << " : "
1163
+
1164
+ expected << %(<select id="date_first_minute" name="date[first][minute]">\n)
1165
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1166
+ expected << "</select>\n"
1167
+
1168
+ assert_dom_equal expected, select_datetime(nil, :prefix => "date[first]")
1169
+ end
1170
+
1171
+ def test_select_datetime_with_html_options
1172
+ expected = %(<select id="date_first_year" name="date[first][year]" class="selector">\n)
1173
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
1174
+ expected << "</select>\n"
1175
+
1176
+
1177
+ expected << %(<select id="date_first_month" name="date[first][month]" class="selector">\n)
1178
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
1179
+ expected << "</select>\n"
1180
+
1181
+ expected << %(<select id="date_first_day" name="date[first][day]" class="selector">\n)
1182
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
1183
+ expected << "</select>\n"
1184
+
1185
+ expected << " &mdash; "
1186
+
1187
+ expected << %(<select id="date_first_hour" name="date[first][hour]" class="selector">\n)
1188
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
1189
+ expected << "</select>\n"
1190
+
1191
+ expected << " : "
1192
+
1193
+ expected << %(<select id="date_first_minute" name="date[first][minute]" class="selector">\n)
1194
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1195
+ expected << "</select>\n"
1196
+
1197
+ assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), {:start_year => 2003, :end_year => 2005, :prefix => "date[first]"}, :class => 'selector')
1198
+ end
1199
+
1200
+ def test_select_datetime_with_all_separators
1201
+ expected = %(<select id="date_first_year" name="date[first][year]" class="selector">\n)
1202
+ expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
1203
+ expected << "</select>\n"
1204
+
1205
+ expected << "/"
1206
+
1207
+ expected << %(<select id="date_first_month" name="date[first][month]" class="selector">\n)
1208
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
1209
+ expected << "</select>\n"
1210
+
1211
+ expected << "/"
1212
+
1213
+ expected << %(<select id="date_first_day" name="date[first][day]" class="selector">\n)
1214
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
1215
+ expected << "</select>\n"
1216
+
1217
+ expected << "&mdash;"
1218
+
1219
+ expected << %(<select id="date_first_hour" name="date[first][hour]" class="selector">\n)
1220
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
1221
+ expected << "</select>\n"
1222
+
1223
+ expected << ":"
1224
+
1225
+ expected << %(<select id="date_first_minute" name="date[first][minute]" class="selector">\n)
1226
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1227
+ expected << "</select>\n"
1228
+
1229
+ assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), { :datetime_separator => "&mdash;", :date_separator => "/", :time_separator => ":", :start_year => 2003, :end_year => 2005, :prefix => "date[first]"}, :class => 'selector')
1230
+ end
1231
+
1232
+ def test_select_datetime_should_work_with_date
1233
+ assert_nothing_raised { select_datetime(Date.today) }
1234
+ end
1235
+
1236
+ def test_select_datetime_with_default_prompt
1237
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
1238
+ expected << %(<option value="">Year</option>\n<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
1239
+ expected << "</select>\n"
1240
+
1241
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
1242
+ expected << %(<option value="">Month</option>\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
1243
+ expected << "</select>\n"
1244
+
1245
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
1246
+ expected << %(<option value="">Day</option>\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
1247
+ expected << "</select>\n"
1248
+
1249
+ expected << " &mdash; "
1250
+
1251
+ expected << %(<select id="date_first_hour" name="date[first][hour]">\n)
1252
+ expected << %(<option value="">Hour</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
1253
+ expected << "</select>\n"
1254
+
1255
+ expected << " : "
1256
+
1257
+ expected << %(<select id="date_first_minute" name="date[first][minute]">\n)
1258
+ expected << %(<option value="">Minute</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1259
+ expected << "</select>\n"
1260
+
1261
+ assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), :start_year => 2003, :end_year => 2005,
1262
+ :prefix => "date[first]", :prompt => true)
1263
+ end
1264
+
1265
+ def test_select_datetime_with_custom_prompt
1266
+
1267
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
1268
+ expected << %(<option value="">Choose year</option>\n<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
1269
+ expected << "</select>\n"
1270
+
1271
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
1272
+ expected << %(<option value="">Choose month</option>\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
1273
+ expected << "</select>\n"
1274
+
1275
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
1276
+ expected << %(<option value="">Choose day</option>\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
1277
+ expected << "</select>\n"
1278
+
1279
+ expected << " &mdash; "
1280
+
1281
+ expected << %(<select id="date_first_hour" name="date[first][hour]">\n)
1282
+ expected << %(<option value="">Choose hour</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
1283
+ expected << "</select>\n"
1284
+
1285
+ expected << " : "
1286
+
1287
+ expected << %(<select id="date_first_minute" name="date[first][minute]">\n)
1288
+ expected << %(<option value="">Choose minute</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1289
+ expected << "</select>\n"
1290
+
1291
+ assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), :start_year => 2003, :end_year => 2005, :prefix => "date[first]",
1292
+ :prompt => {:day => 'Choose day', :month => 'Choose month', :year => 'Choose year', :hour => 'Choose hour', :minute => 'Choose minute'})
1293
+ end
1294
+
1295
+ def test_select_datetime_with_custom_hours
1296
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
1297
+ expected << %(<option value="">Choose year</option>\n<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
1298
+ expected << "</select>\n"
1299
+
1300
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
1301
+ expected << %(<option value="">Choose month</option>\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
1302
+ expected << "</select>\n"
1303
+
1304
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
1305
+ expected << %(<option value="">Choose day</option>\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
1306
+ expected << "</select>\n"
1307
+
1308
+ expected << " &mdash; "
1309
+
1310
+ expected << %(<select id="date_first_hour" name="date[first][hour]">\n)
1311
+ expected << %(<option value="">Choose hour</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n)
1312
+ expected << "</select>\n"
1313
+
1314
+ expected << " : "
1315
+
1316
+ expected << %(<select id="date_first_minute" name="date[first][minute]">\n)
1317
+ expected << %(<option value="">Choose minute</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1318
+ expected << "</select>\n"
1319
+
1320
+ assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), :start_year => 2003, :end_year => 2005, :start_hour => 1, :end_hour => 9, :prefix => "date[first]",
1321
+ :prompt => {:day => 'Choose day', :month => 'Choose month', :year => 'Choose year', :hour => 'Choose hour', :minute => 'Choose minute'})
1322
+ end
1323
+
1324
+ def test_select_datetime_with_hidden
1325
+ expected = %(<input id="date_first_year" name="date[first][year]" type="hidden" value="2003" />\n)
1326
+ expected << %(<input id="date_first_month" name="date[first][month]" type="hidden" value="8" />\n)
1327
+ expected << %(<input id="date_first_day" name="date[first][day]" type="hidden" value="16" />\n)
1328
+ expected << %(<input id="date_first_hour" name="date[first][hour]" type="hidden" value="8" />\n)
1329
+ expected << %(<input id="date_first_minute" name="date[first][minute]" type="hidden" value="4" />\n)
1330
+
1331
+ assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), :prefix => "date[first]", :use_hidden => true)
1332
+ assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), :datetime_separator => "&mdash;", :date_separator => "/",
1333
+ :time_separator => ":", :prefix => "date[first]", :use_hidden => true)
1334
+ end
1335
+
1336
+ def test_select_time
1337
+ expected = %(<input name="date[year]" id="date_year" value="2003" type="hidden" />\n)
1338
+ expected << %(<input name="date[month]" id="date_month" value="8" type="hidden" />\n)
1339
+ expected << %(<input name="date[day]" id="date_day" value="16" type="hidden" />\n)
1340
+
1341
+ expected << %(<select id="date_hour" name="date[hour]">\n)
1342
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
1343
+ expected << "</select>\n"
1344
+
1345
+ expected << " : "
1346
+
1347
+ expected << %(<select id="date_minute" name="date[minute]">\n)
1348
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1349
+ expected << "</select>\n"
1350
+
1351
+ assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18))
1352
+ assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), :include_seconds => false)
1353
+ end
1354
+
1355
+ def test_select_time_with_ampm
1356
+ expected = %(<input name="date[year]" id="date_year" value="2003" type="hidden" />\n)
1357
+ expected << %(<input name="date[month]" id="date_month" value="8" type="hidden" />\n)
1358
+ expected << %(<input name="date[day]" id="date_day" value="16" type="hidden" />\n)
1359
+
1360
+ expected << %(<select id="date_hour" name="date[hour]">\n)
1361
+ expected << %(<option value="00">12 AM</option>\n<option value="01">01 AM</option>\n<option value="02">02 AM</option>\n<option value="03">03 AM</option>\n<option value="04">04 AM</option>\n<option value="05">05 AM</option>\n<option value="06">06 AM</option>\n<option value="07">07 AM</option>\n<option value="08" selected="selected">08 AM</option>\n<option value="09">09 AM</option>\n<option value="10">10 AM</option>\n<option value="11">11 AM</option>\n<option value="12">12 PM</option>\n<option value="13">01 PM</option>\n<option value="14">02 PM</option>\n<option value="15">03 PM</option>\n<option value="16">04 PM</option>\n<option value="17">05 PM</option>\n<option value="18">06 PM</option>\n<option value="19">07 PM</option>\n<option value="20">08 PM</option>\n<option value="21">09 PM</option>\n<option value="22">10 PM</option>\n<option value="23">11 PM</option>\n)
1362
+ expected << "</select>\n"
1363
+
1364
+ expected << " : "
1365
+
1366
+ expected << %(<select id="date_minute" name="date[minute]">\n)
1367
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1368
+ expected << "</select>\n"
1369
+
1370
+ assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), :include_seconds => false, :ampm => true)
1371
+ end
1372
+
1373
+ def test_select_time_with_separator
1374
+ expected = %(<input name="date[year]" id="date_year" value="2003" type="hidden" />\n)
1375
+ expected << %(<input name="date[month]" id="date_month" value="8" type="hidden" />\n)
1376
+ expected << %(<input name="date[day]" id="date_day" value="16" type="hidden" />\n)
1377
+ expected << %(<select id="date_hour" name="date[hour]">\n)
1378
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
1379
+ expected << "</select>\n"
1380
+
1381
+ expected << " : "
1382
+
1383
+ expected << %(<select id="date_minute" name="date[minute]">\n)
1384
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1385
+ expected << "</select>\n"
1386
+
1387
+ assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), :time_separator => ' : ')
1388
+ assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), :time_separator => ' : ', :include_seconds => false)
1389
+ end
1390
+
1391
+ def test_select_time_with_seconds
1392
+ expected = %(<input name="date[year]" id="date_year" value="2003" type="hidden" />\n)
1393
+ expected << %(<input name="date[month]" id="date_month" value="8" type="hidden" />\n)
1394
+ expected << %(<input name="date[day]" id="date_day" value="16" type="hidden" />\n)
1395
+
1396
+ expected << %(<select id="date_hour" name="date[hour]">\n)
1397
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
1398
+ expected << "</select>\n"
1399
+
1400
+ expected << ' : '
1401
+
1402
+ expected << %(<select id="date_minute" name="date[minute]">\n)
1403
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1404
+ expected << "</select>\n"
1405
+
1406
+ expected << ' : '
1407
+
1408
+ expected << %(<select id="date_second" name="date[second]">\n)
1409
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18" selected="selected">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1410
+ expected << "</select>\n"
1411
+
1412
+ assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), :include_seconds => true)
1413
+ end
1414
+
1415
+ def test_select_time_with_seconds_and_separator
1416
+ expected = %(<input name="date[year]" id="date_year" value="2003" type="hidden" />\n)
1417
+ expected << %(<input name="date[month]" id="date_month" value="8" type="hidden" />\n)
1418
+ expected << %(<input name="date[day]" id="date_day" value="16" type="hidden" />\n)
1419
+
1420
+ expected << %(<select id="date_hour" name="date[hour]">\n)
1421
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
1422
+ expected << "</select>\n"
1423
+
1424
+ expected << " : "
1425
+
1426
+ expected << %(<select id="date_minute" name="date[minute]">\n)
1427
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1428
+ expected << "</select>\n"
1429
+
1430
+ expected << " : "
1431
+
1432
+ expected << %(<select id="date_second" name="date[second]">\n)
1433
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18" selected="selected">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1434
+ expected << "</select>\n"
1435
+
1436
+ assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), :include_seconds => true, :time_separator => ' : ')
1437
+ end
1438
+
1439
+ def test_select_time_with_html_options
1440
+ expected = %(<input name="date[year]" id="date_year" value="2003" type="hidden" />\n)
1441
+ expected << %(<input name="date[month]" id="date_month" value="8" type="hidden" />\n)
1442
+ expected << %(<input name="date[day]" id="date_day" value="16" type="hidden" />\n)
1443
+
1444
+ expected << %(<select id="date_hour" name="date[hour]" class="selector">\n)
1445
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
1446
+ expected << "</select>\n"
1447
+
1448
+ expected << " : "
1449
+
1450
+ expected << %(<select id="date_minute" name="date[minute]" class="selector">\n)
1451
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1452
+ expected << "</select>\n"
1453
+
1454
+ assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), {}, :class => 'selector')
1455
+ assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), {:include_seconds => false}, :class => 'selector')
1456
+ end
1457
+
1458
+ def test_select_time_should_work_with_date
1459
+ assert_nothing_raised { select_time(Date.today) }
1460
+ end
1461
+
1462
+ def test_select_time_with_default_prompt
1463
+ expected = %(<input name="date[year]" id="date_year" value="2003" type="hidden" />\n)
1464
+ expected << %(<input name="date[month]" id="date_month" value="8" type="hidden" />\n)
1465
+ expected << %(<input name="date[day]" id="date_day" value="16" type="hidden" />\n)
1466
+
1467
+ expected << %(<select id="date_hour" name="date[hour]">\n)
1468
+ expected << %(<option value="">Hour</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
1469
+ expected << "</select>\n"
1470
+
1471
+ expected << " : "
1472
+
1473
+ expected << %(<select id="date_minute" name="date[minute]">\n)
1474
+ expected << %(<option value="">Minute</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1475
+ expected << "</select>\n"
1476
+
1477
+ expected << " : "
1478
+
1479
+ expected << %(<select id="date_second" name="date[second]">\n)
1480
+ expected << %(<option value="">Seconds</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18" selected="selected">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1481
+ expected << "</select>\n"
1482
+
1483
+ assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), :include_seconds => true, :prompt => true)
1484
+ end
1485
+
1486
+ def test_select_time_with_custom_prompt
1487
+ expected = %(<input name="date[year]" id="date_year" value="2003" type="hidden" />\n)
1488
+ expected << %(<input name="date[month]" id="date_month" value="8" type="hidden" />\n)
1489
+ expected << %(<input name="date[day]" id="date_day" value="16" type="hidden" />\n)
1490
+
1491
+ expected << %(<select id="date_hour" name="date[hour]">\n)
1492
+ expected << %(<option value="">Choose hour</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08" selected="selected">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
1493
+ expected << "</select>\n"
1494
+
1495
+ expected << " : "
1496
+
1497
+ expected << %(<select id="date_minute" name="date[minute]">\n)
1498
+ expected << %(<option value="">Choose minute</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1499
+ expected << "</select>\n"
1500
+
1501
+ expected << " : "
1502
+
1503
+ expected << %(<select id="date_second" name="date[second]">\n)
1504
+ expected << %(<option value="">Choose seconds</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18" selected="selected">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
1505
+ expected << "</select>\n"
1506
+
1507
+ assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), :include_seconds => true,
1508
+ :prompt => {:hour => 'Choose hour', :minute => 'Choose minute', :second => 'Choose seconds'})
1509
+ end
1510
+
1511
+ def test_select_time_with_hidden
1512
+ expected = %(<input id="date_first_year" name="date[first][year]" type="hidden" value="2003" />\n)
1513
+ expected << %(<input id="date_first_month" name="date[first][month]" type="hidden" value="8" />\n)
1514
+ expected << %(<input id="date_first_day" name="date[first][day]" type="hidden" value="16" />\n)
1515
+ expected << %(<input id="date_first_hour" name="date[first][hour]" type="hidden" value="8" />\n)
1516
+ expected << %(<input id="date_first_minute" name="date[first][minute]" type="hidden" value="4" />\n)
1517
+
1518
+ assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), :prefix => "date[first]", :use_hidden => true)
1519
+ assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), :time_separator => ":", :prefix => "date[first]", :use_hidden => true)
1520
+ end
1521
+
1522
+ def test_date_select
1523
+ @post = Post.new
1524
+ @post.written_on = Date.new(2004, 6, 15)
1525
+
1526
+ expected = %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
1527
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
1528
+ expected << "</select>\n"
1529
+
1530
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
1531
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
1532
+ expected << "</select>\n"
1533
+
1534
+ expected << %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n}
1535
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
1536
+
1537
+ expected << "</select>\n"
1538
+
1539
+ assert_dom_equal expected, date_select("post", "written_on")
1540
+ end
1541
+
1542
+ def test_date_select_with_selected
1543
+ @post = Post.new
1544
+ @post.written_on = Date.new(2004, 6, 15)
1545
+
1546
+ expected = %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
1547
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option selected="selected" value="2004">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
1548
+ expected << "</select>\n"
1549
+
1550
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
1551
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7" selected="selected">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
1552
+ expected << "</select>\n"
1553
+
1554
+ expected << %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n}
1555
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10" selected="selected">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
1556
+
1557
+ expected << "</select>\n"
1558
+
1559
+ assert_dom_equal expected, date_select("post", "written_on", :selected => Date.new(2004, 07, 10))
1560
+ end
1561
+
1562
+ def test_date_select_with_selected_nil
1563
+ @post = Post.new
1564
+ @post.written_on = Date.new(2004, 6, 15)
1565
+
1566
+ expected = '<input id="post_written_on_1i" name="post[written_on(1i)]" type="hidden" value="1"/>' + "\n"
1567
+
1568
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
1569
+ expected << %{<option value=""></option>\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
1570
+ expected << "</select>\n"
1571
+
1572
+ expected << %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n}
1573
+ expected << %{<option value=""></option>\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
1574
+
1575
+ expected << "</select>\n"
1576
+
1577
+ assert_dom_equal expected, date_select("post", "written_on", include_blank: true, discard_year: true, selected: nil)
1578
+ end
1579
+
1580
+ def test_date_select_without_day
1581
+ @post = Post.new
1582
+ @post.written_on = Date.new(2004, 6, 15)
1583
+
1584
+ expected = "<input type=\"hidden\" id=\"post_written_on_3i\" name=\"post[written_on(3i)]\" value=\"1\" />\n"
1585
+
1586
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
1587
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
1588
+ expected << "</select>\n"
1589
+
1590
+ expected << %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
1591
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
1592
+ expected << "</select>\n"
1593
+
1594
+ assert_dom_equal expected, date_select("post", "written_on", :order => [ :month, :year ])
1595
+ end
1596
+
1597
+ def test_date_select_without_day_and_month
1598
+ @post = Post.new
1599
+ @post.written_on = Date.new(2004, 2, 29)
1600
+
1601
+ expected = "<input type=\"hidden\" id=\"post_written_on_2i\" name=\"post[written_on(2i)]\" value=\"2\" />\n"
1602
+ expected << "<input type=\"hidden\" id=\"post_written_on_3i\" name=\"post[written_on(3i)]\" value=\"1\" />\n"
1603
+
1604
+ expected << %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
1605
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
1606
+ expected << "</select>\n"
1607
+
1608
+ assert_dom_equal expected, date_select("post", "written_on", :order => [ :year ])
1609
+ end
1610
+
1611
+ def test_date_select_without_day_with_separator
1612
+ @post = Post.new
1613
+ @post.written_on = Date.new(2004, 6, 15)
1614
+
1615
+ expected = "<input type=\"hidden\" id=\"post_written_on_3i\" name=\"post[written_on(3i)]\" value=\"1\" />\n"
1616
+
1617
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
1618
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
1619
+ expected << "</select>\n"
1620
+
1621
+ expected << "/"
1622
+
1623
+ expected << %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
1624
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
1625
+ expected << "</select>\n"
1626
+
1627
+ assert_dom_equal expected, date_select("post", "written_on", :date_separator => '/', :order => [ :month, :year ])
1628
+ end
1629
+
1630
+ def test_date_select_without_day_and_with_disabled_html_option
1631
+ @post = Post.new
1632
+ @post.written_on = Date.new(2004, 6, 15)
1633
+
1634
+ expected = "<input type=\"hidden\" id=\"post_written_on_3i\" disabled=\"disabled\" name=\"post[written_on(3i)]\" value=\"1\" />\n"
1635
+
1636
+ expected << %{<select id="post_written_on_2i" disabled="disabled" name="post[written_on(2i)]">\n}
1637
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
1638
+ expected << "</select>\n"
1639
+
1640
+ expected << %{<select id="post_written_on_1i" disabled="disabled" name="post[written_on(1i)]">\n}
1641
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
1642
+ expected << "</select>\n"
1643
+
1644
+ assert_dom_equal expected, date_select("post", "written_on", { :order => [ :month, :year ] }, :disabled => true)
1645
+ end
1646
+
1647
+ def test_date_select_within_fields_for
1648
+ @post = Post.new
1649
+ @post.written_on = Date.new(2004, 6, 15)
1650
+
1651
+ output_buffer = fields_for :post, @post do |f|
1652
+ concat f.date_select(:written_on)
1653
+ end
1654
+
1655
+ expected = %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option selected="selected" value="2004">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n</select>\n}
1656
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option selected="selected" value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n</select>\n}
1657
+ expected << %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option selected="selected" value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n</select>\n}
1658
+
1659
+ assert_dom_equal(expected, output_buffer)
1660
+ end
1661
+
1662
+ def test_date_select_within_fields_for_with_index
1663
+ @post = Post.new
1664
+ @post.written_on = Date.new(2004, 6, 15)
1665
+ id = 27
1666
+
1667
+ output_buffer = fields_for :post, @post, :index => id do |f|
1668
+ concat f.date_select(:written_on)
1669
+ end
1670
+
1671
+ expected = %{<select id="post_#{id}_written_on_1i" name="post[#{id}][written_on(1i)]">\n<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option selected="selected" value="2004">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n</select>\n}
1672
+ expected << %{<select id="post_#{id}_written_on_2i" name="post[#{id}][written_on(2i)]">\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option selected="selected" value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n</select>\n}
1673
+ expected << %{<select id="post_#{id}_written_on_3i" name="post[#{id}][written_on(3i)]">\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option selected="selected" value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n</select>\n}
1674
+
1675
+ assert_dom_equal(expected, output_buffer)
1676
+ end
1677
+
1678
+ def test_date_select_within_fields_for_with_blank_index
1679
+ @post = Post.new
1680
+ @post.written_on = Date.new(2004, 6, 15)
1681
+ id = nil
1682
+
1683
+ output_buffer = fields_for :post, @post, :index => id do |f|
1684
+ concat f.date_select(:written_on)
1685
+ end
1686
+
1687
+
1688
+ expected = %{<select id="post_#{id}_written_on_1i" name="post[#{id}][written_on(1i)]">\n<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option selected="selected" value="2004">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n</select>\n}
1689
+ expected << %{<select id="post_#{id}_written_on_2i" name="post[#{id}][written_on(2i)]">\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option selected="selected" value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n</select>\n}
1690
+ expected << %{<select id="post_#{id}_written_on_3i" name="post[#{id}][written_on(3i)]">\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option selected="selected" value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n</select>\n}
1691
+
1692
+ assert_dom_equal(expected, output_buffer)
1693
+ end
1694
+
1695
+ def test_date_select_with_index
1696
+ @post = Post.new
1697
+ @post.written_on = Date.new(2004, 6, 15)
1698
+ id = 456
1699
+
1700
+ expected = %{<select id="post_456_written_on_1i" name="post[#{id}][written_on(1i)]">\n}
1701
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
1702
+ expected << "</select>\n"
1703
+
1704
+ expected << %{<select id="post_456_written_on_2i" name="post[#{id}][written_on(2i)]">\n}
1705
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
1706
+ expected << "</select>\n"
1707
+
1708
+ expected << %{<select id="post_456_written_on_3i" name="post[#{id}][written_on(3i)]">\n}
1709
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
1710
+ expected << "</select>\n"
1711
+
1712
+ assert_dom_equal expected, date_select("post", "written_on", :index => id)
1713
+ end
1714
+
1715
+ def test_date_select_with_auto_index
1716
+ @post = Post.new
1717
+ @post.written_on = Date.new(2004, 6, 15)
1718
+ id = 123
1719
+
1720
+ expected = %{<select id="post_123_written_on_1i" name="post[#{id}][written_on(1i)]">\n}
1721
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
1722
+ expected << "</select>\n"
1723
+
1724
+ expected << %{<select id="post_123_written_on_2i" name="post[#{id}][written_on(2i)]">\n}
1725
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
1726
+ expected << "</select>\n"
1727
+
1728
+ expected << %{<select id="post_123_written_on_3i" name="post[#{id}][written_on(3i)]">\n}
1729
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
1730
+ expected << "</select>\n"
1731
+
1732
+ assert_dom_equal expected, date_select("post[]", "written_on")
1733
+ end
1734
+
1735
+ def test_date_select_with_different_order
1736
+ @post = Post.new
1737
+ @post.written_on = Date.new(2004, 6, 15)
1738
+
1739
+ expected = %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n}
1740
+ 1.upto(31) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 15}>#{i}</option>\n) }
1741
+ expected << "</select>\n"
1742
+
1743
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
1744
+ 1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Date::MONTHNAMES[i]}</option>\n) }
1745
+ expected << "</select>\n"
1746
+
1747
+ expected << %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
1748
+ 1999.upto(2009) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 2004}>#{i}</option>\n) }
1749
+ expected << "</select>\n"
1750
+
1751
+ assert_dom_equal expected, date_select("post", "written_on", :order => [:day, :month, :year])
1752
+ end
1753
+
1754
+ def test_date_select_with_nil
1755
+ @post = Post.new
1756
+
1757
+ start_year = Time.now.year-5
1758
+ end_year = Time.now.year+5
1759
+ expected = %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
1760
+ start_year.upto(end_year) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == Time.now.year}>#{i}</option>\n) }
1761
+ expected << "</select>\n"
1762
+
1763
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
1764
+ 1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == Time.now.month}>#{Date::MONTHNAMES[i]}</option>\n) }
1765
+ expected << "</select>\n"
1766
+
1767
+ expected << %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n}
1768
+ 1.upto(31) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == Time.now.day}>#{i}</option>\n) }
1769
+ expected << "</select>\n"
1770
+
1771
+ assert_dom_equal expected, date_select("post", "written_on")
1772
+ end
1773
+
1774
+ def test_date_select_with_nil_and_blank
1775
+ @post = Post.new
1776
+
1777
+ start_year = Time.now.year-5
1778
+ end_year = Time.now.year+5
1779
+ expected = %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
1780
+ expected << "<option value=\"\"></option>\n"
1781
+ start_year.upto(end_year) { |i| expected << %(<option value="#{i}">#{i}</option>\n) }
1782
+ expected << "</select>\n"
1783
+
1784
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
1785
+ expected << "<option value=\"\"></option>\n"
1786
+ 1.upto(12) { |i| expected << %(<option value="#{i}">#{Date::MONTHNAMES[i]}</option>\n) }
1787
+ expected << "</select>\n"
1788
+
1789
+ expected << %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n}
1790
+ expected << "<option value=\"\"></option>\n"
1791
+ 1.upto(31) { |i| expected << %(<option value="#{i}">#{i}</option>\n) }
1792
+ expected << "</select>\n"
1793
+
1794
+ assert_dom_equal expected, date_select("post", "written_on", :include_blank => true)
1795
+ end
1796
+
1797
+ def test_date_select_with_nil_and_blank_and_order
1798
+ @post = Post.new
1799
+
1800
+ start_year = Time.now.year-5
1801
+ end_year = Time.now.year+5
1802
+
1803
+ expected = '<input name="post[written_on(3i)]" type="hidden" id="post_written_on_3i" value="1"/>' + "\n"
1804
+ expected << %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
1805
+ expected << "<option value=\"\"></option>\n"
1806
+ start_year.upto(end_year) { |i| expected << %(<option value="#{i}">#{i}</option>\n) }
1807
+ expected << "</select>\n"
1808
+
1809
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
1810
+ expected << "<option value=\"\"></option>\n"
1811
+ 1.upto(12) { |i| expected << %(<option value="#{i}">#{Date::MONTHNAMES[i]}</option>\n) }
1812
+ expected << "</select>\n"
1813
+
1814
+ assert_dom_equal expected, date_select("post", "written_on", :order=>[:year, :month], :include_blank=>true)
1815
+ end
1816
+
1817
+ def test_date_select_with_nil_and_blank_and_discard_month
1818
+ @post = Post.new
1819
+
1820
+ start_year = Time.now.year-5
1821
+ end_year = Time.now.year+5
1822
+
1823
+ expected = %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
1824
+ expected << "<option value=\"\"></option>\n"
1825
+ start_year.upto(end_year) { |i| expected << %(<option value="#{i}">#{i}</option>\n) }
1826
+ expected << "</select>\n"
1827
+ expected << '<input name="post[written_on(2i)]" type="hidden" id="post_written_on_2i" value="1"/>' + "\n"
1828
+ expected << '<input name="post[written_on(3i)]" type="hidden" id="post_written_on_3i" value="1"/>' + "\n"
1829
+
1830
+ assert_dom_equal expected, date_select("post", "written_on", :discard_month => true, :include_blank=>true)
1831
+ end
1832
+
1833
+ def test_date_select_with_nil_and_blank_and_discard_year
1834
+ @post = Post.new
1835
+
1836
+ expected = '<input id="post_written_on_1i" name="post[written_on(1i)]" type="hidden" value="1" />' + "\n"
1837
+
1838
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
1839
+ expected << "<option value=\"\"></option>\n"
1840
+ 1.upto(12) { |i| expected << %(<option value="#{i}">#{Date::MONTHNAMES[i]}</option>\n) }
1841
+ expected << "</select>\n"
1842
+
1843
+ expected << %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n}
1844
+ expected << "<option value=\"\"></option>\n"
1845
+ 1.upto(31) { |i| expected << %(<option value="#{i}">#{i}</option>\n) }
1846
+ expected << "</select>\n"
1847
+
1848
+ assert_dom_equal expected, date_select("post", "written_on", :discard_year => true, :include_blank=>true)
1849
+ end
1850
+
1851
+ def test_date_select_cant_override_discard_hour
1852
+ @post = Post.new
1853
+ @post.written_on = Date.new(2004, 6, 15)
1854
+
1855
+ expected = %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
1856
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
1857
+ expected << "</select>\n"
1858
+
1859
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
1860
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
1861
+ expected << "</select>\n"
1862
+
1863
+ expected << %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n}
1864
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
1865
+ expected << "</select>\n"
1866
+
1867
+ assert_dom_equal expected, date_select("post", "written_on", :discard_hour => false)
1868
+ end
1869
+
1870
+ def test_date_select_with_html_options
1871
+ @post = Post.new
1872
+ @post.written_on = Date.new(2004, 6, 15)
1873
+
1874
+ expected = %{<select id="post_written_on_1i" name="post[written_on(1i)]" class="selector">\n}
1875
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
1876
+ expected << "</select>\n"
1877
+
1878
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]" class="selector">\n}
1879
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
1880
+ expected << "</select>\n"
1881
+
1882
+ expected << %{<select id="post_written_on_3i" name="post[written_on(3i)]" class="selector">\n}
1883
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
1884
+
1885
+ expected << "</select>\n"
1886
+
1887
+ assert_dom_equal expected, date_select("post", "written_on", {}, :class => 'selector')
1888
+ end
1889
+
1890
+ def test_date_select_with_html_options_within_fields_for
1891
+ @post = Post.new
1892
+ @post.written_on = Date.new(2004, 6, 15)
1893
+
1894
+ output_buffer = fields_for :post, @post do |f|
1895
+ concat f.date_select(:written_on, {}, :class => 'selector')
1896
+ end
1897
+
1898
+ expected = %{<select id="post_written_on_1i" name="post[written_on(1i)]" class="selector">\n}
1899
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
1900
+ expected << "</select>\n"
1901
+
1902
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]" class="selector">\n}
1903
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
1904
+ expected << "</select>\n"
1905
+
1906
+ expected << %{<select id="post_written_on_3i" name="post[written_on(3i)]" class="selector">\n}
1907
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
1908
+
1909
+ expected << "</select>\n"
1910
+
1911
+ assert_dom_equal expected, output_buffer
1912
+ end
1913
+
1914
+ def test_date_select_with_separator
1915
+ @post = Post.new
1916
+ @post.written_on = Date.new(2004, 6, 15)
1917
+
1918
+ expected = %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
1919
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
1920
+ expected << "</select>\n"
1921
+
1922
+ expected << " / "
1923
+
1924
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
1925
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
1926
+ expected << "</select>\n"
1927
+
1928
+ expected << " / "
1929
+
1930
+ expected << %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n}
1931
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
1932
+
1933
+ expected << "</select>\n"
1934
+
1935
+ assert_dom_equal expected, date_select("post", "written_on", { :date_separator => " / " })
1936
+ end
1937
+
1938
+ def test_date_select_with_separator_and_order
1939
+ @post = Post.new
1940
+ @post.written_on = Date.new(2004, 6, 15)
1941
+
1942
+ expected = %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n}
1943
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
1944
+ expected << "</select>\n"
1945
+
1946
+ expected << " / "
1947
+
1948
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
1949
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
1950
+ expected << "</select>\n"
1951
+
1952
+ expected << " / "
1953
+
1954
+ expected << %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
1955
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
1956
+ expected << "</select>\n"
1957
+
1958
+ assert_dom_equal expected, date_select("post", "written_on", { :order => [:day, :month, :year], :date_separator => " / " })
1959
+ end
1960
+
1961
+ def test_date_select_with_separator_and_order_and_year_discarded
1962
+ @post = Post.new
1963
+ @post.written_on = Date.new(2004, 6, 15)
1964
+
1965
+ expected = %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n}
1966
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
1967
+ expected << "</select>\n"
1968
+
1969
+ expected << " / "
1970
+
1971
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
1972
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
1973
+ expected << "</select>\n"
1974
+ expected << %{<input type="hidden" id="post_written_on_1i" name="post[written_on(1i)]" value="2004" />\n}
1975
+
1976
+ assert_dom_equal expected, date_select("post", "written_on", { :order => [:day, :month, :year], :discard_year => true, :date_separator => " / " })
1977
+ end
1978
+
1979
+ def test_date_select_with_default_prompt
1980
+ @post = Post.new
1981
+ @post.written_on = Date.new(2004, 6, 15)
1982
+
1983
+ expected = %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
1984
+ expected << %{<option value="">Year</option>\n<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
1985
+ expected << "</select>\n"
1986
+
1987
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
1988
+ expected << %{<option value="">Month</option>\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
1989
+ expected << "</select>\n"
1990
+
1991
+ expected << %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n}
1992
+ expected << %{<option value="">Day</option>\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
1993
+
1994
+ expected << "</select>\n"
1995
+
1996
+ assert_dom_equal expected, date_select("post", "written_on", :prompt => true)
1997
+ end
1998
+
1999
+ def test_date_select_with_custom_prompt
2000
+ @post = Post.new
2001
+ @post.written_on = Date.new(2004, 6, 15)
2002
+
2003
+ expected = %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
2004
+ expected << %{<option value="">Choose year</option>\n<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
2005
+ expected << "</select>\n"
2006
+
2007
+ expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
2008
+ expected << %{<option value="">Choose month</option>\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
2009
+ expected << "</select>\n"
2010
+
2011
+ expected << %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n}
2012
+ expected << %{<option value="">Choose day</option>\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
2013
+
2014
+ expected << "</select>\n"
2015
+
2016
+ assert_dom_equal expected, date_select("post", "written_on", :prompt => {:year => 'Choose year', :month => 'Choose month', :day => 'Choose day'})
2017
+ end
2018
+
2019
+ def test_time_select
2020
+ @post = Post.new
2021
+ @post.written_on = Time.local(2004, 6, 15, 15, 16, 35)
2022
+
2023
+ expected = %{<input type="hidden" id="post_written_on_1i" name="post[written_on(1i)]" value="2004" />\n}
2024
+ expected << %{<input type="hidden" id="post_written_on_2i" name="post[written_on(2i)]" value="6" />\n}
2025
+ expected << %{<input type="hidden" id="post_written_on_3i" name="post[written_on(3i)]" value="15" />\n}
2026
+
2027
+ expected << %(<select id="post_written_on_4i" name="post[written_on(4i)]">\n)
2028
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2029
+ expected << "</select>\n"
2030
+ expected << " : "
2031
+ expected << %(<select id="post_written_on_5i" name="post[written_on(5i)]">\n)
2032
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2033
+ expected << "</select>\n"
2034
+
2035
+ assert_dom_equal expected, time_select("post", "written_on")
2036
+ end
2037
+
2038
+ def test_time_select_with_selected
2039
+ @post = Post.new
2040
+ @post.written_on = Time.local(2004, 6, 15, 15, 16, 35)
2041
+
2042
+ expected = %{<input type="hidden" id="post_written_on_1i" name="post[written_on(1i)]" value="2004" />\n}
2043
+ expected << %{<input type="hidden" id="post_written_on_2i" name="post[written_on(2i)]" value="6" />\n}
2044
+ expected << %{<input type="hidden" id="post_written_on_3i" name="post[written_on(3i)]" value="15" />\n}
2045
+
2046
+ expected << %(<select id="post_written_on_4i" name="post[written_on(4i)]">\n)
2047
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 12}>#{sprintf("%02d", i)}</option>\n) }
2048
+ expected << "</select>\n"
2049
+ expected << " : "
2050
+ expected << %(<select id="post_written_on_5i" name="post[written_on(5i)]">\n)
2051
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 20}>#{sprintf("%02d", i)}</option>\n) }
2052
+ expected << "</select>\n"
2053
+
2054
+ assert_dom_equal expected, time_select("post", "written_on", selected: Time.local(2004, 6, 15, 12, 20, 30))
2055
+ end
2056
+
2057
+ def test_time_select_with_selected_nil
2058
+ @post = Post.new
2059
+ @post.written_on = Time.local(2004, 6, 15, 15, 16, 35)
2060
+
2061
+ expected = %{<input type="hidden" id="post_written_on_1i" name="post[written_on(1i)]" value="1" />\n}
2062
+ expected << %{<input type="hidden" id="post_written_on_2i" name="post[written_on(2i)]" value="1" />\n}
2063
+ expected << %{<input type="hidden" id="post_written_on_3i" name="post[written_on(3i)]" value="1" />\n}
2064
+
2065
+ expected << %(<select id="post_written_on_4i" name="post[written_on(4i)]">\n)
2066
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}">#{sprintf("%02d", i)}</option>\n) }
2067
+ expected << "</select>\n"
2068
+ expected << " : "
2069
+ expected << %(<select id="post_written_on_5i" name="post[written_on(5i)]">\n)
2070
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}">#{sprintf("%02d", i)}</option>\n) }
2071
+ expected << "</select>\n"
2072
+
2073
+ assert_dom_equal expected, time_select("post", "written_on", discard_year: true, discard_month: true, discard_day: true, selected: nil)
2074
+ end
2075
+
2076
+ def test_time_select_without_date_hidden_fields
2077
+ @post = Post.new
2078
+ @post.written_on = Time.local(2004, 6, 15, 15, 16, 35)
2079
+
2080
+ expected = %(<select id="post_written_on_4i" name="post[written_on(4i)]">\n)
2081
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2082
+ expected << "</select>\n"
2083
+ expected << " : "
2084
+ expected << %(<select id="post_written_on_5i" name="post[written_on(5i)]">\n)
2085
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2086
+ expected << "</select>\n"
2087
+
2088
+ assert_dom_equal expected, time_select("post", "written_on", :ignore_date => true)
2089
+ end
2090
+
2091
+ def test_time_select_with_seconds
2092
+ @post = Post.new
2093
+ @post.written_on = Time.local(2004, 6, 15, 15, 16, 35)
2094
+
2095
+ expected = %{<input type="hidden" id="post_written_on_1i" name="post[written_on(1i)]" value="2004" />\n}
2096
+ expected << %{<input type="hidden" id="post_written_on_2i" name="post[written_on(2i)]" value="6" />\n}
2097
+ expected << %{<input type="hidden" id="post_written_on_3i" name="post[written_on(3i)]" value="15" />\n}
2098
+
2099
+ expected << %(<select id="post_written_on_4i" name="post[written_on(4i)]">\n)
2100
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2101
+ expected << "</select>\n"
2102
+ expected << " : "
2103
+ expected << %(<select id="post_written_on_5i" name="post[written_on(5i)]">\n)
2104
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2105
+ expected << "</select>\n"
2106
+ expected << " : "
2107
+ expected << %(<select id="post_written_on_6i" name="post[written_on(6i)]">\n)
2108
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 35}>#{sprintf("%02d", i)}</option>\n) }
2109
+ expected << "</select>\n"
2110
+
2111
+ assert_dom_equal expected, time_select("post", "written_on", :include_seconds => true)
2112
+ end
2113
+
2114
+ def test_time_select_with_html_options
2115
+ @post = Post.new
2116
+ @post.written_on = Time.local(2004, 6, 15, 15, 16, 35)
2117
+
2118
+ expected = %{<input type="hidden" id="post_written_on_1i" name="post[written_on(1i)]" value="2004" />\n}
2119
+ expected << %{<input type="hidden" id="post_written_on_2i" name="post[written_on(2i)]" value="6" />\n}
2120
+ expected << %{<input type="hidden" id="post_written_on_3i" name="post[written_on(3i)]" value="15" />\n}
2121
+
2122
+ expected << %(<select id="post_written_on_4i" name="post[written_on(4i)]" class="selector">\n)
2123
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2124
+ expected << "</select>\n"
2125
+ expected << " : "
2126
+ expected << %(<select id="post_written_on_5i" name="post[written_on(5i)]" class="selector">\n)
2127
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2128
+ expected << "</select>\n"
2129
+
2130
+ assert_dom_equal expected, time_select("post", "written_on", {}, :class => 'selector')
2131
+ end
2132
+
2133
+ def test_time_select_with_html_options_within_fields_for
2134
+ @post = Post.new
2135
+ @post.written_on = Time.local(2004, 6, 15, 15, 16, 35)
2136
+
2137
+ output_buffer = fields_for :post, @post do |f|
2138
+ concat f.time_select(:written_on, {}, :class => 'selector')
2139
+ end
2140
+
2141
+ expected = %{<input type="hidden" id="post_written_on_1i" name="post[written_on(1i)]" value="2004" />\n}
2142
+ expected << %{<input type="hidden" id="post_written_on_2i" name="post[written_on(2i)]" value="6" />\n}
2143
+ expected << %{<input type="hidden" id="post_written_on_3i" name="post[written_on(3i)]" value="15" />\n}
2144
+
2145
+ expected << %(<select id="post_written_on_4i" name="post[written_on(4i)]" class="selector">\n)
2146
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2147
+ expected << "</select>\n"
2148
+ expected << " : "
2149
+ expected << %(<select id="post_written_on_5i" name="post[written_on(5i)]" class="selector">\n)
2150
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2151
+ expected << "</select>\n"
2152
+
2153
+ assert_dom_equal expected, output_buffer
2154
+ end
2155
+
2156
+ def test_time_select_with_separator
2157
+ @post = Post.new
2158
+ @post.written_on = Time.local(2004, 6, 15, 15, 16, 35)
2159
+
2160
+ expected = %{<input type="hidden" id="post_written_on_1i" name="post[written_on(1i)]" value="2004" />\n}
2161
+ expected << %{<input type="hidden" id="post_written_on_2i" name="post[written_on(2i)]" value="6" />\n}
2162
+ expected << %{<input type="hidden" id="post_written_on_3i" name="post[written_on(3i)]" value="15" />\n}
2163
+
2164
+ expected << %(<select id="post_written_on_4i" name="post[written_on(4i)]">\n)
2165
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2166
+ expected << "</select>\n"
2167
+
2168
+ expected << " - "
2169
+
2170
+ expected << %(<select id="post_written_on_5i" name="post[written_on(5i)]">\n)
2171
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2172
+ expected << "</select>\n"
2173
+
2174
+ expected << " - "
2175
+
2176
+ expected << %(<select id="post_written_on_6i" name="post[written_on(6i)]">\n)
2177
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 35}>#{sprintf("%02d", i)}</option>\n) }
2178
+ expected << "</select>\n"
2179
+
2180
+ assert_dom_equal expected, time_select("post", "written_on", { :time_separator => " - ", :include_seconds => true })
2181
+ end
2182
+
2183
+ def test_time_select_with_default_prompt
2184
+ @post = Post.new
2185
+ @post.written_on = Time.local(2004, 6, 15, 15, 16, 35)
2186
+
2187
+ expected = %{<input type="hidden" id="post_written_on_1i" name="post[written_on(1i)]" value="2004" />\n}
2188
+ expected << %{<input type="hidden" id="post_written_on_2i" name="post[written_on(2i)]" value="6" />\n}
2189
+ expected << %{<input type="hidden" id="post_written_on_3i" name="post[written_on(3i)]" value="15" />\n}
2190
+
2191
+ expected << %(<select id="post_written_on_4i" name="post[written_on(4i)]">\n)
2192
+ expected << %(<option value="">Hour</option>\n)
2193
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2194
+ expected << "</select>\n"
2195
+ expected << " : "
2196
+ expected << %(<select id="post_written_on_5i" name="post[written_on(5i)]">\n)
2197
+ expected << %(<option value="">Minute</option>\n)
2198
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2199
+ expected << "</select>\n"
2200
+
2201
+ assert_dom_equal expected, time_select("post", "written_on", :prompt => true)
2202
+ end
2203
+
2204
+ def test_time_select_with_custom_prompt
2205
+ @post = Post.new
2206
+ @post.written_on = Time.local(2004, 6, 15, 15, 16, 35)
2207
+
2208
+ expected = %{<input type="hidden" id="post_written_on_1i" name="post[written_on(1i)]" value="2004" />\n}
2209
+ expected << %{<input type="hidden" id="post_written_on_2i" name="post[written_on(2i)]" value="6" />\n}
2210
+ expected << %{<input type="hidden" id="post_written_on_3i" name="post[written_on(3i)]" value="15" />\n}
2211
+
2212
+ expected << %(<select id="post_written_on_4i" name="post[written_on(4i)]">\n)
2213
+ expected << %(<option value="">Choose hour</option>\n)
2214
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2215
+ expected << "</select>\n"
2216
+ expected << " : "
2217
+ expected << %(<select id="post_written_on_5i" name="post[written_on(5i)]">\n)
2218
+ expected << %(<option value="">Choose minute</option>\n)
2219
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2220
+ expected << "</select>\n"
2221
+
2222
+ assert_dom_equal expected, time_select("post", "written_on", :prompt => {:hour => 'Choose hour', :minute => 'Choose minute'})
2223
+ end
2224
+
2225
+ def test_time_select_with_disabled_html_option
2226
+ @post = Post.new
2227
+ @post.written_on = Time.local(2004, 6, 15, 15, 16, 35)
2228
+
2229
+ expected = %{<input type="hidden" id="post_written_on_1i" disabled="disabled" name="post[written_on(1i)]" value="2004" />\n}
2230
+ expected << %{<input type="hidden" id="post_written_on_2i" disabled="disabled" name="post[written_on(2i)]" value="6" />\n}
2231
+ expected << %{<input type="hidden" id="post_written_on_3i" disabled="disabled" name="post[written_on(3i)]" value="15" />\n}
2232
+
2233
+ expected << %(<select id="post_written_on_4i" disabled="disabled" name="post[written_on(4i)]">\n)
2234
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2235
+ expected << "</select>\n"
2236
+ expected << " : "
2237
+ expected << %(<select id="post_written_on_5i" disabled="disabled" name="post[written_on(5i)]">\n)
2238
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2239
+ expected << "</select>\n"
2240
+
2241
+ assert_dom_equal expected, time_select("post", "written_on", {}, :disabled => true)
2242
+ end
2243
+
2244
+ def test_datetime_select
2245
+ @post = Post.new
2246
+ @post.updated_at = Time.local(2004, 6, 15, 16, 35)
2247
+
2248
+ expected = %{<select id="post_updated_at_1i" name="post[updated_at(1i)]">\n}
2249
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
2250
+ expected << "</select>\n"
2251
+
2252
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2253
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
2254
+ expected << "</select>\n"
2255
+
2256
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2257
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
2258
+ expected << "</select>\n"
2259
+
2260
+ expected << " &mdash; "
2261
+
2262
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n}
2263
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n}
2264
+ expected << "</select>\n"
2265
+ expected << " : "
2266
+ expected << %{<select id="post_updated_at_5i" name="post[updated_at(5i)]">\n}
2267
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35" selected="selected">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n}
2268
+ expected << "</select>\n"
2269
+
2270
+ assert_dom_equal expected, datetime_select("post", "updated_at")
2271
+ end
2272
+
2273
+ def test_datetime_select_with_selected
2274
+ @post = Post.new
2275
+ @post.updated_at = Time.local(2004, 6, 15, 16, 35)
2276
+
2277
+ expected = %{<select id="post_updated_at_1i" name="post[updated_at(1i)]">\n}
2278
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
2279
+ expected << "</select>\n"
2280
+
2281
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2282
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3" selected="selected">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
2283
+ expected << "</select>\n"
2284
+
2285
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2286
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10" selected="selected">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
2287
+ expected << "</select>\n"
2288
+
2289
+ expected << " &mdash; "
2290
+
2291
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n}
2292
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12" selected="selected">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n}
2293
+ expected << "</select>\n"
2294
+ expected << " : "
2295
+ expected << %{<select id="post_updated_at_5i" name="post[updated_at(5i)]">\n}
2296
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30" selected="selected">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n}
2297
+ expected << "</select>\n"
2298
+
2299
+ assert_dom_equal expected, datetime_select("post", "updated_at", :selected => Time.local(2004, 3, 10, 12, 30))
2300
+ end
2301
+
2302
+ def test_datetime_select_with_selected_nil
2303
+ @post = Post.new
2304
+ @post.updated_at = Time.local(2004, 6, 15, 16, 35)
2305
+
2306
+ expected = '<input id="post_updated_at_1i" name="post[updated_at(1i)]" type="hidden" value="1"/>' + "\n"
2307
+
2308
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2309
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
2310
+ expected << "</select>\n"
2311
+
2312
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2313
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
2314
+ expected << "</select>\n"
2315
+
2316
+ expected << " &mdash; "
2317
+
2318
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n}
2319
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n}
2320
+ expected << "</select>\n"
2321
+ expected << " : "
2322
+ expected << %{<select id="post_updated_at_5i" name="post[updated_at(5i)]">\n}
2323
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n}
2324
+ expected << "</select>\n"
2325
+
2326
+ assert_dom_equal expected, datetime_select("post", "updated_at", discard_year: true, selected: nil)
2327
+ end
2328
+
2329
+ def test_datetime_select_defaults_to_time_zone_now_when_config_time_zone_is_set
2330
+ # The love zone is UTC+0
2331
+ mytz = Class.new(ActiveSupport::TimeZone) {
2332
+ attr_accessor :now
2333
+ }.create('tenderlove', 0)
2334
+
2335
+ now = Time.mktime(2004, 6, 15, 16, 35, 0)
2336
+ mytz.now = now
2337
+ Time.zone = mytz
2338
+
2339
+ assert_equal mytz, Time.zone
2340
+
2341
+ @post = Post.new
2342
+
2343
+ expected = %{<select id="post_updated_at_1i" name="post[updated_at(1i)]">\n}
2344
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
2345
+ expected << "</select>\n"
2346
+
2347
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2348
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
2349
+ expected << "</select>\n"
2350
+
2351
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2352
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
2353
+ expected << "</select>\n"
2354
+
2355
+ expected << " &mdash; "
2356
+
2357
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n}
2358
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n}
2359
+ expected << "</select>\n"
2360
+ expected << " : "
2361
+ expected << %{<select id="post_updated_at_5i" name="post[updated_at(5i)]">\n}
2362
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35" selected="selected">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n}
2363
+ expected << "</select>\n"
2364
+
2365
+ assert_dom_equal expected, datetime_select("post", "updated_at")
2366
+ ensure
2367
+ Time.zone = nil
2368
+ end
2369
+
2370
+ def test_datetime_select_with_html_options_within_fields_for
2371
+ @post = Post.new
2372
+ @post.updated_at = Time.local(2004, 6, 15, 16, 35)
2373
+
2374
+ output_buffer = fields_for :post, @post do |f|
2375
+ concat f.datetime_select(:updated_at, {}, :class => 'selector')
2376
+ end
2377
+
2378
+ expected = %{<select id="post_updated_at_1i" name="post[updated_at(1i)]" class="selector">\n<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option selected="selected" value="2004">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n</select>\n}
2379
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]" class="selector">\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option selected="selected" value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n</select>\n}
2380
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]" class="selector">\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option selected="selected" value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n</select>\n}
2381
+ expected << %{ &mdash; <select id="post_updated_at_4i" name="post[updated_at(4i)]" class="selector">\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option selected="selected" value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n</select>\n}
2382
+ expected << %{ : <select id="post_updated_at_5i" name="post[updated_at(5i)]" class="selector">\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option selected="selected" value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n</select>\n}
2383
+
2384
+ assert_dom_equal expected, output_buffer
2385
+ end
2386
+
2387
+ def test_datetime_select_with_separators
2388
+ @post = Post.new
2389
+ @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35)
2390
+
2391
+ expected = %{<select id="post_updated_at_1i" name="post[updated_at(1i)]">\n}
2392
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
2393
+ expected << "</select>\n"
2394
+
2395
+ expected << " / "
2396
+
2397
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2398
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
2399
+ expected << "</select>\n"
2400
+
2401
+ expected << " / "
2402
+
2403
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2404
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
2405
+ expected << "</select>\n"
2406
+
2407
+ expected << " , "
2408
+
2409
+ expected << %(<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n)
2410
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2411
+ expected << "</select>\n"
2412
+
2413
+ expected << " - "
2414
+
2415
+ expected << %(<select id="post_updated_at_5i" name="post[updated_at(5i)]">\n)
2416
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2417
+ expected << "</select>\n"
2418
+
2419
+ expected << " - "
2420
+
2421
+ expected << %(<select id="post_updated_at_6i" name="post[updated_at(6i)]">\n)
2422
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 35}>#{sprintf("%02d", i)}</option>\n) }
2423
+ expected << "</select>\n"
2424
+
2425
+ assert_dom_equal expected, datetime_select("post", "updated_at", { :date_separator => " / ", :datetime_separator => " , ", :time_separator => " - ", :include_seconds => true })
2426
+ end
2427
+
2428
+ def test_datetime_select_with_integer
2429
+ @post = Post.new
2430
+ @post.updated_at = 3
2431
+ datetime_select("post", "updated_at")
2432
+ end
2433
+
2434
+ def test_datetime_select_with_infinity # Float
2435
+ @post = Post.new
2436
+ @post.updated_at = (-1.0/0)
2437
+ datetime_select("post", "updated_at")
2438
+ end
2439
+
2440
+ def test_datetime_select_with_default_prompt
2441
+ @post = Post.new
2442
+ @post.updated_at = nil
2443
+
2444
+ expected = %{<select id="post_updated_at_1i" name="post[updated_at(1i)]">\n}
2445
+ expected << %{<option value="">Year</option>\n<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
2446
+ expected << "</select>\n"
2447
+
2448
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2449
+ expected << %{<option value="">Month</option>\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
2450
+ expected << "</select>\n"
2451
+
2452
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2453
+ expected << %{<option value="">Day</option>\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
2454
+ expected << "</select>\n"
2455
+
2456
+ expected << " &mdash; "
2457
+
2458
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n}
2459
+ expected << %{<option value="">Hour</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n}
2460
+ expected << "</select>\n"
2461
+ expected << " : "
2462
+ expected << %{<select id="post_updated_at_5i" name="post[updated_at(5i)]">\n}
2463
+ expected << %{<option value="">Minute</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n}
2464
+ expected << "</select>\n"
2465
+
2466
+ assert_dom_equal expected, datetime_select("post", "updated_at", :start_year=>1999, :end_year=>2009, :prompt => true)
2467
+ end
2468
+
2469
+ def test_datetime_select_with_custom_prompt
2470
+ @post = Post.new
2471
+ @post.updated_at = nil
2472
+
2473
+ expected = %{<select id="post_updated_at_1i" name="post[updated_at(1i)]">\n}
2474
+ expected << %{<option value="">Choose year</option>\n<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
2475
+ expected << "</select>\n"
2476
+
2477
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2478
+ expected << %{<option value="">Choose month</option>\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
2479
+ expected << "</select>\n"
2480
+
2481
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2482
+ expected << %{<option value="">Choose day</option>\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
2483
+ expected << "</select>\n"
2484
+
2485
+ expected << " &mdash; "
2486
+
2487
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n}
2488
+ expected << %{<option value="">Choose hour</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n}
2489
+ expected << "</select>\n"
2490
+ expected << " : "
2491
+ expected << %{<select id="post_updated_at_5i" name="post[updated_at(5i)]">\n}
2492
+ expected << %{<option value="">Choose minute</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n}
2493
+ expected << "</select>\n"
2494
+
2495
+ assert_dom_equal expected, datetime_select("post", "updated_at", :start_year=>1999, :end_year=>2009, :prompt => {:year => 'Choose year', :month => 'Choose month', :day => 'Choose day', :hour => 'Choose hour', :minute => 'Choose minute'})
2496
+ end
2497
+
2498
+ def test_date_select_with_zero_value_and_no_start_year
2499
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
2500
+ (Date.today.year-5).upto(Date.today.year+1) { |y| expected << %(<option value="#{y}">#{y}</option>\n) }
2501
+ expected << "</select>\n"
2502
+
2503
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
2504
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
2505
+ expected << "</select>\n"
2506
+
2507
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
2508
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
2509
+ expected << "</select>\n"
2510
+
2511
+ assert_dom_equal expected, select_date(0, :end_year => Date.today.year+1, :prefix => "date[first]")
2512
+ end
2513
+
2514
+ def test_date_select_with_zero_value_and_no_end_year
2515
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
2516
+ last_year = Time.now.year + 5
2517
+ 2003.upto(last_year) { |y| expected << %(<option value="#{y}">#{y}</option>\n) }
2518
+ expected << "</select>\n"
2519
+
2520
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
2521
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
2522
+ expected << "</select>\n"
2523
+
2524
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
2525
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
2526
+ expected << "</select>\n"
2527
+
2528
+ assert_dom_equal expected, select_date(0, :start_year => 2003, :prefix => "date[first]")
2529
+ end
2530
+
2531
+ def test_date_select_with_zero_value_and_no_start_and_end_year
2532
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
2533
+ (Date.today.year-5).upto(Date.today.year+5) { |y| expected << %(<option value="#{y}">#{y}</option>\n) }
2534
+ expected << "</select>\n"
2535
+
2536
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
2537
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
2538
+ expected << "</select>\n"
2539
+
2540
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
2541
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
2542
+ expected << "</select>\n"
2543
+
2544
+ assert_dom_equal expected, select_date(0, :prefix => "date[first]")
2545
+ end
2546
+
2547
+ def test_date_select_with_nil_value_and_no_start_and_end_year
2548
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
2549
+ (Date.today.year-5).upto(Date.today.year+5) { |y| expected << %(<option value="#{y}">#{y}</option>\n) }
2550
+ expected << "</select>\n"
2551
+
2552
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
2553
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
2554
+ expected << "</select>\n"
2555
+
2556
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
2557
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
2558
+ expected << "</select>\n"
2559
+
2560
+ assert_dom_equal expected, select_date(nil, :prefix => "date[first]")
2561
+ end
2562
+
2563
+ def test_datetime_select_with_nil_value_and_no_start_and_end_year
2564
+ expected = %(<select id="date_first_year" name="date[first][year]">\n)
2565
+ (Date.today.year-5).upto(Date.today.year+5) { |y| expected << %(<option value="#{y}">#{y}</option>\n) }
2566
+ expected << "</select>\n"
2567
+
2568
+ expected << %(<select id="date_first_month" name="date[first][month]">\n)
2569
+ expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
2570
+ expected << "</select>\n"
2571
+
2572
+ expected << %(<select id="date_first_day" name="date[first][day]">\n)
2573
+ expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
2574
+ expected << "</select>\n"
2575
+
2576
+ expected << " &mdash; "
2577
+
2578
+ expected << %(<select id="date_first_hour" name="date[first][hour]">\n)
2579
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n)
2580
+ expected << "</select>\n"
2581
+
2582
+ expected << " : "
2583
+
2584
+ expected << %(<select id="date_first_minute" name="date[first][minute]">\n)
2585
+ expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n)
2586
+ expected << "</select>\n"
2587
+
2588
+ assert_dom_equal expected, select_datetime(nil, :prefix => "date[first]")
2589
+ end
2590
+
2591
+ def test_datetime_select_with_options_index
2592
+ @post = Post.new
2593
+ @post.updated_at = Time.local(2004, 6, 15, 16, 35)
2594
+ id = 456
2595
+
2596
+ expected = %{<select id="post_456_updated_at_1i" name="post[#{id}][updated_at(1i)]">\n}
2597
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
2598
+ expected << "</select>\n"
2599
+
2600
+ expected << %{<select id="post_456_updated_at_2i" name="post[#{id}][updated_at(2i)]">\n}
2601
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
2602
+ expected << "</select>\n"
2603
+
2604
+ expected << %{<select id="post_456_updated_at_3i" name="post[#{id}][updated_at(3i)]">\n}
2605
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
2606
+ expected << "</select>\n"
2607
+
2608
+ expected << " &mdash; "
2609
+
2610
+ expected << %{<select id="post_456_updated_at_4i" name="post[#{id}][updated_at(4i)]">\n}
2611
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n}
2612
+ expected << "</select>\n"
2613
+ expected << " : "
2614
+ expected << %{<select id="post_456_updated_at_5i" name="post[#{id}][updated_at(5i)]">\n}
2615
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35" selected="selected">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n}
2616
+ expected << "</select>\n"
2617
+
2618
+ assert_dom_equal expected, datetime_select("post", "updated_at", :index => id)
2619
+ end
2620
+
2621
+ def test_datetime_select_within_fields_for_with_options_index
2622
+ @post = Post.new
2623
+ @post.updated_at = Time.local(2004, 6, 15, 16, 35)
2624
+ id = 456
2625
+
2626
+ output_buffer = fields_for :post, @post, :index => id do |f|
2627
+ concat f.datetime_select(:updated_at)
2628
+ end
2629
+
2630
+ expected = %{<select id="post_456_updated_at_1i" name="post[#{id}][updated_at(1i)]">\n}
2631
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
2632
+ expected << "</select>\n"
2633
+
2634
+ expected << %{<select id="post_456_updated_at_2i" name="post[#{id}][updated_at(2i)]">\n}
2635
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
2636
+ expected << "</select>\n"
2637
+
2638
+ expected << %{<select id="post_456_updated_at_3i" name="post[#{id}][updated_at(3i)]">\n}
2639
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
2640
+ expected << "</select>\n"
2641
+
2642
+ expected << " &mdash; "
2643
+
2644
+ expected << %{<select id="post_456_updated_at_4i" name="post[#{id}][updated_at(4i)]">\n}
2645
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n}
2646
+ expected << "</select>\n"
2647
+ expected << " : "
2648
+ expected << %{<select id="post_456_updated_at_5i" name="post[#{id}][updated_at(5i)]">\n}
2649
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35" selected="selected">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n}
2650
+ expected << "</select>\n"
2651
+
2652
+ assert_dom_equal expected, output_buffer
2653
+ end
2654
+
2655
+ def test_datetime_select_with_auto_index
2656
+ @post = Post.new
2657
+ @post.updated_at = Time.local(2004, 6, 15, 16, 35)
2658
+ id = @post.id
2659
+
2660
+ expected = %{<select id="post_123_updated_at_1i" name="post[#{id}][updated_at(1i)]">\n}
2661
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
2662
+ expected << "</select>\n"
2663
+
2664
+ expected << %{<select id="post_123_updated_at_2i" name="post[#{id}][updated_at(2i)]">\n}
2665
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
2666
+ expected << "</select>\n"
2667
+
2668
+ expected << %{<select id="post_123_updated_at_3i" name="post[#{id}][updated_at(3i)]">\n}
2669
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
2670
+ expected << "</select>\n"
2671
+
2672
+ expected << " &mdash; "
2673
+
2674
+ expected << %{<select id="post_123_updated_at_4i" name="post[#{id}][updated_at(4i)]">\n}
2675
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n}
2676
+ expected << "</select>\n"
2677
+ expected << " : "
2678
+ expected << %{<select id="post_123_updated_at_5i" name="post[#{id}][updated_at(5i)]">\n}
2679
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35" selected="selected">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n}
2680
+ expected << "</select>\n"
2681
+
2682
+ assert_dom_equal expected, datetime_select("post[]", "updated_at")
2683
+ end
2684
+
2685
+ def test_datetime_select_with_seconds
2686
+ @post = Post.new
2687
+ @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35)
2688
+
2689
+ expected = %{<select id="post_updated_at_1i" name="post[updated_at(1i)]">\n}
2690
+ 1999.upto(2009) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 2004}>#{i}</option>\n) }
2691
+ expected << "</select>\n"
2692
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2693
+ 1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Date::MONTHNAMES[i]}</option>\n) }
2694
+ expected << "</select>\n"
2695
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2696
+ 1.upto(31) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 15}>#{i}</option>\n) }
2697
+ expected << "</select>\n"
2698
+
2699
+ expected << " &mdash; "
2700
+
2701
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n}
2702
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2703
+ expected << "</select>\n"
2704
+ expected << " : "
2705
+ expected << %{<select id="post_updated_at_5i" name="post[updated_at(5i)]">\n}
2706
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2707
+ expected << "</select>\n"
2708
+ expected << " : "
2709
+ expected << %{<select id="post_updated_at_6i" name="post[updated_at(6i)]">\n}
2710
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 35}>#{sprintf("%02d", i)}</option>\n) }
2711
+ expected << "</select>\n"
2712
+
2713
+ assert_dom_equal expected, datetime_select("post", "updated_at", :include_seconds => true)
2714
+ end
2715
+
2716
+ def test_datetime_select_discard_year
2717
+ @post = Post.new
2718
+ @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35)
2719
+
2720
+ expected = %{<input type="hidden" id="post_updated_at_1i" name="post[updated_at(1i)]" value="2004" />\n}
2721
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2722
+ 1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Date::MONTHNAMES[i]}</option>\n) }
2723
+ expected << "</select>\n"
2724
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2725
+ 1.upto(31) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 15}>#{i}</option>\n) }
2726
+ expected << "</select>\n"
2727
+
2728
+ expected << " &mdash; "
2729
+
2730
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n}
2731
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2732
+ expected << "</select>\n"
2733
+ expected << " : "
2734
+ expected << %{<select id="post_updated_at_5i" name="post[updated_at(5i)]">\n}
2735
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2736
+ expected << "</select>\n"
2737
+
2738
+ assert_dom_equal expected, datetime_select("post", "updated_at", :discard_year => true)
2739
+ end
2740
+
2741
+ def test_datetime_select_discard_month
2742
+ @post = Post.new
2743
+ @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35)
2744
+
2745
+ expected = %{<select id="post_updated_at_1i" name="post[updated_at(1i)]">\n}
2746
+ 1999.upto(2009) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 2004}>#{i}</option>\n) }
2747
+ expected << "</select>\n"
2748
+ expected << %{<input type="hidden" id="post_updated_at_2i" name="post[updated_at(2i)]" value="6" />\n}
2749
+ expected << %{<input type="hidden" id="post_updated_at_3i" name="post[updated_at(3i)]" value="1" />\n}
2750
+
2751
+ expected << " &mdash; "
2752
+
2753
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n}
2754
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2755
+ expected << "</select>\n"
2756
+ expected << " : "
2757
+ expected << %{<select id="post_updated_at_5i" name="post[updated_at(5i)]">\n}
2758
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2759
+ expected << "</select>\n"
2760
+
2761
+ assert_dom_equal expected, datetime_select("post", "updated_at", :discard_month => true)
2762
+ end
2763
+
2764
+ def test_datetime_select_discard_year_and_month
2765
+ @post = Post.new
2766
+ @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35)
2767
+
2768
+ expected = %{<input type="hidden" id="post_updated_at_1i" name="post[updated_at(1i)]" value="2004" />\n}
2769
+ expected << %{<input type="hidden" id="post_updated_at_2i" name="post[updated_at(2i)]" value="6" />\n}
2770
+ expected << %{<input type="hidden" id="post_updated_at_3i" name="post[updated_at(3i)]" value="1" />\n}
2771
+
2772
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n}
2773
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2774
+ expected << "</select>\n"
2775
+ expected << " : "
2776
+ expected << %{<select id="post_updated_at_5i" name="post[updated_at(5i)]">\n}
2777
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2778
+ expected << "</select>\n"
2779
+
2780
+ assert_dom_equal expected, datetime_select("post", "updated_at", :discard_year => true, :discard_month => true)
2781
+ end
2782
+
2783
+ def test_datetime_select_discard_year_and_month_with_disabled_html_option
2784
+ @post = Post.new
2785
+ @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35)
2786
+
2787
+ expected = %{<input type="hidden" id="post_updated_at_1i" disabled="disabled" name="post[updated_at(1i)]" value="2004" />\n}
2788
+ expected << %{<input type="hidden" id="post_updated_at_2i" disabled="disabled" name="post[updated_at(2i)]" value="6" />\n}
2789
+ expected << %{<input type="hidden" id="post_updated_at_3i" disabled="disabled" name="post[updated_at(3i)]" value="1" />\n}
2790
+
2791
+ expected << %{<select id="post_updated_at_4i" disabled="disabled" name="post[updated_at(4i)]">\n}
2792
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2793
+ expected << "</select>\n"
2794
+ expected << " : "
2795
+ expected << %{<select id="post_updated_at_5i" disabled="disabled" name="post[updated_at(5i)]">\n}
2796
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2797
+ expected << "</select>\n"
2798
+
2799
+ assert_dom_equal expected, datetime_select("post", "updated_at", { :discard_year => true, :discard_month => true }, :disabled => true)
2800
+ end
2801
+
2802
+ def test_datetime_select_discard_hour
2803
+ @post = Post.new
2804
+ @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35)
2805
+
2806
+ expected = %{<select id="post_updated_at_1i" name="post[updated_at(1i)]">\n}
2807
+ 1999.upto(2009) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 2004}>#{i}</option>\n) }
2808
+ expected << "</select>\n"
2809
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2810
+ 1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Date::MONTHNAMES[i]}</option>\n) }
2811
+ expected << "</select>\n"
2812
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2813
+ 1.upto(31) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 15}>#{i}</option>\n) }
2814
+ expected << "</select>\n"
2815
+
2816
+ assert_dom_equal expected, datetime_select("post", "updated_at", :discard_hour => true)
2817
+ end
2818
+
2819
+ def test_datetime_select_discard_minute
2820
+ @post = Post.new
2821
+ @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35)
2822
+
2823
+ expected = %{<select id="post_updated_at_1i" name="post[updated_at(1i)]">\n}
2824
+ 1999.upto(2009) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 2004}>#{i}</option>\n) }
2825
+ expected << "</select>\n"
2826
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2827
+ 1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Date::MONTHNAMES[i]}</option>\n) }
2828
+ expected << "</select>\n"
2829
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2830
+ 1.upto(31) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 15}>#{i}</option>\n) }
2831
+ expected << "</select>\n"
2832
+
2833
+ expected << " &mdash; "
2834
+
2835
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n}
2836
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2837
+ expected << "</select>\n"
2838
+ expected << %{<input type="hidden" id="post_updated_at_5i" name="post[updated_at(5i)]" value="16" />\n}
2839
+
2840
+ assert_dom_equal expected, datetime_select("post", "updated_at", :discard_minute => true)
2841
+ end
2842
+
2843
+ def test_datetime_select_disabled_and_discard_minute
2844
+ @post = Post.new
2845
+ @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35)
2846
+
2847
+ expected = %{<select id="post_updated_at_1i" disabled="disabled" name="post[updated_at(1i)]">\n}
2848
+ 1999.upto(2009) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 2004}>#{i}</option>\n) }
2849
+ expected << "</select>\n"
2850
+ expected << %{<select id="post_updated_at_2i" disabled="disabled" name="post[updated_at(2i)]">\n}
2851
+ 1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Date::MONTHNAMES[i]}</option>\n) }
2852
+ expected << "</select>\n"
2853
+ expected << %{<select id="post_updated_at_3i" disabled="disabled" name="post[updated_at(3i)]">\n}
2854
+ 1.upto(31) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 15}>#{i}</option>\n) }
2855
+ expected << "</select>\n"
2856
+
2857
+ expected << " &mdash; "
2858
+
2859
+ expected << %{<select id="post_updated_at_4i" disabled="disabled" name="post[updated_at(4i)]">\n}
2860
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2861
+ expected << "</select>\n"
2862
+ expected << %{<input type="hidden" id="post_updated_at_5i" disabled="disabled" name="post[updated_at(5i)]" value="16" />\n}
2863
+
2864
+ assert_dom_equal expected, datetime_select("post", "updated_at", :discard_minute => true, :disabled => true)
2865
+ end
2866
+
2867
+ def test_datetime_select_invalid_order
2868
+ @post = Post.new
2869
+ @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35)
2870
+
2871
+ expected = %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2872
+ 1.upto(31) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 15}>#{i}</option>\n) }
2873
+ expected << "</select>\n"
2874
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2875
+ 1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Date::MONTHNAMES[i]}</option>\n) }
2876
+ expected << "</select>\n"
2877
+ expected << %{<select id="post_updated_at_1i" name="post[updated_at(1i)]">\n}
2878
+ 1999.upto(2009) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 2004}>#{i}</option>\n) }
2879
+ expected << "</select>\n"
2880
+
2881
+ expected << " &mdash; "
2882
+
2883
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n}
2884
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2885
+ expected << "</select>\n"
2886
+ expected << " : "
2887
+ expected << %{<select id="post_updated_at_5i" name="post[updated_at(5i)]">\n}
2888
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2889
+ expected << "</select>\n"
2890
+
2891
+ assert_dom_equal expected, datetime_select("post", "updated_at", :order => [:minute, :day, :hour, :month, :year, :second])
2892
+ end
2893
+
2894
+ def test_datetime_select_discard_with_order
2895
+ @post = Post.new
2896
+ @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35)
2897
+
2898
+ expected = %{<input type="hidden" id="post_updated_at_1i" name="post[updated_at(1i)]" value="2004" />\n}
2899
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2900
+ 1.upto(31) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 15}>#{i}</option>\n) }
2901
+ expected << "</select>\n"
2902
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2903
+ 1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Date::MONTHNAMES[i]}</option>\n) }
2904
+ expected << "</select>\n"
2905
+
2906
+ expected << " &mdash; "
2907
+
2908
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n}
2909
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2910
+ expected << "</select>\n"
2911
+ expected << " : "
2912
+ expected << %{<select id="post_updated_at_5i" name="post[updated_at(5i)]">\n}
2913
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2914
+ expected << "</select>\n"
2915
+
2916
+ assert_dom_equal expected, datetime_select("post", "updated_at", :order => [:day, :month])
2917
+ end
2918
+
2919
+ def test_datetime_select_with_default_value_as_time
2920
+ @post = Post.new
2921
+ @post.updated_at = nil
2922
+
2923
+ expected = %{<select id="post_updated_at_1i" name="post[updated_at(1i)]">\n}
2924
+ 2001.upto(2011) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 2006}>#{i}</option>\n) }
2925
+ expected << "</select>\n"
2926
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2927
+ 1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 9}>#{Date::MONTHNAMES[i]}</option>\n) }
2928
+ expected << "</select>\n"
2929
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2930
+ 1.upto(31) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 19}>#{i}</option>\n) }
2931
+ expected << "</select>\n"
2932
+
2933
+ expected << " &mdash; "
2934
+
2935
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n}
2936
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 15}>#{sprintf("%02d", i)}</option>\n) }
2937
+ expected << "</select>\n"
2938
+ expected << " : "
2939
+ expected << %{<select id="post_updated_at_5i" name="post[updated_at(5i)]">\n}
2940
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) }
2941
+ expected << "</select>\n"
2942
+
2943
+ assert_dom_equal expected, datetime_select("post", "updated_at", :default => Time.local(2006, 9, 19, 15, 16, 35))
2944
+ end
2945
+
2946
+ def test_include_blank_overrides_default_option
2947
+ @post = Post.new
2948
+ @post.updated_at = nil
2949
+
2950
+ expected = %{<select id="post_updated_at_1i" name="post[updated_at(1i)]">\n}
2951
+ expected << %(<option value=""></option>\n)
2952
+ (Time.now.year - 5).upto(Time.now.year + 5) { |i| expected << %(<option value="#{i}">#{i}</option>\n) }
2953
+ expected << "</select>\n"
2954
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2955
+ expected << %(<option value=""></option>\n)
2956
+ 1.upto(12) { |i| expected << %(<option value="#{i}">#{Date::MONTHNAMES[i]}</option>\n) }
2957
+ expected << "</select>\n"
2958
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2959
+ expected << %(<option value=""></option>\n)
2960
+ 1.upto(31) { |i| expected << %(<option value="#{i}">#{i}</option>\n) }
2961
+ expected << "</select>\n"
2962
+
2963
+ assert_dom_equal expected, date_select("post", "updated_at", :default => Time.local(2006, 9, 19, 15, 16, 35), :include_blank => true)
2964
+ end
2965
+
2966
+ def test_datetime_select_with_default_value_as_hash
2967
+ @post = Post.new
2968
+ @post.updated_at = nil
2969
+
2970
+ expected = %{<select id="post_updated_at_1i" name="post[updated_at(1i)]">\n}
2971
+ (Time.now.year - 5).upto(Time.now.year + 5) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == Time.now.year}>#{i}</option>\n) }
2972
+ expected << "</select>\n"
2973
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
2974
+ 1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 10}>#{Date::MONTHNAMES[i]}</option>\n) }
2975
+ expected << "</select>\n"
2976
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
2977
+ 1.upto(31) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == Time.now.day}>#{i}</option>\n) }
2978
+ expected << "</select>\n"
2979
+
2980
+ expected << " &mdash; "
2981
+
2982
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]">\n}
2983
+ 0.upto(23) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 9}>#{sprintf("%02d", i)}</option>\n) }
2984
+ expected << "</select>\n"
2985
+ expected << " : "
2986
+ expected << %{<select id="post_updated_at_5i" name="post[updated_at(5i)]">\n}
2987
+ 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 42}>#{sprintf("%02d", i)}</option>\n) }
2988
+ expected << "</select>\n"
2989
+
2990
+ assert_dom_equal expected, datetime_select("post", "updated_at", :default => { :month => 10, :minute => 42, :hour => 9 })
2991
+ end
2992
+
2993
+ def test_datetime_select_with_html_options
2994
+ @post = Post.new
2995
+ @post.updated_at = Time.local(2004, 6, 15, 16, 35)
2996
+
2997
+ expected = %{<select id="post_updated_at_1i" name="post[updated_at(1i)]" class="selector">\n}
2998
+ expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
2999
+ expected << "</select>\n"
3000
+
3001
+ expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]" class="selector">\n}
3002
+ expected << %{<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6" selected="selected">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n}
3003
+ expected << "</select>\n"
3004
+
3005
+ expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]" class="selector">\n}
3006
+ expected << %{<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15" selected="selected">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n}
3007
+ expected << "</select>\n"
3008
+
3009
+ expected << " &mdash; "
3010
+
3011
+ expected << %{<select id="post_updated_at_4i" name="post[updated_at(4i)]" class="selector">\n}
3012
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n}
3013
+ expected << "</select>\n"
3014
+ expected << " : "
3015
+ expected << %{<select id="post_updated_at_5i" name="post[updated_at(5i)]" class="selector">\n}
3016
+ expected << %{<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35" selected="selected">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n}
3017
+ expected << "</select>\n"
3018
+
3019
+ assert_dom_equal expected, datetime_select("post", "updated_at", {}, :class => 'selector')
3020
+ end
3021
+
3022
+ def test_date_select_should_not_change_passed_options_hash
3023
+ @post = Post.new
3024
+ @post.updated_at = Time.local(2008, 7, 16, 23, 30)
3025
+
3026
+ options = {
3027
+ :order => [ :year, :month, :day ],
3028
+ :default => { :year => 2008, :month => 7, :day => 16, :hour => 23, :minute => 30, :second => 1 },
3029
+ :discard_type => false,
3030
+ :include_blank => false,
3031
+ :ignore_date => false,
3032
+ :include_seconds => true
3033
+ }
3034
+ date_select(@post, :updated_at, options)
3035
+
3036
+ # note: the literal hash is intentional to show that the actual options hash isn't modified
3037
+ # don't change this!
3038
+ assert_equal({
3039
+ :order => [ :year, :month, :day ],
3040
+ :default => { :year => 2008, :month => 7, :day => 16, :hour => 23, :minute => 30, :second => 1 },
3041
+ :discard_type => false,
3042
+ :include_blank => false,
3043
+ :ignore_date => false,
3044
+ :include_seconds => true
3045
+ }, options)
3046
+ end
3047
+
3048
+ def test_datetime_select_should_not_change_passed_options_hash
3049
+ @post = Post.new
3050
+ @post.updated_at = Time.local(2008, 7, 16, 23, 30)
3051
+
3052
+ options = {
3053
+ :order => [ :year, :month, :day ],
3054
+ :default => { :year => 2008, :month => 7, :day => 16, :hour => 23, :minute => 30, :second => 1 },
3055
+ :discard_type => false,
3056
+ :include_blank => false,
3057
+ :ignore_date => false,
3058
+ :include_seconds => true
3059
+ }
3060
+ datetime_select(@post, :updated_at, options)
3061
+
3062
+ # note: the literal hash is intentional to show that the actual options hash isn't modified
3063
+ # don't change this!
3064
+ assert_equal({
3065
+ :order => [ :year, :month, :day ],
3066
+ :default => { :year => 2008, :month => 7, :day => 16, :hour => 23, :minute => 30, :second => 1 },
3067
+ :discard_type => false,
3068
+ :include_blank => false,
3069
+ :ignore_date => false,
3070
+ :include_seconds => true
3071
+ }, options)
3072
+ end
3073
+
3074
+ def test_time_select_should_not_change_passed_options_hash
3075
+ @post = Post.new
3076
+ @post.updated_at = Time.local(2008, 7, 16, 23, 30)
3077
+
3078
+ options = {
3079
+ :order => [ :year, :month, :day ],
3080
+ :default => { :year => 2008, :month => 7, :day => 16, :hour => 23, :minute => 30, :second => 1 },
3081
+ :discard_type => false,
3082
+ :include_blank => false,
3083
+ :ignore_date => false,
3084
+ :include_seconds => true
3085
+ }
3086
+ time_select(@post, :updated_at, options)
3087
+
3088
+ # note: the literal hash is intentional to show that the actual options hash isn't modified
3089
+ # don't change this!
3090
+ assert_equal({
3091
+ :order => [ :year, :month, :day ],
3092
+ :default => { :year => 2008, :month => 7, :day => 16, :hour => 23, :minute => 30, :second => 1 },
3093
+ :discard_type => false,
3094
+ :include_blank => false,
3095
+ :ignore_date => false,
3096
+ :include_seconds => true
3097
+ }, options)
3098
+ end
3099
+
3100
+ def test_select_date_should_not_change_passed_options_hash
3101
+ options = {
3102
+ :order => [ :year, :month, :day ],
3103
+ :default => { :year => 2008, :month => 7, :day => 16, :hour => 23, :minute => 30, :second => 1 },
3104
+ :discard_type => false,
3105
+ :include_blank => false,
3106
+ :ignore_date => false,
3107
+ :include_seconds => true
3108
+ }
3109
+ select_date(Date.today, options)
3110
+
3111
+ # note: the literal hash is intentional to show that the actual options hash isn't modified
3112
+ # don't change this!
3113
+ assert_equal({
3114
+ :order => [ :year, :month, :day ],
3115
+ :default => { :year => 2008, :month => 7, :day => 16, :hour => 23, :minute => 30, :second => 1 },
3116
+ :discard_type => false,
3117
+ :include_blank => false,
3118
+ :ignore_date => false,
3119
+ :include_seconds => true
3120
+ }, options)
3121
+ end
3122
+
3123
+ def test_select_datetime_should_not_change_passed_options_hash
3124
+ options = {
3125
+ :order => [ :year, :month, :day ],
3126
+ :default => { :year => 2008, :month => 7, :day => 16, :hour => 23, :minute => 30, :second => 1 },
3127
+ :discard_type => false,
3128
+ :include_blank => false,
3129
+ :ignore_date => false,
3130
+ :include_seconds => true
3131
+ }
3132
+ select_datetime(Time.now, options)
3133
+
3134
+ # note: the literal hash is intentional to show that the actual options hash isn't modified
3135
+ # don't change this!
3136
+ assert_equal({
3137
+ :order => [ :year, :month, :day ],
3138
+ :default => { :year => 2008, :month => 7, :day => 16, :hour => 23, :minute => 30, :second => 1 },
3139
+ :discard_type => false,
3140
+ :include_blank => false,
3141
+ :ignore_date => false,
3142
+ :include_seconds => true
3143
+ }, options)
3144
+ end
3145
+
3146
+ def test_select_time_should_not_change_passed_options_hash
3147
+ options = {
3148
+ :order => [ :year, :month, :day ],
3149
+ :default => { :year => 2008, :month => 7, :day => 16, :hour => 23, :minute => 30, :second => 1 },
3150
+ :discard_type => false,
3151
+ :include_blank => false,
3152
+ :ignore_date => false,
3153
+ :include_seconds => true
3154
+ }
3155
+ select_time(Time.now, options)
3156
+
3157
+ # note: the literal hash is intentional to show that the actual options hash isn't modified
3158
+ # don't change this!
3159
+ assert_equal({
3160
+ :order => [ :year, :month, :day ],
3161
+ :default => { :year => 2008, :month => 7, :day => 16, :hour => 23, :minute => 30, :second => 1 },
3162
+ :discard_type => false,
3163
+ :include_blank => false,
3164
+ :ignore_date => false,
3165
+ :include_seconds => true
3166
+ }, options)
3167
+ end
3168
+
3169
+ def test_select_html_safety
3170
+ assert select_day(16).html_safe?
3171
+ assert select_month(8).html_safe?
3172
+ assert select_year(Time.mktime(2003, 8, 16, 8, 4, 18)).html_safe?
3173
+ assert select_minute(Time.mktime(2003, 8, 16, 8, 4, 18)).html_safe?
3174
+ assert select_second(Time.mktime(2003, 8, 16, 8, 4, 18)).html_safe?
3175
+
3176
+ assert select_minute(8, :use_hidden => true).html_safe?
3177
+ assert select_month(8, :prompt => 'Choose month').html_safe?
3178
+
3179
+ assert select_time(Time.mktime(2003, 8, 16, 8, 4, 18), {}, :class => 'selector').html_safe?
3180
+ assert select_date(Time.mktime(2003, 8, 16), :date_separator => " / ", :start_year => 2003, :end_year => 2005, :prefix => "date[first]").html_safe?
3181
+ end
3182
+
3183
+ def test_object_select_html_safety
3184
+ @post = Post.new
3185
+ @post.written_on = Date.new(2004, 6, 15)
3186
+
3187
+ assert date_select("post", "written_on", :default => Time.local(2006, 9, 19, 15, 16, 35), :include_blank => true).html_safe?
3188
+ assert time_select("post", "written_on", :ignore_date => true).html_safe?
3189
+ end
3190
+
3191
+ def test_time_tag_with_date
3192
+ date = Date.new(2013, 2, 20)
3193
+ expected = '<time datetime="2013-02-20">February 20, 2013</time>'
3194
+ assert_equal expected, time_tag(date)
3195
+ end
3196
+
3197
+ def test_time_tag_with_time
3198
+ time = Time.new(2013, 2, 20, 0, 0, 0, '+00:00')
3199
+ expected = '<time datetime="2013-02-20T00:00:00+00:00">February 20, 2013 00:00</time>'
3200
+ assert_equal expected, time_tag(time)
3201
+ end
3202
+
3203
+ def test_time_tag_pubdate_option
3204
+ assert_match(/<time.*pubdate="pubdate">.*<\/time>/, time_tag(Time.now, :pubdate => true))
3205
+ end
3206
+
3207
+ def test_time_tag_with_given_text
3208
+ assert_match(/<time.*>Right now<\/time>/, time_tag(Time.now, 'Right now'))
3209
+ end
3210
+
3211
+ def test_time_tag_with_given_block
3212
+ assert_match(/<time.*><span>Right now<\/span><\/time>/, time_tag(Time.now){ '<span>Right now</span>'.html_safe })
3213
+ end
3214
+
3215
+ def test_time_tag_with_different_format
3216
+ time = Time.new(2013, 2, 20, 0, 0, 0, '+00:00')
3217
+ expected = '<time datetime="2013-02-20T00:00:00+00:00">20 Feb 00:00</time>'
3218
+ assert_equal expected, time_tag(time, :format => :short)
3219
+ end
3220
+
3221
+ protected
3222
+ def with_env_tz(new_tz = 'US/Eastern')
3223
+ old_tz, ENV['TZ'] = ENV['TZ'], new_tz
3224
+ yield
3225
+ ensure
3226
+ old_tz ? ENV['TZ'] = old_tz : ENV.delete('TZ')
3227
+ end
3228
+ end