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.
- data/features/cli_extension.feature +13 -0
- data/features/{cli.feature → cli_init.feature} +1 -10
- data/features/directory_index.feature +29 -1
- data/features/dynamic_pages.feature +1 -0
- data/features/extensionless_text_files.feature +0 -2
- data/features/front-matter.feature +17 -1
- data/features/frontmatter_page_settings.feature +16 -1
- data/features/helpers_relative_link_to.feature +68 -0
- data/features/unicode_filenames.feature +14 -0
- data/fixtures/csspie/config.rb +0 -0
- data/fixtures/csspie/source/stylesheets/PIE.htc +96 -0
- data/fixtures/dynamic-pages-app/config.rb +3 -0
- data/fixtures/frontmatter-app/source/front-matter-auto.erb +6 -0
- data/fixtures/frontmatter-app/source/front-matter.html.erb +2 -0
- data/fixtures/frontmatter-app/source/json-front-matter-2.php.erb +7 -0
- data/fixtures/frontmatter-app/source/json-front-matter-auto.erb +6 -0
- data/fixtures/frontmatter-app/source/json-front-matter.html.erb +6 -0
- data/fixtures/unicode-filenames-app/config.rb +1 -0
- data/fixtures/unicode-filenames-app/source/snowmen-rule-/342/230/203.html +4 -0
- data/lib/middleman-core/application.rb +43 -335
- data/lib/middleman-core/cli/build.rb +11 -4
- data/lib/middleman-core/cli/bundler.rb +40 -0
- data/lib/middleman-core/cli/extension.rb +36 -0
- data/lib/middleman-core/cli/server.rb +2 -2
- data/lib/middleman-core/cli.rb +2 -6
- data/lib/middleman-core/core_extensions/assets.rb +35 -31
- data/lib/middleman-core/core_extensions/builder.rb +14 -9
- data/lib/middleman-core/core_extensions/data.rb +150 -145
- data/lib/middleman-core/core_extensions/default_helpers.rb +159 -97
- data/lib/middleman-core/core_extensions/extensions.rb +103 -97
- data/lib/middleman-core/core_extensions/external_helpers.rb +27 -23
- data/lib/middleman-core/core_extensions/file_watcher.rb +140 -110
- data/lib/middleman-core/core_extensions/front_matter.rb +155 -175
- data/lib/middleman-core/core_extensions/i18n.rb +111 -102
- data/lib/middleman-core/core_extensions/rendering.rb +293 -295
- data/lib/middleman-core/core_extensions/request.rb +338 -0
- data/lib/middleman-core/core_extensions/routing.rb +72 -68
- data/lib/middleman-core/core_extensions/show_exceptions.rb +23 -18
- data/lib/middleman-core/core_extensions.rb +39 -0
- data/lib/middleman-core/extensions/directory_indexes.rb +1 -4
- data/lib/middleman-core/extensions/lorem.rb +10 -3
- data/lib/middleman-core/extensions.rb +2 -64
- data/lib/middleman-core/preview_server.rb +157 -0
- data/lib/middleman-core/sitemap/extensions/ignores.rb +73 -68
- data/lib/middleman-core/sitemap/extensions/on_disk.rb +65 -58
- data/lib/middleman-core/sitemap/extensions/proxies.rb +86 -75
- data/lib/middleman-core/sitemap/extensions/traversal.rb +68 -61
- data/lib/middleman-core/sitemap/resource.rb +123 -102
- data/lib/middleman-core/sitemap/store.rb +170 -149
- data/lib/middleman-core/sitemap.rb +57 -57
- data/lib/middleman-core/step_definitions/server_steps.rb +13 -3
- data/lib/middleman-core/templates/extension/Gemfile +4 -0
- data/lib/middleman-core/templates/extension/Rakefile +12 -0
- data/lib/middleman-core/templates/extension/features/support/env.rb +4 -0
- data/lib/middleman-core/templates/extension/gemspec +24 -0
- data/lib/middleman-core/templates/extension/lib/lib.rb +49 -0
- data/lib/middleman-core/templates/extension/lib/middleman_extension.rb +1 -0
- data/lib/middleman-core/templates/shared/gitignore +14 -0
- data/lib/middleman-core/templates.rb +14 -8
- data/lib/middleman-core/util.rb +31 -9
- data/lib/middleman-core/version.rb +1 -1
- data/lib/middleman-core.rb +6 -4
- data/middleman-core.gemspec +4 -6
- metadata +62 -203
- data/lib/middleman-core/vendor/padrino-core-0.10.6/.document +0 -5
- data/lib/middleman-core/vendor/padrino-core-0.10.6/.gitignore +0 -22
- data/lib/middleman-core/vendor/padrino-core-0.10.6/.yardopts +0 -1
- data/lib/middleman-core/vendor/padrino-core-0.10.6/LICENSE.txt +0 -20
- data/lib/middleman-core/vendor/padrino-core-0.10.6/README.rdoc +0 -294
- data/lib/middleman-core/vendor/padrino-core-0.10.6/Rakefile +0 -5
- data/lib/middleman-core/vendor/padrino-core-0.10.6/bin/padrino +0 -9
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/rendering.rb +0 -292
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/routing.rb +0 -943
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/showexceptions.rb +0 -20
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application.rb +0 -269
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/caller.rb +0 -53
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/adapter.rb +0 -24
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/base.rb +0 -150
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/console.rb +0 -20
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/rake.rb +0 -24
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/rake_tasks.rb +0 -59
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/command.rb +0 -38
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/images/404.png +0 -0
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/images/500.png +0 -0
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/loader.rb +0 -211
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/cs.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/da.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/de.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/en.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/es.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/fr.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/hu.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/it.yml +0 -40
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/ja.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/lv.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/nl.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/no.yml +0 -35
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/pl.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/pt_br.yml +0 -40
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/ru.yml +0 -35
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/tr.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/uk.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/zh_cn.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/zh_tw.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/logger.rb +0 -428
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/mounter.rb +0 -224
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/reloader.rb +0 -254
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/router.rb +0 -98
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/server.rb +0 -79
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/support_lite.rb +0 -199
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/tasks.rb +0 -21
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/version.rb +0 -20
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core.rb +0 -152
- data/lib/middleman-core/vendor/padrino-core-0.10.6/padrino-core.gemspec +0 -38
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/.components +0 -6
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/.gitignore +0 -7
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/complex.rb +0 -32
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/simple.rb +0 -33
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/a.rb +0 -9
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/b.rb +0 -4
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/c.rb +0 -1
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/e.rb +0 -13
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/f.rb +0 -2
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/g.rb +0 -2
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/d.rb +0 -4
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/helper.rb +0 -83
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/mini_shoulda.rb +0 -45
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_application.rb +0 -108
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_core.rb +0 -77
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_dependencies.rb +0 -44
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_filters.rb +0 -278
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_locale.rb +0 -21
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_logger.rb +0 -154
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_mounter.rb +0 -177
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_reloader_complex.rb +0 -75
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_reloader_simple.rb +0 -98
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_rendering.rb +0 -461
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_restful_routing.rb +0 -33
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_router.rb +0 -146
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_routing.rb +0 -1680
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.document +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.gitignore +0 -21
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.yardopts +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/LICENSE.txt +0 -20
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/README.rdoc +0 -239
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/Rakefile +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/asset_tag_helpers.rb +0 -417
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_builder/abstract_form_builder.rb +0 -251
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_builder/standard_form_builder.rb +0 -43
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_helpers.rb +0 -787
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/format_helpers.rb +0 -381
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/cs.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/da.yml +0 -91
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/de.yml +0 -81
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/en.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/es.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/fr.yml +0 -80
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/hu.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/it.yml +0 -89
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/ja.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/lv.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/nl.yml +0 -82
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/no.yml +0 -91
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/pl.yml +0 -95
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/pt_br.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/ru.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/tr.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/uk.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/zh_cn.yml +0 -104
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/zh_tw.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/number_helpers.rb +0 -288
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/abstract_handler.rb +0 -98
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/erb_handler.rb +0 -79
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/haml_handler.rb +0 -63
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/slim_handler.rb +0 -81
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers.rb +0 -175
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/render_helpers.rb +0 -60
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/tag_helpers.rb +0 -260
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/translation_helpers.rb +0 -38
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers.rb +0 -59
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/padrino-helpers.gemspec +0 -27
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/app.rb +0 -73
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.erb +0 -14
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.haml +0 -12
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.slim +0 -13
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.erb +0 -14
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.haml +0 -12
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.slim +0 -12
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.erb +0 -11
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.haml +0 -9
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.slim +0 -9
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.erb +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.haml +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.slim +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.erb +0 -20
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.haml +0 -15
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.slim +0 -15
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.erb +0 -72
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.haml +0 -59
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.slim +0 -59
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.erb +0 -86
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.haml +0 -70
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.slim +0 -70
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.erb +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.haml +0 -4
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.slim +0 -4
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.erb +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.haml +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.slim +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.erb +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.haml +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.slim +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_erb.erb +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_haml.haml +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_slim.slim +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.erb +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.haml +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.slim +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/app.rb +0 -50
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engine.haml +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_erb.erb +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_haml.haml +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_slim.slim +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/erb/test.erb +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/explicit_engine.haml +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/haml/test.haml +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/_user.haml +0 -7
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/haml_template.haml +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/some_template.haml +0 -2
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/helper.rb +0 -66
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_asset_tag_helpers.rb +0 -328
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_builder.rb +0 -1106
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_helpers.rb +0 -770
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_format_helpers.rb +0 -227
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_locale.rb +0 -20
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_number_helpers.rb +0 -139
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_output_helpers.rb +0 -153
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_render_helpers.rb +0 -76
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_tag_helpers.rb +0 -106
- data/lib/middleman-core/watcher.rb +0 -196
@@ -1,461 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
-
require 'i18n'
|
3
|
-
|
4
|
-
describe "Rendering" do
|
5
|
-
def setup
|
6
|
-
Padrino::Application.send(:register, Padrino::Rendering)
|
7
|
-
Padrino::Rendering::DEFAULT_RENDERING_OPTIONS[:strict_format] = false
|
8
|
-
end
|
9
|
-
|
10
|
-
def teardown
|
11
|
-
remove_views
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'for application layout functionality' do
|
15
|
-
|
16
|
-
should 'get no layout' do
|
17
|
-
mock_app do
|
18
|
-
get("/"){ "no layout" }
|
19
|
-
end
|
20
|
-
|
21
|
-
get "/"
|
22
|
-
assert_equal "no layout", body
|
23
|
-
end
|
24
|
-
|
25
|
-
should 'be compatible with sinatra layout' do
|
26
|
-
mock_app do
|
27
|
-
layout do
|
28
|
-
"this is a <%= yield %>"
|
29
|
-
end
|
30
|
-
|
31
|
-
get("/"){ render :erb, "sinatra layout" }
|
32
|
-
end
|
33
|
-
|
34
|
-
get "/"
|
35
|
-
assert_equal "this is a sinatra layout", body
|
36
|
-
end
|
37
|
-
|
38
|
-
should 'use rails way layout' do
|
39
|
-
with_layout :application, "this is a <%= yield %>" do
|
40
|
-
mock_app do
|
41
|
-
get("/"){ render :erb, "rails way layout" }
|
42
|
-
end
|
43
|
-
|
44
|
-
get "/"
|
45
|
-
assert_equal "this is a rails way layout", body
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
should 'use rails way for a custom layout' do
|
50
|
-
with_layout "layouts/custom", "this is a <%= yield %>" do
|
51
|
-
mock_app do
|
52
|
-
layout :custom
|
53
|
-
get("/"){ render :erb, "rails way custom layout" }
|
54
|
-
end
|
55
|
-
|
56
|
-
get "/"
|
57
|
-
assert_equal "this is a rails way custom layout", body
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
should 'not use layout' do
|
62
|
-
with_layout :application, "this is a <%= yield %>" do
|
63
|
-
with_view :index, "index" do
|
64
|
-
mock_app do
|
65
|
-
get("/with/layout"){ render :index }
|
66
|
-
get("/without/layout"){ render :index, :layout => false }
|
67
|
-
end
|
68
|
-
get "/with/layout"
|
69
|
-
assert_equal "this is a index", body
|
70
|
-
get "/without/layout"
|
71
|
-
assert_equal "index", body
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
should 'not use layout with js format' do
|
77
|
-
create_layout :application, "this is an <%= yield %>"
|
78
|
-
create_view :foo, "erb file"
|
79
|
-
create_view :foo, "js file", :format => :js
|
80
|
-
mock_app do
|
81
|
-
get('/layout_test', :provides => [:html, :js]){ render :foo }
|
82
|
-
end
|
83
|
-
get "/layout_test"
|
84
|
-
assert_equal "this is an erb file", body
|
85
|
-
get "/layout_test.js"
|
86
|
-
assert_equal "js file", body
|
87
|
-
end
|
88
|
-
|
89
|
-
should 'use correct layout for each format' do
|
90
|
-
create_layout :application, "this is an <%= yield %>"
|
91
|
-
create_layout :application, "document start <%= yield %> end", :format => :xml
|
92
|
-
create_view :foo, "erb file"
|
93
|
-
create_view :foo, "xml file", :format => :xml
|
94
|
-
mock_app do
|
95
|
-
get('/layout_test', :provides => [:html, :xml]){ render :foo }
|
96
|
-
end
|
97
|
-
get "/layout_test"
|
98
|
-
assert_equal "this is an erb file", body
|
99
|
-
get "/layout_test.xml"
|
100
|
-
assert_equal "document start xml file end", body
|
101
|
-
end
|
102
|
-
|
103
|
-
should 'by default use html file when no other is given' do
|
104
|
-
create_layout :baz, "html file", :format => :html
|
105
|
-
|
106
|
-
mock_app do
|
107
|
-
get('/content_type_test', :provides => [:html, :xml]) { render :baz }
|
108
|
-
end
|
109
|
-
|
110
|
-
get "/content_type_test"
|
111
|
-
assert_equal "html file", body
|
112
|
-
get "/content_type_test.html"
|
113
|
-
assert_equal "html file", body
|
114
|
-
get "/content_type_test.xml"
|
115
|
-
assert_equal "html file", body
|
116
|
-
end
|
117
|
-
|
118
|
-
should 'not use html file when DEFAULT_RENDERING_OPTIONS[:strict_format] == true' do
|
119
|
-
create_layout :foo, "html file", :format => :html
|
120
|
-
|
121
|
-
mock_app do
|
122
|
-
get('/default_rendering_test', :provides => [:html, :xml]) { render :foo }
|
123
|
-
end
|
124
|
-
|
125
|
-
@save = Padrino::Rendering::DEFAULT_RENDERING_OPTIONS
|
126
|
-
Padrino::Rendering::DEFAULT_RENDERING_OPTIONS[:strict_format] = true
|
127
|
-
|
128
|
-
get "/default_rendering_test"
|
129
|
-
assert_equal "html file", body
|
130
|
-
assert_raises Padrino::Rendering::TemplateNotFound do
|
131
|
-
get "/default_rendering_test.xml"
|
132
|
-
end
|
133
|
-
|
134
|
-
Padrino::Rendering::DEFAULT_RENDERING_OPTIONS.merge!(@save)
|
135
|
-
end
|
136
|
-
|
137
|
-
should 'use correct layout with each controller' do
|
138
|
-
create_layout :foo, "foo layout at <%= yield %>"
|
139
|
-
create_layout :bar, "bar layout at <%= yield %>"
|
140
|
-
create_layout :application, "default layout at <%= yield %>"
|
141
|
-
mock_app do
|
142
|
-
get("/"){ render :erb, "application" }
|
143
|
-
controller :foo do
|
144
|
-
layout :foo
|
145
|
-
get("/"){ render :erb, "foo" }
|
146
|
-
end
|
147
|
-
controller :bar do
|
148
|
-
layout :bar
|
149
|
-
get("/"){ render :erb, "bar" }
|
150
|
-
end
|
151
|
-
controller :none do
|
152
|
-
get("/") { render :erb, "none" }
|
153
|
-
get("/with_foo_layout") { render :erb, "none with layout", :layout => :foo }
|
154
|
-
end
|
155
|
-
end
|
156
|
-
get "/foo"
|
157
|
-
assert_equal "foo layout at foo", body
|
158
|
-
get "/bar"
|
159
|
-
assert_equal "bar layout at bar", body
|
160
|
-
get "/none"
|
161
|
-
assert_equal "default layout at none", body
|
162
|
-
get "/none/with_foo_layout"
|
163
|
-
assert_equal "foo layout at none with layout", body
|
164
|
-
get "/"
|
165
|
-
assert_equal "default layout at application", body
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
should 'solve layout in layouts paths' do
|
170
|
-
create_layout :foo, "foo layout <%= yield %>"
|
171
|
-
create_layout :"layouts/bar", "bar layout <%= yield %>"
|
172
|
-
mock_app do
|
173
|
-
get("/") { render :erb, "none" }
|
174
|
-
get("/foo") { render :erb, "foo", :layout => :foo }
|
175
|
-
get("/bar") { render :erb, "bar", :layout => :bar }
|
176
|
-
end
|
177
|
-
get "/"
|
178
|
-
assert_equal "none", body
|
179
|
-
get "/foo"
|
180
|
-
assert_equal "foo layout foo", body
|
181
|
-
get "/bar"
|
182
|
-
assert_equal "bar layout bar", body
|
183
|
-
end
|
184
|
-
|
185
|
-
should 'render correctly if layout was not found or not exist' do
|
186
|
-
create_layout :application, "application layout for <%= yield %>"
|
187
|
-
create_view :foo, "index", :format => :html
|
188
|
-
create_view :foo, "xml.rss", :format => :rss
|
189
|
-
mock_app do
|
190
|
-
get("/foo", :provides => [:html, :rss]) { render('foo') }
|
191
|
-
get("/baz", :provides => :js) { render(:erb, 'baz') }
|
192
|
-
get("/bar") { render :haml, "haml" }
|
193
|
-
end
|
194
|
-
get "/foo"
|
195
|
-
assert_equal "application layout for index", body
|
196
|
-
get "/foo.rss"
|
197
|
-
assert_equal "<rss/>", body.chomp
|
198
|
-
get "/baz.js"
|
199
|
-
assert_equal "baz", body
|
200
|
-
get "/bar"
|
201
|
-
assert_equal "haml", body.chomp
|
202
|
-
end
|
203
|
-
|
204
|
-
context 'for application render functionality' do
|
205
|
-
|
206
|
-
should "work properly with logging and missing layout" do
|
207
|
-
create_view :index, "<%= foo %>"
|
208
|
-
mock_app do
|
209
|
-
enable :logging
|
210
|
-
get("/") { render "index", { :layout => true }, { :foo => "bar" } }
|
211
|
-
end
|
212
|
-
get "/"
|
213
|
-
assert_equal "bar", body
|
214
|
-
end
|
215
|
-
|
216
|
-
should "work properly with logging and layout" do
|
217
|
-
create_layout :application, "layout <%= yield %>"
|
218
|
-
create_view :index, "<%= foo %>"
|
219
|
-
mock_app do
|
220
|
-
enable :logging
|
221
|
-
get("/") { render "index", { :layout => true }, { :foo => "bar" } }
|
222
|
-
end
|
223
|
-
get "/"
|
224
|
-
assert_equal "layout bar", body
|
225
|
-
end
|
226
|
-
|
227
|
-
should 'be compatible with sinatra render' do
|
228
|
-
mock_app do
|
229
|
-
get("/"){ render :erb, "<%= 1+2 %>" }
|
230
|
-
end
|
231
|
-
get "/"
|
232
|
-
assert_equal "3", body
|
233
|
-
end
|
234
|
-
|
235
|
-
should "support passing locals into render" do
|
236
|
-
create_layout :application, "layout <%= yield %>"
|
237
|
-
create_view :index, "<%= foo %>"
|
238
|
-
mock_app do
|
239
|
-
get("/") { render "index", { :layout => true }, { :foo => "bar" } }
|
240
|
-
end
|
241
|
-
get "/"
|
242
|
-
assert_equal "layout bar", body
|
243
|
-
end
|
244
|
-
|
245
|
-
should "support passing locals into sinatra render" do
|
246
|
-
create_layout :application, "layout <%= yield %>"
|
247
|
-
create_view :index, "<%= foo %>"
|
248
|
-
mock_app do
|
249
|
-
get("/") { render :erb, :index, { :layout => true }, { :foo => "bar" } }
|
250
|
-
end
|
251
|
-
get "/"
|
252
|
-
assert_equal "layout bar", body
|
253
|
-
end
|
254
|
-
|
255
|
-
should "support passing locals into special nil engine render" do
|
256
|
-
create_layout :application, "layout <%= yield %>"
|
257
|
-
create_view :index, "<%= foo %>"
|
258
|
-
mock_app do
|
259
|
-
get("/") { render nil, :index, { :layout => true }, { :foo => "bar" } }
|
260
|
-
end
|
261
|
-
get "/"
|
262
|
-
assert_equal "layout bar", body
|
263
|
-
end
|
264
|
-
|
265
|
-
should 'be compatible with sinatra views' do
|
266
|
-
with_view :index, "<%= 1+2 %>" do
|
267
|
-
mock_app do
|
268
|
-
get("/foo") { render :erb, :index }
|
269
|
-
get("/bar") { erb :index }
|
270
|
-
get("/dir") { "3" }
|
271
|
-
get("/inj") { erb "<%= 2+1 %>" }
|
272
|
-
get("/rnj") { render :erb, "<%= 2+1 %>" }
|
273
|
-
end
|
274
|
-
get "/foo"
|
275
|
-
assert_equal "3", body
|
276
|
-
get "/bar"
|
277
|
-
assert_equal "3", body
|
278
|
-
get "/dir"
|
279
|
-
assert_equal "3", body
|
280
|
-
get "/inj"
|
281
|
-
assert_equal "3", body
|
282
|
-
get "/rnj"
|
283
|
-
assert_equal "3", body
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
should 'resolve template engine' do
|
288
|
-
with_view :index, "<%= 1+2 %>" do
|
289
|
-
mock_app do
|
290
|
-
get("/foo") { render :index }
|
291
|
-
get("/bar") { render "/index" }
|
292
|
-
end
|
293
|
-
get "/foo"
|
294
|
-
assert_equal "3", body
|
295
|
-
get "/bar"
|
296
|
-
assert_equal "3", body
|
297
|
-
end
|
298
|
-
end
|
299
|
-
|
300
|
-
should 'resolve template content type' do
|
301
|
-
create_view :foo, "Im Js", :format => :js
|
302
|
-
create_view :foo, "Im Erb"
|
303
|
-
mock_app do
|
304
|
-
get("/foo", :provides => :js) { render :foo }
|
305
|
-
get("/bar.js") { render :foo }
|
306
|
-
end
|
307
|
-
get "/foo.js"
|
308
|
-
assert_equal "Im Js", body
|
309
|
-
# TODO: implement this!
|
310
|
-
# get "/bar.js"
|
311
|
-
# assert_equal "Im Js", body
|
312
|
-
end
|
313
|
-
|
314
|
-
should 'resolve with explicit template format' do
|
315
|
-
create_view :foo, "Im Js", :format => :js
|
316
|
-
create_view :foo, "Im Haml", :format => :haml
|
317
|
-
create_view :foo, "Im Xml", :format => :xml
|
318
|
-
mock_app do
|
319
|
-
get("/foo_normal", :provides => :js) { render 'foo' }
|
320
|
-
get("/foo_haml", :provides => :js) { render 'foo.haml' }
|
321
|
-
get("/foo_xml", :provides => :js) { render 'foo.xml' }
|
322
|
-
end
|
323
|
-
get "/foo_normal.js"
|
324
|
-
assert_equal "Im Js", body
|
325
|
-
get "/foo_haml.js"
|
326
|
-
assert_equal "Im Haml\n", body
|
327
|
-
get "/foo_xml.js"
|
328
|
-
assert_equal "Im Xml", body
|
329
|
-
end
|
330
|
-
|
331
|
-
should 'resolve without explict template format' do
|
332
|
-
create_view :foo, "Im Html"
|
333
|
-
create_view :foo, "xml.rss", :format => :rss
|
334
|
-
mock_app do
|
335
|
-
get(:index, :map => "/", :provides => [:html, :rss]){ render 'foo' }
|
336
|
-
end
|
337
|
-
get "/", {}, { 'HTTP_ACCEPT' => 'text/html;q=0.9' }
|
338
|
-
assert_equal "Im Html", body
|
339
|
-
get ".rss"
|
340
|
-
assert_equal "<rss/>\n", body
|
341
|
-
end
|
342
|
-
|
343
|
-
should "ignore files ending in tilde and not render them" do
|
344
|
-
create_view :foo, "Im Wrong", :format => 'haml~'
|
345
|
-
create_view :foo, "Im Haml", :format => :haml
|
346
|
-
create_view :bar, "Im Haml backup", :format => 'haml~'
|
347
|
-
mock_app do
|
348
|
-
get('/foo') { render 'foo' }
|
349
|
-
get('/bar') { render 'bar' }
|
350
|
-
end
|
351
|
-
get '/foo'
|
352
|
-
assert_equal "Im Haml\n", body
|
353
|
-
assert_raises(Padrino::Rendering::TemplateNotFound) { get '/bar' }
|
354
|
-
end
|
355
|
-
|
356
|
-
should 'resolve template locale' do
|
357
|
-
create_view :foo, "Im English", :locale => :en
|
358
|
-
create_view :foo, "Im Italian", :locale => :it
|
359
|
-
mock_app do
|
360
|
-
get("/foo") { render :foo }
|
361
|
-
end
|
362
|
-
I18n.locale = :en
|
363
|
-
get "/foo"
|
364
|
-
assert_equal "Im English", body
|
365
|
-
I18n.locale = :it
|
366
|
-
get "/foo"
|
367
|
-
assert_equal "Im Italian", body
|
368
|
-
end
|
369
|
-
|
370
|
-
should 'resolve template content_type and locale' do
|
371
|
-
create_view :foo, "Im Js", :format => :js
|
372
|
-
create_view :foo, "Im Erb"
|
373
|
-
create_view :foo, "Im English Erb", :locale => :en
|
374
|
-
create_view :foo, "Im Italian Erb", :locale => :it
|
375
|
-
create_view :foo, "Im English Js", :format => :js, :locale => :en
|
376
|
-
create_view :foo, "Im Italian Js", :format => :js, :locale => :it
|
377
|
-
mock_app do
|
378
|
-
get("/foo", :provides => [:html, :js]) { render :foo }
|
379
|
-
end
|
380
|
-
I18n.locale = :none
|
381
|
-
get "/foo.js"
|
382
|
-
assert_equal "Im Js", body
|
383
|
-
get "/foo"
|
384
|
-
assert_equal "Im Erb", body
|
385
|
-
I18n.locale = :en
|
386
|
-
get "/foo"
|
387
|
-
assert_equal "Im English Erb", body
|
388
|
-
I18n.locale = :it
|
389
|
-
get "/foo"
|
390
|
-
assert_equal "Im Italian Erb", body
|
391
|
-
I18n.locale = :en
|
392
|
-
get "/foo.js"
|
393
|
-
assert_equal "Im English Js", body
|
394
|
-
I18n.locale = :it
|
395
|
-
get "/foo.js"
|
396
|
-
assert_equal "Im Italian Js", body
|
397
|
-
I18n.locale = :en
|
398
|
-
get "/foo.pk"
|
399
|
-
assert_equal 405, status
|
400
|
-
end
|
401
|
-
|
402
|
-
should 'resolve template content_type and locale with layout' do
|
403
|
-
create_layout :foo, "Hello <%= yield %> in a Js layout", :format => :js
|
404
|
-
create_layout :foo, "Hello <%= yield %> in a Js-En layout", :format => :js, :locale => :en
|
405
|
-
create_layout :foo, "Hello <%= yield %> in a Js-It layout", :format => :js, :locale => :it
|
406
|
-
create_layout :foo, "Hello <%= yield %> in a Erb-En layout", :locale => :en
|
407
|
-
create_layout :foo, "Hello <%= yield %> in a Erb-It layout", :locale => :it
|
408
|
-
create_layout :foo, "Hello <%= yield %> in a Erb layout"
|
409
|
-
create_view :bar, "Im Js", :format => :js
|
410
|
-
create_view :bar, "Im Erb"
|
411
|
-
create_view :bar, "Im English Erb", :locale => :en
|
412
|
-
create_view :bar, "Im Italian Erb", :locale => :it
|
413
|
-
create_view :bar, "Im English Js", :format => :js, :locale => :en
|
414
|
-
create_view :bar, "Im Italian Js", :format => :js, :locale => :it
|
415
|
-
create_view :bar, "Im a json", :format => :json
|
416
|
-
mock_app do
|
417
|
-
layout :foo
|
418
|
-
get("/bar", :provides => [:html, :js, :json]) { render :bar }
|
419
|
-
end
|
420
|
-
I18n.locale = :none
|
421
|
-
get "/bar.js"
|
422
|
-
assert_equal "Hello Im Js in a Js layout", body
|
423
|
-
get "/bar"
|
424
|
-
assert_equal "Hello Im Erb in a Erb layout", body
|
425
|
-
I18n.locale = :en
|
426
|
-
get "/bar"
|
427
|
-
assert_equal "Hello Im English Erb in a Erb-En layout", body
|
428
|
-
I18n.locale = :it
|
429
|
-
get "/bar"
|
430
|
-
assert_equal "Hello Im Italian Erb in a Erb-It layout", body
|
431
|
-
I18n.locale = :en
|
432
|
-
get "/bar.js"
|
433
|
-
assert_equal "Hello Im English Js in a Js-En layout", body
|
434
|
-
I18n.locale = :it
|
435
|
-
get "/bar.js"
|
436
|
-
assert_equal "Hello Im Italian Js in a Js-It layout", body
|
437
|
-
I18n.locale = :en
|
438
|
-
get "/bar.json"
|
439
|
-
assert_equal "Im a json", body
|
440
|
-
get "/bar.pk"
|
441
|
-
assert_equal 405, status
|
442
|
-
end
|
443
|
-
|
444
|
-
should 'renders erb with blocks' do
|
445
|
-
mock_app do
|
446
|
-
def container
|
447
|
-
@_out_buf << "THIS."
|
448
|
-
yield
|
449
|
-
@_out_buf << "SPARTA!"
|
450
|
-
end
|
451
|
-
def is; "IS."; end
|
452
|
-
get '/' do
|
453
|
-
render :erb, '<% container do %> <%= is %> <% end %>'
|
454
|
-
end
|
455
|
-
end
|
456
|
-
get '/'
|
457
|
-
assert ok?
|
458
|
-
assert_equal 'THIS. IS. SPARTA!', body
|
459
|
-
end
|
460
|
-
end
|
461
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
-
|
3
|
-
describe "Routing" do
|
4
|
-
should 'perform restul routing' do
|
5
|
-
mock_app do
|
6
|
-
controller :parent => :parents do
|
7
|
-
get :index do
|
8
|
-
"#{url_for(:index, params[:parent_id])} get"
|
9
|
-
end
|
10
|
-
|
11
|
-
put :index, :with => :asset_id do
|
12
|
-
"#{url_for(:index, params[:parent_id], :asset_id => params[:asset_id])} put"
|
13
|
-
end
|
14
|
-
|
15
|
-
post :index, :with => :asset_id do
|
16
|
-
"#{url_for(:index, :parent_id => params[:parent_id], :asset_id => params[:asset_id])} post"
|
17
|
-
end
|
18
|
-
|
19
|
-
delete :index, :with => :asset_id do
|
20
|
-
"#{url_for(:index, params[:parent_id], :asset_id => params[:asset_id])} delete"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
get "/parents/1"
|
25
|
-
assert_equal "/parents/1 get", body
|
26
|
-
put "/parents/1/hi"
|
27
|
-
assert_equal "/parents/1/hi put", body
|
28
|
-
post "/parents/1/hi"
|
29
|
-
assert_equal "/parents/1/hi post", body
|
30
|
-
delete "/parents/1/hi"
|
31
|
-
assert_equal "/parents/1/hi delete", body
|
32
|
-
end
|
33
|
-
end
|
@@ -1,146 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/fixtures/apps/simple')
|
3
|
-
|
4
|
-
describe "Router" do
|
5
|
-
|
6
|
-
def setup
|
7
|
-
Padrino.clear!
|
8
|
-
end
|
9
|
-
|
10
|
-
should "dispatch paths correctly" do
|
11
|
-
app = lambda { |env|
|
12
|
-
[200, {
|
13
|
-
'X-ScriptName' => env['SCRIPT_NAME'],
|
14
|
-
'X-PathInfo' => env['PATH_INFO'],
|
15
|
-
'Content-Type' => 'text/plain'
|
16
|
-
}, [""]]
|
17
|
-
}
|
18
|
-
map = Padrino::Router.new(
|
19
|
-
{ :path => '/bar', :to => app },
|
20
|
-
{ :path => '/foo', :to => app },
|
21
|
-
{ :path => '/foo/bar', :to => app }
|
22
|
-
)
|
23
|
-
|
24
|
-
res = Rack::MockRequest.new(map).get("/")
|
25
|
-
assert res.not_found?
|
26
|
-
|
27
|
-
res = Rack::MockRequest.new(map).get("/qux")
|
28
|
-
assert res.not_found?
|
29
|
-
|
30
|
-
res = Rack::MockRequest.new(map).get("/foo")
|
31
|
-
assert res.ok?
|
32
|
-
assert_equal "/foo", res["X-ScriptName"]
|
33
|
-
assert_equal "/", res["X-PathInfo"]
|
34
|
-
|
35
|
-
res = Rack::MockRequest.new(map).get("/foo/")
|
36
|
-
assert res.ok?
|
37
|
-
assert_equal "/foo", res["X-ScriptName"]
|
38
|
-
assert_equal "/", res["X-PathInfo"]
|
39
|
-
|
40
|
-
res = Rack::MockRequest.new(map).get("/foo/bar")
|
41
|
-
assert res.ok?
|
42
|
-
assert_equal "/foo/bar", res["X-ScriptName"]
|
43
|
-
assert_equal "/", res["X-PathInfo"]
|
44
|
-
|
45
|
-
res = Rack::MockRequest.new(map).get("/foo/bar/")
|
46
|
-
assert res.ok?
|
47
|
-
assert_equal "/foo/bar", res["X-ScriptName"]
|
48
|
-
assert_equal "/", res["X-PathInfo"]
|
49
|
-
|
50
|
-
res = Rack::MockRequest.new(map).get("/foo///bar//quux")
|
51
|
-
assert_equal 200, res.status
|
52
|
-
assert res.ok?
|
53
|
-
assert_equal "/foo/bar", res["X-ScriptName"]
|
54
|
-
assert_equal "//quux", res["X-PathInfo"]
|
55
|
-
|
56
|
-
res = Rack::MockRequest.new(map).get("/foo/quux", "SCRIPT_NAME" => "/bleh")
|
57
|
-
assert res.ok?
|
58
|
-
assert_equal "/bleh/foo", res["X-ScriptName"]
|
59
|
-
assert_equal "/quux", res["X-PathInfo"]
|
60
|
-
|
61
|
-
res = Rack::MockRequest.new(map).get("/bar", 'HTTP_HOST' => 'foo.org')
|
62
|
-
assert res.ok?
|
63
|
-
assert_equal "/bar", res["X-ScriptName"]
|
64
|
-
assert_equal "/", res["X-PathInfo"]
|
65
|
-
|
66
|
-
res = Rack::MockRequest.new(map).get("/bar/", 'HTTP_HOST' => 'foo.org')
|
67
|
-
assert res.ok?
|
68
|
-
assert_equal "/bar", res["X-ScriptName"]
|
69
|
-
assert_equal "/", res["X-PathInfo"]
|
70
|
-
end
|
71
|
-
|
72
|
-
should "dispatches hosts correctly" do
|
73
|
-
map = Padrino::Router.new(
|
74
|
-
{ :host => "foo.org", :to => lambda { |env|
|
75
|
-
[200,
|
76
|
-
{ "Content-Type" => "text/plain",
|
77
|
-
"X-Position" => "foo.org",
|
78
|
-
"X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
|
79
|
-
}, [""]]}},
|
80
|
-
{ :host => "subdomain.foo.org", :to => lambda { |env|
|
81
|
-
[200,
|
82
|
-
{ "Content-Type" => "text/plain",
|
83
|
-
"X-Position" => "subdomain.foo.org",
|
84
|
-
"X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
|
85
|
-
}, [""]]}},
|
86
|
-
{ :host => /.*\.bar.org/, :to => lambda { |env|
|
87
|
-
[200,
|
88
|
-
{ "Content-Type" => "text/plain",
|
89
|
-
"X-Position" => "bar.org",
|
90
|
-
"X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
|
91
|
-
}, [""]]}}
|
92
|
-
)
|
93
|
-
|
94
|
-
res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "bar.org")
|
95
|
-
assert res.not_found?
|
96
|
-
|
97
|
-
res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "at.bar.org")
|
98
|
-
assert res.ok?
|
99
|
-
assert_equal "bar.org", res["X-Position"]
|
100
|
-
|
101
|
-
res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "foo.org")
|
102
|
-
assert res.ok?
|
103
|
-
assert_equal "foo.org", res["X-Position"]
|
104
|
-
|
105
|
-
res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "subdomain.foo.org", "SERVER_NAME" => "foo.org")
|
106
|
-
assert res.ok?
|
107
|
-
assert_equal "subdomain.foo.org", res["X-Position"]
|
108
|
-
end
|
109
|
-
|
110
|
-
should "works with padrino core applications" do
|
111
|
-
Padrino.mount("simple_demo").host("padrino.org")
|
112
|
-
assert_equal ["simple_demo"], Padrino.mounted_apps.map(&:name)
|
113
|
-
assert_equal ["padrino.org"], Padrino.mounted_apps.map(&:app_host)
|
114
|
-
|
115
|
-
res = Rack::MockRequest.new(Padrino.application).get("/")
|
116
|
-
assert res.not_found?
|
117
|
-
|
118
|
-
res = Rack::MockRequest.new(Padrino.application).get("/", "HTTP_HOST" => "bar.org")
|
119
|
-
assert res.not_found?
|
120
|
-
|
121
|
-
res = Rack::MockRequest.new(Padrino.application).get("/", "HTTP_HOST" => "padrino.org")
|
122
|
-
assert res.ok?
|
123
|
-
end
|
124
|
-
|
125
|
-
should "works with padrino applications" do
|
126
|
-
Padrino.mount("simple_demo").to("/foo").host(/.*\.padrino.org/)
|
127
|
-
|
128
|
-
res = Rack::MockRequest.new(Padrino.application).get("/")
|
129
|
-
assert res.not_found?
|
130
|
-
|
131
|
-
res = Rack::MockRequest.new(Padrino.application).get("/", "HTTP_HOST" => "bar.org")
|
132
|
-
assert res.not_found?
|
133
|
-
|
134
|
-
res = Rack::MockRequest.new(Padrino.application).get("/", "HTTP_HOST" => "padrino.org")
|
135
|
-
assert res.not_found?
|
136
|
-
|
137
|
-
res = Rack::MockRequest.new(Padrino.application).get("/none", "HTTP_HOST" => "foo.padrino.org")
|
138
|
-
assert res.not_found?
|
139
|
-
|
140
|
-
res = Rack::MockRequest.new(Padrino.application).get("/foo", "HTTP_HOST" => "bar.padrino.org")
|
141
|
-
assert res.ok?
|
142
|
-
|
143
|
-
res = Rack::MockRequest.new(Padrino.application).get("/foo/", "HTTP_HOST" => "bar.padrino.org")
|
144
|
-
assert res.ok?
|
145
|
-
end
|
146
|
-
end
|