middleman-core 3.0.0.beta.2 → 3.0.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. data/features/cli_extension.feature +13 -0
  2. data/features/{cli.feature → cli_init.feature} +1 -10
  3. data/features/directory_index.feature +29 -1
  4. data/features/dynamic_pages.feature +1 -0
  5. data/features/extensionless_text_files.feature +0 -2
  6. data/features/front-matter.feature +17 -1
  7. data/features/frontmatter_page_settings.feature +16 -1
  8. data/features/helpers_relative_link_to.feature +68 -0
  9. data/features/unicode_filenames.feature +14 -0
  10. data/fixtures/csspie/config.rb +0 -0
  11. data/fixtures/csspie/source/stylesheets/PIE.htc +96 -0
  12. data/fixtures/dynamic-pages-app/config.rb +3 -0
  13. data/fixtures/frontmatter-app/source/front-matter-auto.erb +6 -0
  14. data/fixtures/frontmatter-app/source/front-matter.html.erb +2 -0
  15. data/fixtures/frontmatter-app/source/json-front-matter-2.php.erb +7 -0
  16. data/fixtures/frontmatter-app/source/json-front-matter-auto.erb +6 -0
  17. data/fixtures/frontmatter-app/source/json-front-matter.html.erb +6 -0
  18. data/fixtures/unicode-filenames-app/config.rb +1 -0
  19. data/fixtures/unicode-filenames-app/source/snowmen-rule-/342/230/203.html +4 -0
  20. data/lib/middleman-core/application.rb +43 -335
  21. data/lib/middleman-core/cli/build.rb +11 -4
  22. data/lib/middleman-core/cli/bundler.rb +40 -0
  23. data/lib/middleman-core/cli/extension.rb +36 -0
  24. data/lib/middleman-core/cli/server.rb +2 -2
  25. data/lib/middleman-core/cli.rb +2 -6
  26. data/lib/middleman-core/core_extensions/assets.rb +35 -31
  27. data/lib/middleman-core/core_extensions/builder.rb +14 -9
  28. data/lib/middleman-core/core_extensions/data.rb +150 -145
  29. data/lib/middleman-core/core_extensions/default_helpers.rb +159 -97
  30. data/lib/middleman-core/core_extensions/extensions.rb +103 -97
  31. data/lib/middleman-core/core_extensions/external_helpers.rb +27 -23
  32. data/lib/middleman-core/core_extensions/file_watcher.rb +140 -110
  33. data/lib/middleman-core/core_extensions/front_matter.rb +155 -175
  34. data/lib/middleman-core/core_extensions/i18n.rb +111 -102
  35. data/lib/middleman-core/core_extensions/rendering.rb +293 -295
  36. data/lib/middleman-core/core_extensions/request.rb +338 -0
  37. data/lib/middleman-core/core_extensions/routing.rb +72 -68
  38. data/lib/middleman-core/core_extensions/show_exceptions.rb +23 -18
  39. data/lib/middleman-core/core_extensions.rb +39 -0
  40. data/lib/middleman-core/extensions/directory_indexes.rb +1 -4
  41. data/lib/middleman-core/extensions/lorem.rb +10 -3
  42. data/lib/middleman-core/extensions.rb +2 -64
  43. data/lib/middleman-core/preview_server.rb +157 -0
  44. data/lib/middleman-core/sitemap/extensions/ignores.rb +73 -68
  45. data/lib/middleman-core/sitemap/extensions/on_disk.rb +65 -58
  46. data/lib/middleman-core/sitemap/extensions/proxies.rb +86 -75
  47. data/lib/middleman-core/sitemap/extensions/traversal.rb +68 -61
  48. data/lib/middleman-core/sitemap/resource.rb +123 -102
  49. data/lib/middleman-core/sitemap/store.rb +170 -149
  50. data/lib/middleman-core/sitemap.rb +57 -57
  51. data/lib/middleman-core/step_definitions/server_steps.rb +13 -3
  52. data/lib/middleman-core/templates/extension/Gemfile +4 -0
  53. data/lib/middleman-core/templates/extension/Rakefile +12 -0
  54. data/lib/middleman-core/templates/extension/features/support/env.rb +4 -0
  55. data/lib/middleman-core/templates/extension/gemspec +24 -0
  56. data/lib/middleman-core/templates/extension/lib/lib.rb +49 -0
  57. data/lib/middleman-core/templates/extension/lib/middleman_extension.rb +1 -0
  58. data/lib/middleman-core/templates/shared/gitignore +14 -0
  59. data/lib/middleman-core/templates.rb +14 -8
  60. data/lib/middleman-core/util.rb +31 -9
  61. data/lib/middleman-core/version.rb +1 -1
  62. data/lib/middleman-core.rb +6 -4
  63. data/middleman-core.gemspec +4 -6
  64. metadata +62 -203
  65. data/lib/middleman-core/vendor/padrino-core-0.10.6/.document +0 -5
  66. data/lib/middleman-core/vendor/padrino-core-0.10.6/.gitignore +0 -22
  67. data/lib/middleman-core/vendor/padrino-core-0.10.6/.yardopts +0 -1
  68. data/lib/middleman-core/vendor/padrino-core-0.10.6/LICENSE.txt +0 -20
  69. data/lib/middleman-core/vendor/padrino-core-0.10.6/README.rdoc +0 -294
  70. data/lib/middleman-core/vendor/padrino-core-0.10.6/Rakefile +0 -5
  71. data/lib/middleman-core/vendor/padrino-core-0.10.6/bin/padrino +0 -9
  72. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/rendering.rb +0 -292
  73. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/routing.rb +0 -943
  74. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/showexceptions.rb +0 -20
  75. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application.rb +0 -269
  76. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/caller.rb +0 -53
  77. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/adapter.rb +0 -24
  78. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/base.rb +0 -150
  79. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/console.rb +0 -20
  80. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/rake.rb +0 -24
  81. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/rake_tasks.rb +0 -59
  82. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/command.rb +0 -38
  83. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/images/404.png +0 -0
  84. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/images/500.png +0 -0
  85. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/loader.rb +0 -211
  86. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/cs.yml +0 -34
  87. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/da.yml +0 -34
  88. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/de.yml +0 -34
  89. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/en.yml +0 -34
  90. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/es.yml +0 -34
  91. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/fr.yml +0 -34
  92. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/hu.yml +0 -34
  93. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/it.yml +0 -40
  94. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/ja.yml +0 -34
  95. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/lv.yml +0 -34
  96. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/nl.yml +0 -34
  97. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/no.yml +0 -35
  98. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/pl.yml +0 -34
  99. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/pt_br.yml +0 -40
  100. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/ru.yml +0 -35
  101. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/tr.yml +0 -34
  102. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/uk.yml +0 -34
  103. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/zh_cn.yml +0 -34
  104. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/zh_tw.yml +0 -34
  105. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/logger.rb +0 -428
  106. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/mounter.rb +0 -224
  107. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/reloader.rb +0 -254
  108. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/router.rb +0 -98
  109. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/server.rb +0 -79
  110. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/support_lite.rb +0 -199
  111. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/tasks.rb +0 -21
  112. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/version.rb +0 -20
  113. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core.rb +0 -152
  114. data/lib/middleman-core/vendor/padrino-core-0.10.6/padrino-core.gemspec +0 -38
  115. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/.components +0 -6
  116. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/.gitignore +0 -7
  117. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/complex.rb +0 -32
  118. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/simple.rb +0 -33
  119. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/a.rb +0 -9
  120. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/b.rb +0 -4
  121. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/c.rb +0 -1
  122. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/e.rb +0 -13
  123. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/f.rb +0 -2
  124. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/g.rb +0 -2
  125. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/d.rb +0 -4
  126. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/helper.rb +0 -83
  127. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/mini_shoulda.rb +0 -45
  128. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_application.rb +0 -108
  129. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_core.rb +0 -77
  130. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_dependencies.rb +0 -44
  131. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_filters.rb +0 -278
  132. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_locale.rb +0 -21
  133. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_logger.rb +0 -154
  134. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_mounter.rb +0 -177
  135. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_reloader_complex.rb +0 -75
  136. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_reloader_simple.rb +0 -98
  137. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_rendering.rb +0 -461
  138. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_restful_routing.rb +0 -33
  139. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_router.rb +0 -146
  140. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_routing.rb +0 -1680
  141. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.document +0 -5
  142. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.gitignore +0 -21
  143. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.yardopts +0 -1
  144. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/LICENSE.txt +0 -20
  145. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/README.rdoc +0 -239
  146. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/Rakefile +0 -5
  147. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/asset_tag_helpers.rb +0 -417
  148. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_builder/abstract_form_builder.rb +0 -251
  149. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_builder/standard_form_builder.rb +0 -43
  150. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_helpers.rb +0 -787
  151. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/format_helpers.rb +0 -381
  152. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/cs.yml +0 -103
  153. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/da.yml +0 -91
  154. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/de.yml +0 -81
  155. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/en.yml +0 -103
  156. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/es.yml +0 -103
  157. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/fr.yml +0 -80
  158. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/hu.yml +0 -103
  159. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/it.yml +0 -89
  160. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/ja.yml +0 -103
  161. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/lv.yml +0 -103
  162. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/nl.yml +0 -82
  163. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/no.yml +0 -91
  164. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/pl.yml +0 -95
  165. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/pt_br.yml +0 -103
  166. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/ru.yml +0 -103
  167. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/tr.yml +0 -103
  168. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/uk.yml +0 -103
  169. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/zh_cn.yml +0 -104
  170. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/zh_tw.yml +0 -103
  171. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/number_helpers.rb +0 -288
  172. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/abstract_handler.rb +0 -98
  173. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/erb_handler.rb +0 -79
  174. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/haml_handler.rb +0 -63
  175. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/slim_handler.rb +0 -81
  176. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers.rb +0 -175
  177. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/render_helpers.rb +0 -60
  178. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/tag_helpers.rb +0 -260
  179. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/translation_helpers.rb +0 -38
  180. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers.rb +0 -59
  181. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/padrino-helpers.gemspec +0 -27
  182. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/app.rb +0 -73
  183. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.erb +0 -14
  184. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.haml +0 -12
  185. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.slim +0 -13
  186. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.erb +0 -14
  187. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.haml +0 -12
  188. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.slim +0 -12
  189. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.erb +0 -11
  190. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.haml +0 -9
  191. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.slim +0 -9
  192. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.erb +0 -5
  193. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.haml +0 -5
  194. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.slim +0 -5
  195. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.erb +0 -20
  196. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.haml +0 -15
  197. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.slim +0 -15
  198. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.erb +0 -72
  199. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.haml +0 -59
  200. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.slim +0 -59
  201. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.erb +0 -86
  202. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.haml +0 -70
  203. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.slim +0 -70
  204. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.erb +0 -5
  205. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.haml +0 -4
  206. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.slim +0 -4
  207. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.erb +0 -3
  208. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.haml +0 -3
  209. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.slim +0 -3
  210. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.erb +0 -3
  211. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.haml +0 -3
  212. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.slim +0 -3
  213. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_erb.erb +0 -1
  214. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_haml.haml +0 -1
  215. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_slim.slim +0 -1
  216. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.erb +0 -1
  217. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.haml +0 -1
  218. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.slim +0 -1
  219. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/app.rb +0 -50
  220. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engine.haml +0 -5
  221. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_erb.erb +0 -1
  222. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_haml.haml +0 -1
  223. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_slim.slim +0 -1
  224. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/erb/test.erb +0 -1
  225. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/explicit_engine.haml +0 -5
  226. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/haml/test.haml +0 -1
  227. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/_user.haml +0 -7
  228. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/haml_template.haml +0 -1
  229. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/some_template.haml +0 -2
  230. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/helper.rb +0 -66
  231. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_asset_tag_helpers.rb +0 -328
  232. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_builder.rb +0 -1106
  233. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_helpers.rb +0 -770
  234. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_format_helpers.rb +0 -227
  235. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_locale.rb +0 -20
  236. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_number_helpers.rb +0 -139
  237. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_output_helpers.rb +0 -153
  238. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_render_helpers.rb +0 -76
  239. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_tag_helpers.rb +0 -106
  240. data/lib/middleman-core/watcher.rb +0 -196
@@ -1,770 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/helper')
2
- require File.expand_path(File.dirname(__FILE__) + '/fixtures/markup_app/app')
3
-
4
- describe "FormHelpers" do
5
- include Padrino::Helpers::FormHelpers
6
-
7
- def app
8
- MarkupDemo.tap { |app| app.set :environment, :test }
9
- end
10
-
11
- context 'for #form_tag method' do
12
- should "display correct forms in ruby" do
13
- actual_html = form_tag('/register', :"accept-charset" => "UTF-8", :class => 'test', :method => "post") { "Demo" }
14
- assert_has_tag(:form, :"accept-charset" => "UTF-8", :class => "test") { actual_html }
15
- assert_has_tag('form input', :type => 'hidden', :name => '_method', :count => 0) { actual_html }
16
- end
17
-
18
- should "display correct text inputs within form_tag" do
19
- actual_html = form_tag('/register', :"accept-charset" => "UTF-8", :class => 'test') { text_field_tag(:username) }
20
- assert_has_tag('form input', :type => 'text', :name => "username") { actual_html }
21
- end
22
-
23
- should "display correct form with remote" do
24
- actual_html = form_tag('/update', :"accept-charset" => "UTF-8", :class => 'put-form', :remote => true) { "Demo" }
25
- assert_has_tag(:form, :class => "put-form", :"accept-charset" => "UTF-8", :"data-remote" => 'true') { actual_html }
26
- assert_has_no_tag(:form, "data-method" => 'post') { actual_html }
27
- end
28
-
29
- should "display correct form with remote and method is put" do
30
- actual_html = form_tag('/update', :"accept-charset" => "UTF-8", :method => 'put', :remote => true) { "Demo" }
31
- assert_has_tag(:form, "data-remote" => 'true', :"accept-charset" => "UTF-8") { actual_html }
32
- assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'put') { actual_html }
33
- end
34
-
35
- should "display correct form with method :put" do
36
- actual_html = form_tag('/update', :"accept-charset" => "UTF-8", :class => 'put-form', :method => "put") { "Demo" }
37
- assert_has_tag(:form, :class => "put-form", :"accept-charset" => "UTF-8", :method => 'post') { actual_html }
38
- assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'put') { actual_html }
39
- end
40
-
41
- should "display correct form with method :delete and charset" do
42
- actual_html = form_tag('/remove', :"accept-charset" => "UTF-8", :class => 'delete-form', :method => "delete") { "Demo" }
43
- assert_has_tag(:form, :class => "delete-form", :"accept-charset" => "UTF-8", :method => 'post') { actual_html }
44
- assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'delete') { actual_html }
45
- end
46
-
47
- should "display correct form with charset" do
48
- actual_html = form_tag('/charset', :"accept-charset" => "UTF-8", :class => 'charset-form') { "Demo" }
49
- assert_has_tag(:form, :class => "charset-form", :"accept-charset" => "UTF-8", :method => 'post') { actual_html }
50
- end
51
-
52
- should "display correct form with multipart encoding" do
53
- actual_html = form_tag('/remove', :"accept-charset" => "UTF-8", :multipart => true) { "Demo" }
54
- assert_has_tag(:form, :enctype => "multipart/form-data") { actual_html }
55
- end
56
-
57
- should "display correct forms in erb" do
58
- visit '/erb/form_tag'
59
- assert_have_selector 'form.simple-form', :action => '/simple'
60
- assert_have_selector 'form.advanced-form', :action => '/advanced', :id => 'advanced', :method => 'get'
61
- end
62
-
63
- should "display correct forms in haml" do
64
- visit '/haml/form_tag'
65
- assert_have_selector 'form.simple-form', :action => '/simple'
66
- assert_have_selector 'form.advanced-form', :action => '/advanced', :id => 'advanced', :method => 'get'
67
- end
68
-
69
- should "display correct forms in slim" do
70
- visit '/slim/form_tag'
71
- assert_have_selector 'form.simple-form', :action => '/simple'
72
- assert_have_selector 'form.advanced-form', :action => '/advanced', :id => 'advanced', :method => 'get'
73
- end
74
- end
75
-
76
- context 'for #field_set_tag method' do
77
- should "display correct field_sets in ruby" do
78
- actual_html = field_set_tag("Basic", :class => 'basic') { "Demo" }
79
- assert_has_tag(:fieldset, :class => 'basic') { actual_html }
80
- assert_has_tag('fieldset legend', :content => "Basic") { actual_html }
81
- end
82
-
83
- should "display correct field_sets in erb" do
84
- visit '/erb/form_tag'
85
- assert_have_selector 'form.simple-form fieldset', :count => 1
86
- assert_have_no_selector 'form.simple-form fieldset legend'
87
- assert_have_selector 'form.advanced-form fieldset', :count => 1, :class => 'advanced-field-set'
88
- assert_have_selector 'form.advanced-form fieldset legend', :content => "Advanced"
89
- end
90
-
91
- should "display correct field_sets in haml" do
92
- visit '/haml/form_tag'
93
- assert_have_selector 'form.simple-form fieldset', :count => 1
94
- assert_have_no_selector 'form.simple-form fieldset legend'
95
- assert_have_selector 'form.advanced-form fieldset', :count => 1, :class => 'advanced-field-set'
96
- assert_have_selector 'form.advanced-form fieldset legend', :content => "Advanced"
97
- end
98
-
99
- should "display correct field_sets in slim" do
100
- visit '/slim/form_tag'
101
- assert_have_selector 'form.simple-form fieldset', :count => 1
102
- assert_have_no_selector 'form.simple-form fieldset legend'
103
- assert_have_selector 'form.advanced-form fieldset', :count => 1, :class => 'advanced-field-set'
104
- assert_have_selector 'form.advanced-form fieldset legend', :content => "Advanced"
105
- end
106
- end
107
-
108
- context 'for #error_messages_for method' do
109
- should "display correct error messages list in ruby" do
110
- user = mock_model("User", :errors => { :a => "1", :b => "2" }, :blank? => false)
111
- actual_html = error_messages_for(user)
112
- assert_has_tag('div.field-errors') { actual_html }
113
- assert_has_tag('div.field-errors h2', :content => "2 errors prohibited this User from being saved") { actual_html }
114
- assert_has_tag('div.field-errors p', :content => "There were problems with the following fields:") { actual_html }
115
- assert_has_tag('div.field-errors ul') { actual_html }
116
- assert_has_tag('div.field-errors ul li', :count => 2) { actual_html }
117
- end
118
-
119
- should "display correct error messages list in erb" do
120
- visit '/erb/form_tag'
121
- assert_have_no_selector 'form.simple-form .field-errors'
122
- assert_have_selector 'form.advanced-form .field-errors'
123
- assert_have_selector 'form.advanced-form .field-errors h2', :content => "There are problems with saving user!"
124
- assert_have_selector 'form.advanced-form .field-errors p', :content => "There were problems with the following fields:"
125
- assert_have_selector 'form.advanced-form .field-errors ul'
126
- assert_have_selector 'form.advanced-form .field-errors ul li', :count => 4
127
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Email must be a email"
128
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Fake must be valid"
129
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Second must be present"
130
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Third must be a number"
131
- end
132
-
133
- should "display correct error messages list in haml" do
134
- visit '/haml/form_tag'
135
- assert_have_no_selector 'form.simple-form .field-errors'
136
- assert_have_selector 'form.advanced-form .field-errors'
137
- assert_have_selector 'form.advanced-form .field-errors h2', :content => "There are problems with saving user!"
138
- assert_have_selector 'form.advanced-form .field-errors p', :content => "There were problems with the following fields:"
139
- assert_have_selector 'form.advanced-form .field-errors ul'
140
- assert_have_selector 'form.advanced-form .field-errors ul li', :count => 4
141
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Email must be a email"
142
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Fake must be valid"
143
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Second must be present"
144
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Third must be a number"
145
- end
146
-
147
- should "display correct error messages list in slim" do
148
- visit '/slim/form_tag'
149
- assert_have_no_selector 'form.simple-form .field-errors'
150
- assert_have_selector 'form.advanced-form .field-errors'
151
- assert_have_selector 'form.advanced-form .field-errors h2', :content => "There are problems with saving user!"
152
- assert_have_selector 'form.advanced-form .field-errors p', :content => "There were problems with the following fields:"
153
- assert_have_selector 'form.advanced-form .field-errors ul'
154
- assert_have_selector 'form.advanced-form .field-errors ul li', :count => 4
155
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Email must be a email"
156
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Fake must be valid"
157
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Second must be present"
158
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Third must be a number"
159
- end
160
- end
161
-
162
- context 'for #error_message_on method' do
163
- should "display correct error message on specified model name in ruby" do
164
- @user = mock_model("User", :errors => { :a => "1", :b => "2" }, :blank? => false)
165
- actual_html = error_message_on(:user, :a, :prepend => "foo", :append => "bar")
166
- assert_has_tag('span.error', :content => "foo 1 bar") { actual_html }
167
- end
168
-
169
- should "display correct error message on specified object in ruby" do
170
- @bob = mock_model("User", :errors => { :a => "1", :b => "2" }, :blank? => false)
171
- actual_html = error_message_on(@bob, :a, :prepend => "foo", :append => "bar")
172
- assert_has_tag('span.error', :content => "foo 1 bar") { actual_html }
173
- end
174
-
175
- should "display no message when error isn't present" do
176
- @user = mock_model("User", :errors => { :a => "1", :b => "2" }, :blank? => false)
177
- actual_html = error_message_on(:user, :fake, :prepend => "foo", :append => "bar")
178
- assert actual_html.blank?
179
- end
180
- end
181
-
182
- context 'for #label_tag method' do
183
- should "display label tag in ruby" do
184
- actual_html = label_tag(:username, :class => 'long-label', :caption => "Nickname")
185
- assert_has_tag(:label, :for => 'username', :class => 'long-label', :content => "Nickname") { actual_html }
186
- end
187
-
188
- should "display label tag in ruby with required" do
189
- actual_html = label_tag(:username, :caption => "Nickname", :required => true)
190
- assert_has_tag(:label, :for => 'username', :content => 'Nickname') { actual_html }
191
- assert_has_tag('label[for=username] span.required', :content => "*") { actual_html }
192
- end
193
-
194
- should "display label tag in erb for simple form" do
195
- visit '/erb/form_tag'
196
- assert_have_selector 'form.simple-form label', :count => 9
197
- assert_have_selector 'form.simple-form label', :content => "Username", :for => 'username'
198
- assert_have_selector 'form.simple-form label', :content => "Password", :for => 'password'
199
- assert_have_selector 'form.simple-form label', :content => "Gender", :for => 'gender'
200
- end
201
- should "display label tag in erb for advanced form" do
202
- visit '/erb/form_tag'
203
- assert_have_selector 'form.advanced-form label', :count => 11
204
- assert_have_selector 'form.advanced-form label.first', :content => "Nickname", :for => 'username'
205
- assert_have_selector 'form.advanced-form label.first', :content => "Password", :for => 'password'
206
- assert_have_selector 'form.advanced-form label.about', :content => "About Me", :for => 'about'
207
- assert_have_selector 'form.advanced-form label.photo', :content => "Photo" , :for => 'photo'
208
- assert_have_selector 'form.advanced-form label.gender', :content => "Gender" , :for => 'gender'
209
- end
210
-
211
- should "display label tag in haml for simple form" do
212
- visit '/haml/form_tag'
213
- assert_have_selector 'form.simple-form label', :count => 9
214
- assert_have_selector 'form.simple-form label', :content => "Username", :for => 'username'
215
- assert_have_selector 'form.simple-form label', :content => "Password", :for => 'password'
216
- assert_have_selector 'form.simple-form label', :content => "Gender", :for => 'gender'
217
- end
218
-
219
- should "display label tag in haml for advanced form" do
220
- visit '/haml/form_tag'
221
- assert_have_selector 'form.advanced-form label', :count => 11
222
- assert_have_selector 'form.advanced-form label.first', :content => "Nickname", :for => 'username'
223
- assert_have_selector 'form.advanced-form label.first', :content => "Password", :for => 'password'
224
- assert_have_selector 'form.advanced-form label.about', :content => "About Me", :for => 'about'
225
- assert_have_selector 'form.advanced-form label.photo', :content => "Photo" , :for => 'photo'
226
- assert_have_selector 'form.advanced-form label.gender', :content => "Gender" , :for => 'gender'
227
- end
228
-
229
- should "display label tag in slim for simple form" do
230
- visit '/slim/form_tag'
231
- assert_have_selector 'form.simple-form label', :count => 9
232
- assert_have_selector 'form.simple-form label', :content => "Username", :for => 'username'
233
- assert_have_selector 'form.simple-form label', :content => "Password", :for => 'password'
234
- assert_have_selector 'form.simple-form label', :content => "Gender", :for => 'gender'
235
- end
236
-
237
- should "display label tag in slim for advanced form" do
238
- visit '/slim/form_tag'
239
- assert_have_selector 'form.advanced-form label', :count => 11
240
- assert_have_selector 'form.advanced-form label.first', :content => "Nickname", :for => 'username'
241
- assert_have_selector 'form.advanced-form label.first', :content => "Password", :for => 'password'
242
- assert_have_selector 'form.advanced-form label.about', :content => "About Me", :for => 'about'
243
- assert_have_selector 'form.advanced-form label.photo', :content => "Photo" , :for => 'photo'
244
- assert_have_selector 'form.advanced-form label.gender', :content => "Gender" , :for => 'gender'
245
- end
246
- end
247
-
248
- context 'for #hidden_field_tag method' do
249
- should "display hidden field in ruby" do
250
- actual_html = hidden_field_tag(:session_key, :id => 'session_id', :value => '56768')
251
- assert_has_tag(:input, :type => 'hidden', :id => "session_id", :name => 'session_key', :value => '56768') { actual_html }
252
- end
253
-
254
- should "display hidden field in erb" do
255
- visit '/erb/form_tag'
256
- assert_have_selector 'form.simple-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
257
- assert_have_selector 'form.advanced-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
258
- end
259
-
260
- should "display hidden field in haml" do
261
- visit '/haml/form_tag'
262
- assert_have_selector 'form.simple-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
263
- assert_have_selector 'form.advanced-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
264
- end
265
-
266
- should "display hidden field in slim" do
267
- visit '/slim/form_tag'
268
- assert_have_selector 'form.simple-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
269
- assert_have_selector 'form.advanced-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
270
- end
271
- end
272
-
273
- context 'for #text_field_tag method' do
274
- should "display text field in ruby" do
275
- actual_html = text_field_tag(:username, :class => 'long')
276
- assert_has_tag(:input, :type => 'text', :class => "long", :name => 'username') { actual_html }
277
- end
278
-
279
- should "display text field in erb" do
280
- visit '/erb/form_tag'
281
- assert_have_selector 'form.simple-form input[type=text]', :count => 1, :name => 'username'
282
- assert_have_selector 'form.advanced-form fieldset input[type=text]', :count => 1, :name => 'username', :id => 'the_username'
283
- end
284
-
285
- should "display text field in haml" do
286
- visit '/haml/form_tag'
287
- assert_have_selector 'form.simple-form input[type=text]', :count => 1, :name => 'username'
288
- assert_have_selector 'form.advanced-form fieldset input[type=text]', :count => 1, :name => 'username', :id => 'the_username'
289
- end
290
-
291
- should "display text field in slim" do
292
- visit '/slim/form_tag'
293
- assert_have_selector 'form.simple-form input[type=text]', :count => 1, :name => 'username'
294
- assert_have_selector 'form.advanced-form fieldset input[type=text]', :count => 1, :name => 'username', :id => 'the_username'
295
- end
296
- end
297
-
298
- context 'for #number_field_tag method' do
299
- should "display number field in ruby" do
300
- actual_html = number_field_tag(:age, :class => 'numeric')
301
- assert_has_tag(:input, :type => 'number', :class => 'numeric', :name => 'age') { actual_html }
302
- end
303
-
304
- should "display number field in erb" do
305
- visit '/erb/form_tag'
306
- assert_have_selector 'form.simple-form input[type=number]', :count => 1, :name => 'age'
307
- assert_have_selector 'form.advanced-form fieldset input[type=number]', :count => 1, :name => 'age', :class => 'numeric'
308
- end
309
-
310
- should "display number field in haml" do
311
- visit '/haml/form_tag'
312
- assert_have_selector 'form.simple-form input[type=number]', :count => 1, :name => 'age'
313
- assert_have_selector 'form.advanced-form fieldset input[type=number]', :count => 1, :name => 'age', :class => 'numeric'
314
- end
315
-
316
- should "display number field in slim" do
317
- visit '/slim/form_tag'
318
- assert_have_selector 'form.simple-form input[type=number]', :count => 1, :name => 'age'
319
- assert_have_selector 'form.advanced-form fieldset input[type=number]', :count => 1, :name => 'age', :class => 'numeric'
320
- end
321
- end
322
-
323
- context 'for #telephone_field_tag method' do
324
- should "display number field in ruby" do
325
- actual_html = telephone_field_tag(:telephone, :class => 'numeric')
326
- assert_has_tag(:input, :type => 'tel', :class => 'numeric', :name => 'telephone') { actual_html }
327
- end
328
-
329
- should "display telephone field in erb" do
330
- visit '/erb/form_tag'
331
- assert_have_selector 'form.simple-form input[type=tel]', :count => 1, :name => 'telephone'
332
- assert_have_selector 'form.advanced-form fieldset input[type=tel]', :count => 1, :name => 'telephone', :class => 'numeric'
333
- end
334
-
335
- should "display telephone field in haml" do
336
- visit '/haml/form_tag'
337
- assert_have_selector 'form.simple-form input[type=tel]', :count => 1, :name => 'telephone'
338
- assert_have_selector 'form.advanced-form fieldset input[type=tel]', :count => 1, :name => 'telephone', :class => 'numeric'
339
- end
340
-
341
- should "display telephone field in slim" do
342
- visit '/slim/form_tag'
343
- assert_have_selector 'form.simple-form input[type=tel]', :count => 1, :name => 'telephone'
344
- assert_have_selector 'form.advanced-form fieldset input[type=tel]', :count => 1, :name => 'telephone', :class => 'numeric'
345
- end
346
- end
347
-
348
- context 'for #search_field_tag method' do
349
- should "display search field in ruby" do
350
- actual_html = search_field_tag(:search, :class => 'string')
351
- assert_has_tag(:input, :type => 'search', :class => 'string', :name => 'search') { actual_html }
352
- end
353
-
354
- should "display search field in erb" do
355
- visit '/erb/form_tag'
356
- assert_have_selector 'form.simple-form input[type=search]', :count => 1, :name => 'search'
357
- assert_have_selector 'form.advanced-form fieldset input[type=search]', :count => 1, :name => 'search', :class => 'string'
358
- end
359
-
360
- should "display search field in haml" do
361
- visit '/haml/form_tag'
362
- assert_have_selector 'form.simple-form input[type=search]', :count => 1, :name => 'search'
363
- assert_have_selector 'form.advanced-form fieldset input[type=search]', :count => 1, :name => 'search', :class => 'string'
364
- end
365
-
366
- should "display search field in slim" do
367
- visit '/slim/form_tag'
368
- assert_have_selector 'form.simple-form input[type=search]', :count => 1, :name => 'search'
369
- assert_have_selector 'form.advanced-form fieldset input[type=search]', :count => 1, :name => 'search', :class => 'string'
370
- end
371
- end
372
-
373
- context 'for #email_field_tag method' do
374
- should "display email field in ruby" do
375
- actual_html = email_field_tag(:email, :class => 'string')
376
- assert_has_tag(:input, :type => 'email', :class => 'string', :name => 'email') { actual_html }
377
- end
378
-
379
- should "display email field in erb" do
380
- visit '/erb/form_tag'
381
- assert_have_selector 'form.simple-form input[type=email]', :count => 1, :name => 'email'
382
- assert_have_selector 'form.advanced-form fieldset input[type=email]', :count => 1, :name => 'email', :class => 'string'
383
- end
384
-
385
- should "display email field in haml" do
386
- visit '/haml/form_tag'
387
- assert_have_selector 'form.simple-form input[type=email]', :count => 1, :name => 'email'
388
- assert_have_selector 'form.advanced-form fieldset input[type=email]', :count => 1, :name => 'email', :class => 'string'
389
- end
390
-
391
- should "display email field in slim" do
392
- visit '/slim/form_tag'
393
- assert_have_selector 'form.simple-form input[type=email]', :count => 1, :name => 'email'
394
- assert_have_selector 'form.advanced-form fieldset input[type=email]', :count => 1, :name => 'email', :class => 'string'
395
- end
396
- end
397
-
398
- context 'for #url_field_tag method' do
399
- should "display url field in ruby" do
400
- actual_html = url_field_tag(:webpage, :class => 'string')
401
- assert_has_tag(:input, :type => 'url', :class => 'string', :name => 'webpage') { actual_html }
402
- end
403
-
404
- should "display url field in erb" do
405
- visit '/erb/form_tag'
406
- assert_have_selector 'form.simple-form input[type=url]', :count => 1, :name => 'webpage'
407
- assert_have_selector 'form.advanced-form fieldset input[type=url]', :count => 1, :name => 'webpage', :class => 'string'
408
- end
409
-
410
- should "display url field in haml" do
411
- visit '/haml/form_tag'
412
- assert_have_selector 'form.simple-form input[type=url]', :count => 1, :name => 'webpage'
413
- assert_have_selector 'form.advanced-form fieldset input[type=url]', :count => 1, :name => 'webpage', :class => 'string'
414
- end
415
-
416
- should "display url field in slim" do
417
- visit '/slim/form_tag'
418
- assert_have_selector 'form.simple-form input[type=url]', :count => 1, :name => 'webpage'
419
- assert_have_selector 'form.advanced-form fieldset input[type=url]', :count => 1, :name => 'webpage', :class => 'string'
420
- end
421
- end
422
-
423
- context 'for #text_area_tag method' do
424
- should "display text area in ruby" do
425
- actual_html = text_area_tag(:about, :class => 'long')
426
- assert_has_tag(:textarea, :class => "long", :name => 'about') { actual_html }
427
- end
428
-
429
- should "display text area in ruby with specified content" do
430
- actual_html = text_area_tag(:about, :value => "a test", :rows => 5, :cols => 6)
431
- assert_has_tag(:textarea, :content => "a test", :name => 'about', :rows => "5", :cols => "6") { actual_html }
432
- end
433
-
434
- should "display text area in erb" do
435
- visit '/erb/form_tag'
436
- assert_have_selector 'form.advanced-form textarea', :count => 1, :name => 'about', :class => 'large'
437
- end
438
-
439
- should "display text area in haml" do
440
- visit '/haml/form_tag'
441
- assert_have_selector 'form.advanced-form textarea', :count => 1, :name => 'about', :class => 'large'
442
- end
443
-
444
- should "display text area in slim" do
445
- visit '/slim/form_tag'
446
- assert_have_selector 'form.advanced-form textarea', :count => 1, :name => 'about', :class => 'large'
447
- end
448
- end
449
-
450
- context 'for #password_field_tag method' do
451
- should "display password field in ruby" do
452
- actual_html = password_field_tag(:password, :class => 'long')
453
- assert_has_tag(:input, :type => 'password', :class => "long", :name => 'password') { actual_html }
454
- end
455
-
456
- should "display password field in erb" do
457
- visit '/erb/form_tag'
458
- assert_have_selector 'form.simple-form input[type=password]', :count => 1, :name => 'password'
459
- assert_have_selector 'form.advanced-form input[type=password]', :count => 1, :name => 'password'
460
- end
461
-
462
- should "display password field in haml" do
463
- visit '/haml/form_tag'
464
- assert_have_selector 'form.simple-form input[type=password]', :count => 1, :name => 'password'
465
- assert_have_selector 'form.advanced-form input[type=password]', :count => 1, :name => 'password'
466
- end
467
-
468
- should "display password field in slim" do
469
- visit '/slim/form_tag'
470
- assert_have_selector 'form.simple-form input[type=password]', :count => 1, :name => 'password'
471
- assert_have_selector 'form.advanced-form input[type=password]', :count => 1, :name => 'password'
472
- end
473
- end
474
-
475
- context 'for #file_field_tag method' do
476
- should "display file field in ruby" do
477
- actual_html = file_field_tag(:photo, :class => 'photo')
478
- assert_has_tag(:input, :type => 'file', :class => "photo", :name => 'photo') { actual_html }
479
- end
480
-
481
- should "display file field in erb" do
482
- visit '/erb/form_tag'
483
- assert_have_selector 'form.advanced-form input[type=file]', :count => 1, :name => 'photo', :class => 'upload'
484
- end
485
-
486
- should "display file field in haml" do
487
- visit '/haml/form_tag'
488
- assert_have_selector 'form.advanced-form input[type=file]', :count => 1, :name => 'photo', :class => 'upload'
489
- end
490
-
491
- should "display file field in slim" do
492
- visit '/slim/form_tag'
493
- assert_have_selector 'form.advanced-form input[type=file]', :count => 1, :name => 'photo', :class => 'upload'
494
- end
495
- end
496
-
497
- context "for #check_box_tag method" do
498
- should "display check_box tag in ruby" do
499
- actual_html = check_box_tag("clear_session")
500
- assert_has_tag(:input, :type => 'checkbox', :value => '1', :name => 'clear_session') { actual_html }
501
- assert_has_no_tag(:input, :type => 'hidden') { actual_html }
502
- end
503
-
504
- should "display check_box tag in ruby with extended attributes" do
505
- actual_html = check_box_tag("clear_session", :disabled => true, :checked => true)
506
- assert_has_tag(:input, :type => 'checkbox', :disabled => 'disabled', :checked => 'checked') { actual_html }
507
- end
508
-
509
- should "display check_box tag in erb" do
510
- visit '/erb/form_tag'
511
- assert_have_selector 'form.simple-form input[type=checkbox]', :count => 1
512
- assert_have_selector 'form.advanced-form input[type=checkbox]', :value => "1", :checked => 'checked'
513
- end
514
-
515
- should "display check_box tag in haml" do
516
- visit '/haml/form_tag'
517
- assert_have_selector 'form.simple-form input[type=checkbox]', :count => 1
518
- assert_have_selector 'form.advanced-form input[type=checkbox]', :value => "1", :checked => 'checked'
519
- end
520
-
521
- should "display check_box tag in slim" do
522
- visit '/slim/form_tag'
523
- assert_have_selector 'form.simple-form input[type=checkbox]', :count => 1
524
- assert_have_selector 'form.advanced-form input[type=checkbox]', :value => "1", :checked => 'checked'
525
- end
526
- end
527
-
528
- context "for #radio_button_tag method" do
529
- should "display radio_button tag in ruby" do
530
- actual_html = radio_button_tag("gender", :value => 'male')
531
- assert_has_tag(:input, :type => 'radio', :value => 'male', :name => 'gender') { actual_html }
532
- end
533
-
534
- should "display radio_button tag in ruby with extended attributes" do
535
- actual_html = radio_button_tag("gender", :disabled => true, :checked => true)
536
- assert_has_tag(:input, :type => 'radio', :disabled => 'disabled', :checked => 'checked') { actual_html }
537
- end
538
-
539
- should "display radio_button tag in erb" do
540
- visit '/erb/form_tag'
541
- assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'male'
542
- assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'female'
543
- assert_have_selector 'form.advanced-form input[type=radio]', :value => "male", :checked => 'checked'
544
- assert_have_selector 'form.advanced-form input[type=radio]', :value => "female"
545
- end
546
-
547
- should "display radio_button tag in haml" do
548
- visit '/haml/form_tag'
549
- assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'male'
550
- assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'female'
551
- assert_have_selector 'form.advanced-form input[type=radio]', :value => "male", :checked => 'checked'
552
- assert_have_selector 'form.advanced-form input[type=radio]', :value => "female"
553
- end
554
-
555
- should "display radio_button tag in slim" do
556
- visit '/slim/form_tag'
557
- assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'male'
558
- assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'female'
559
- assert_have_selector 'form.advanced-form input[type=radio]', :value => "male", :checked => 'checked'
560
- assert_have_selector 'form.advanced-form input[type=radio]', :value => "female"
561
- end
562
- end
563
-
564
- context "for #select_tag method" do
565
- should "display select tag in ruby" do
566
- actual_html = select_tag(:favorite_color, :options => ['green', 'blue', 'black'], :include_blank => true)
567
- assert_has_tag(:select, :name => 'favorite_color') { actual_html }
568
- assert_has_tag('select option:first-child', :content => '') { actual_html }
569
- assert_has_tag('select option', :content => 'green', :value => 'green') { actual_html }
570
- assert_has_tag('select option', :content => 'blue', :value => 'blue') { actual_html }
571
- assert_has_tag('select option', :content => 'black', :value => 'black') { actual_html }
572
- end
573
-
574
- should "display select tag in ruby with extended attributes" do
575
- actual_html = select_tag(:favorite_color, :disabled => true, :options => ['only', 'option'])
576
- assert_has_tag(:select, :disabled => 'disabled') { actual_html }
577
- end
578
-
579
- should "take a range as a collection for options" do
580
- actual_html = select_tag(:favorite_color, :options => (1..3))
581
- assert_has_tag(:select) { actual_html }
582
- assert_has_tag('select option', :value => '1') { actual_html }
583
- assert_has_tag('select option', :value => '2') { actual_html }
584
- assert_has_tag('select option', :value => '3') { actual_html }
585
- end
586
-
587
- should "include blank for grouped options" do
588
- opts = { "Red" => ["Rose","Fire"], "Blue" => ["Sky","Sea"] }
589
- actual_html = select_tag( 'color', :grouped_options => opts, :include_blank => true )
590
- assert_has_tag('select option:first-child', :value => "", :content => "") { actual_html }
591
- end
592
-
593
- should "return a select tag with grouped options for an nested array" do
594
- opts = [
595
- ["Friends",["Yoda",["Obiwan",2]]],
596
- ["Enemies", ["Palpatine",['Darth Vader',3]]]
597
- ]
598
- actual_html = select_tag( 'name', :grouped_options => opts )
599
- assert_has_tag(:select, :name => "name") { actual_html }
600
- assert_has_tag(:optgroup, :label => "Friends") { actual_html }
601
- assert_has_tag(:option, :value => "Yoda", :content => "Yoda") { actual_html }
602
- assert_has_tag(:option, :value => "2", :content => "Obiwan") { actual_html }
603
- assert_has_tag(:optgroup, :label => "Enemies") { actual_html }
604
- assert_has_tag(:option, :value => "Palpatine", :content => "Palpatine") { actual_html }
605
- assert_has_tag(:option, :value => "3", :content => "Darth Vader") { actual_html }
606
- end
607
-
608
- should "return a select tag with grouped options for a hash" do
609
- opts = {
610
- "Friends" => ["Yoda",["Obiwan",2]],
611
- "Enemies" => ["Palpatine",['Darth Vader',3]]
612
- }
613
- actual_html = select_tag( 'name', :grouped_options => opts )
614
- assert_has_tag(:select, :name => "name") { actual_html }
615
- assert_has_tag(:optgroup, :label => "Friends") { actual_html }
616
- assert_has_tag(:option, :value => "Yoda", :content => "Yoda") { actual_html }
617
- assert_has_tag(:option, :value => "2", :content => "Obiwan") { actual_html }
618
- assert_has_tag(:optgroup, :label => "Enemies") { actual_html }
619
- assert_has_tag(:option, :value => "Palpatine", :content => "Palpatine") { actual_html }
620
- assert_has_tag(:option, :value => "3", :content => "Darth Vader") { actual_html }
621
- end
622
-
623
- should "display select tag in ruby with multiple attribute" do
624
- actual_html = select_tag(:favorite_color, :multiple => true, :options => ['only', 'option'])
625
- assert_has_tag(:select, :multiple => 'multiple', :name => 'favorite_color[]') { actual_html }
626
- end
627
-
628
- should "display options with values and single selected" do
629
- options = [['Green', 'green1'], ['Blue', 'blue1'], ['Black', "black1"]]
630
- actual_html = select_tag(:favorite_color, :options => options, :selected => 'green1')
631
- assert_has_tag(:select, :name => 'favorite_color') { actual_html }
632
- assert_has_tag('select option', :selected => 'selected', :count => 1) { actual_html }
633
- assert_has_tag('select option', :content => 'Green', :value => 'green1', :selected => 'selected') { actual_html }
634
- assert_has_tag('select option', :content => 'Blue', :value => 'blue1') { actual_html }
635
- assert_has_tag('select option', :content => 'Black', :value => 'black1') { actual_html }
636
- end
637
-
638
- should "display option with values and multiple selected" do
639
- options = [['Green', 'green1'], ['Blue', 'blue1'], ['Black', "black1"]]
640
- actual_html = select_tag(:favorite_color, :options => options, :selected => ['green1', 'Black'])
641
- assert_has_tag(:select, :name => 'favorite_color') { actual_html }
642
- assert_has_tag('select option', :selected => 'selected', :count => 2) { actual_html }
643
- assert_has_tag('select option', :content => 'Green', :value => 'green1', :selected => 'selected') { actual_html }
644
- assert_has_tag('select option', :content => 'Blue', :value => 'blue1') { actual_html }
645
- assert_has_tag('select option', :content => 'Black', :value => 'black1', :selected => 'selected') { actual_html }
646
- end
647
-
648
- should "display options selected only for exact match" do
649
- options = [['One', '1'], ['1', '10'], ['Two', "-1"]]
650
- actual_html = select_tag(:range, :options => options, :selected => '-1')
651
- assert_has_tag(:select, :name => 'range') { actual_html }
652
- assert_has_tag('select option', :selected => 'selected', :count => 1) { actual_html }
653
- assert_has_tag('select option', :content => 'Two', :value => '-1', :selected => 'selected') { actual_html }
654
- end
655
-
656
- should "display select tag in erb" do
657
- visit '/erb/form_tag'
658
- assert_have_selector 'form.simple-form select', :count => 1, :name => 'color'
659
- assert_have_selector('select option', :content => 'green', :value => 'green')
660
- assert_have_selector('select option', :content => 'orange', :value => 'orange')
661
- assert_have_selector('select option', :content => 'purple', :value => 'purple')
662
- assert_have_selector 'form.advanced-form select', :name => 'fav_color'
663
- assert_have_selector('select option', :content => 'green', :value => '1')
664
- assert_have_selector('select option', :content => 'orange', :value => '2', :selected => 'selected')
665
- assert_have_selector('select option', :content => 'purple', :value => '3')
666
- end
667
-
668
- should "display select tag in haml" do
669
- visit '/haml/form_tag'
670
- assert_have_selector 'form.simple-form select', :count => 1, :name => 'color'
671
- assert_have_selector('select option', :content => 'green', :value => 'green')
672
- assert_have_selector('select option', :content => 'orange', :value => 'orange')
673
- assert_have_selector('select option', :content => 'purple', :value => 'purple')
674
- assert_have_selector 'form.advanced-form select', :name => 'fav_color'
675
- assert_have_selector('select option', :content => 'green', :value => '1')
676
- assert_have_selector('select option', :content => 'orange', :value => '2', :selected => 'selected')
677
- assert_have_selector('select option', :content => 'purple', :value => '3')
678
- end
679
-
680
- should "display select tag in slim" do
681
- visit '/slim/form_tag'
682
- assert_have_selector 'form.simple-form select', :count => 1, :name => 'color'
683
- assert_have_selector('select option', :content => 'green', :value => 'green')
684
- assert_have_selector('select option', :content => 'orange', :value => 'orange')
685
- assert_have_selector('select option', :content => 'purple', :value => 'purple')
686
- assert_have_selector 'form.advanced-form select', :name => 'fav_color'
687
- assert_have_selector('select option', :content => 'green', :value => '1')
688
- assert_have_selector('select option', :content => 'orange', :value => '2', :selected => 'selected')
689
- assert_have_selector('select option', :content => 'purple', :value => '3')
690
- end
691
- end
692
-
693
- context 'for #submit_tag method' do
694
- should "display submit tag in ruby" do
695
- actual_html = submit_tag("Update", :class => 'success')
696
- assert_has_tag(:input, :type => 'submit', :class => "success", :value => 'Update') { actual_html }
697
- end
698
-
699
- should "display submit tag in erb" do
700
- visit '/erb/form_tag'
701
- assert_have_selector 'form.simple-form input[type=submit]', :count => 1, :value => "Submit"
702
- assert_have_selector 'form.advanced-form input[type=submit]', :count => 1, :value => "Login"
703
- end
704
-
705
- should "display submit tag in haml" do
706
- visit '/haml/form_tag'
707
- assert_have_selector 'form.simple-form input[type=submit]', :count => 1, :value => "Submit"
708
- assert_have_selector 'form.advanced-form input[type=submit]', :count => 1, :value => "Login"
709
- end
710
-
711
- should "display submit tag in slim" do
712
- visit '/slim/form_tag'
713
- assert_have_selector 'form.simple-form input[type=submit]', :count => 1, :value => "Submit"
714
- assert_have_selector 'form.advanced-form input[type=submit]', :count => 1, :value => "Login"
715
- end
716
- end
717
-
718
- context 'for #button_tag method' do
719
- should "display submit tag in ruby" do
720
- actual_html = button_tag("Cancel", :class => 'clear')
721
- assert_has_tag(:input, :type => 'button', :class => "clear", :value => 'Cancel') { actual_html }
722
- end
723
-
724
- should "display submit tag in erb" do
725
- visit '/erb/form_tag'
726
- assert_have_selector 'form.advanced-form input[type=button]', :count => 1, :value => "Cancel"
727
- end
728
-
729
- should "display submit tag in haml" do
730
- visit '/haml/form_tag'
731
- assert_have_selector 'form.advanced-form input[type=button]', :count => 1, :value => "Cancel"
732
- end
733
-
734
- should "display submit tag in slim" do
735
- visit '/slim/form_tag'
736
- assert_have_selector 'form.advanced-form input[type=button]', :count => 1, :value => "Cancel"
737
- end
738
- end
739
-
740
- context 'for #image_submit_tag method' do
741
- setup do
742
- @stamp = stop_time_for_test.to_i
743
- end
744
-
745
- should "display image submit tag in ruby with relative path" do
746
- actual_html = image_submit_tag('buttons/ok.png', :class => 'success')
747
- assert_has_tag(:input, :type => 'image', :class => "success", :src => "/images/buttons/ok.png?#{@stamp}") { actual_html }
748
- end
749
-
750
- should "display image submit tag in ruby with absolute path" do
751
- actual_html = image_submit_tag('/system/ok.png', :class => 'success')
752
- assert_has_tag(:input, :type => 'image', :class => "success", :src => "/system/ok.png") { actual_html }
753
- end
754
-
755
- should "display image submit tag in erb" do
756
- visit '/erb/form_tag'
757
- assert_have_selector 'form.advanced-form input[type=image]', :count => 1, :src => "/images/buttons/submit.png?#{@stamp}"
758
- end
759
-
760
- should "display image submit tag in haml" do
761
- visit '/haml/form_tag'
762
- assert_have_selector 'form.advanced-form input[type=image]', :count => 1, :src => "/images/buttons/submit.png?#{@stamp}"
763
- end
764
-
765
- should "display image submit tag in slim" do
766
- visit '/slim/form_tag'
767
- assert_have_selector 'form.advanced-form input[type=image]', :count => 1, :src => "/images/buttons/submit.png?#{@stamp}"
768
- end
769
- end
770
- end