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,154 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
-
require 'lumberjack'
|
3
|
-
require 'logger'
|
4
|
-
|
5
|
-
describe "PadrinoLogger" do
|
6
|
-
|
7
|
-
def setup
|
8
|
-
Padrino::Logger::Config[:test][:stream] = :null # The default
|
9
|
-
Padrino::Logger.setup!
|
10
|
-
end
|
11
|
-
|
12
|
-
def setup_logger(options={})
|
13
|
-
@log = StringIO.new
|
14
|
-
@logger = Padrino::Logger.new(options.merge(:stream => @log))
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'for logger functionality' do
|
18
|
-
|
19
|
-
context 'check stream config' do
|
20
|
-
|
21
|
-
should 'use stdout if stream is nil' do
|
22
|
-
Padrino::Logger::Config[:test][:stream] = nil
|
23
|
-
Padrino::Logger.setup!
|
24
|
-
assert_equal $stdout, Padrino.logger.log
|
25
|
-
end
|
26
|
-
|
27
|
-
should 'use StringIO as default for test' do
|
28
|
-
assert_instance_of StringIO, Padrino.logger.log
|
29
|
-
end
|
30
|
-
|
31
|
-
should 'use a custom stream' do
|
32
|
-
my_stream = StringIO.new
|
33
|
-
Padrino::Logger::Config[:test][:stream] = my_stream
|
34
|
-
Padrino::Logger.setup!
|
35
|
-
assert_equal my_stream, Padrino.logger.log
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
should 'log something' do
|
40
|
-
setup_logger(:log_level => :error)
|
41
|
-
@logger.error "You log this error?"
|
42
|
-
assert_match(/You log this error?/, @log.string)
|
43
|
-
@logger.debug "You don't log this error!"
|
44
|
-
assert_no_match(/You don't log this error!/, @log.string)
|
45
|
-
@logger << "Yep this can be logged"
|
46
|
-
assert_match(/Yep this can be logged/, @log.string)
|
47
|
-
end
|
48
|
-
|
49
|
-
should 'respond to #write for Rack::CommonLogger' do
|
50
|
-
setup_logger(:log_level => :error)
|
51
|
-
@logger.error "Error message"
|
52
|
-
assert_match /Error message/, @log.string
|
53
|
-
@logger << "logged anyways"
|
54
|
-
assert_match /logged anyways/, @log.string
|
55
|
-
@logger.write "log via alias"
|
56
|
-
assert_match /log via alias/, @log.string
|
57
|
-
end
|
58
|
-
|
59
|
-
should 'log an application' do
|
60
|
-
mock_app do
|
61
|
-
enable :logging
|
62
|
-
get("/"){ "Foo" }
|
63
|
-
end
|
64
|
-
get "/"
|
65
|
-
assert_equal "Foo", body
|
66
|
-
assert_match /GET/, Padrino.logger.log.string
|
67
|
-
end
|
68
|
-
|
69
|
-
should 'log an application\'s status code' do
|
70
|
-
mock_app do
|
71
|
-
enable :logging
|
72
|
-
get("/"){ "Foo" }
|
73
|
-
end
|
74
|
-
get "/"
|
75
|
-
assert_match /\e\[1m200\e\[0m OK/, Padrino.logger.log.string
|
76
|
-
end
|
77
|
-
|
78
|
-
context "static asset logging" do
|
79
|
-
should 'not log static assets by default' do
|
80
|
-
mock_app do
|
81
|
-
enable :logging
|
82
|
-
get("/images/something.png"){ env["sinatra.static_file"] = '/public/images/something.png'; "Foo" }
|
83
|
-
end
|
84
|
-
get "/images/something.png"
|
85
|
-
assert_equal "Foo", body
|
86
|
-
assert_match "", Padrino.logger.log.string
|
87
|
-
end
|
88
|
-
|
89
|
-
should 'allow turning on static assets logging' do
|
90
|
-
Padrino.logger.instance_eval{ @log_static = true }
|
91
|
-
mock_app do
|
92
|
-
enable :logging
|
93
|
-
get("/images/something.png"){ env["sinatra.static_file"] = '/public/images/something.png'; "Foo" }
|
94
|
-
end
|
95
|
-
get "/images/something.png"
|
96
|
-
assert_equal "Foo", body
|
97
|
-
assert_match /GET/, Padrino.logger.log.string
|
98
|
-
Padrino.logger.instance_eval{ @log_static = false }
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
describe "alternate logger: Lumberjack" do
|
105
|
-
def setup_logger
|
106
|
-
@log = StringIO.new
|
107
|
-
Padrino.logger = Lumberjack::Logger.new(@log, :level => :debug)
|
108
|
-
end
|
109
|
-
|
110
|
-
should "annotate the logger to support additional Padrino fancyness" do
|
111
|
-
setup_logger
|
112
|
-
Padrino.logger.debug("Debug message")
|
113
|
-
assert_match(/Debug message/, @log.string)
|
114
|
-
end
|
115
|
-
|
116
|
-
should "colorize log output after colorize! is called" do
|
117
|
-
setup_logger
|
118
|
-
Padrino.logger.colorize!
|
119
|
-
|
120
|
-
mock_app do
|
121
|
-
enable :logging
|
122
|
-
get("/"){ "Foo" }
|
123
|
-
end
|
124
|
-
get "/"
|
125
|
-
|
126
|
-
assert_match /\e\[1m200\e\[0m OK/, @log.string
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
describe "alternate logger: stdlib logger" do
|
131
|
-
def setup_logger
|
132
|
-
@log = StringIO.new
|
133
|
-
Padrino.logger = Logger.new(@log)
|
134
|
-
end
|
135
|
-
|
136
|
-
should "annotate the logger to support additional Padrino fancyness" do
|
137
|
-
setup_logger
|
138
|
-
Padrino.logger.debug("Debug message")
|
139
|
-
assert_match(/Debug message/, @log.string)
|
140
|
-
end
|
141
|
-
|
142
|
-
should "colorize log output after colorize! is called" do
|
143
|
-
setup_logger
|
144
|
-
Padrino.logger.colorize!
|
145
|
-
|
146
|
-
mock_app do
|
147
|
-
enable :logging
|
148
|
-
get("/"){ "Foo" }
|
149
|
-
end
|
150
|
-
get "/"
|
151
|
-
|
152
|
-
assert_match /\e\[1m200\e\[0m OK/, @log.string
|
153
|
-
end
|
154
|
-
end
|
@@ -1,177 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
-
|
3
|
-
describe "Mounter" do
|
4
|
-
class ::TestApp < Padrino::Application; end
|
5
|
-
|
6
|
-
def setup
|
7
|
-
$VERBOSE, @_verbose_was = nil, $VERBOSE
|
8
|
-
Padrino.clear!
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown
|
12
|
-
$VERBOSE = @_verbose_was
|
13
|
-
end
|
14
|
-
|
15
|
-
context 'for mounter functionality' do
|
16
|
-
should 'check methods' do
|
17
|
-
mounter = Padrino::Mounter.new("test_app", :app_file => "/path/to/test.rb")
|
18
|
-
mounter.to("/test_app")
|
19
|
-
assert_kind_of Padrino::Mounter, mounter
|
20
|
-
assert_respond_to Padrino::Mounter, :new
|
21
|
-
assert_respond_to mounter, :to
|
22
|
-
assert_respond_to mounter, :map_onto
|
23
|
-
assert_equal "test_app", mounter.name
|
24
|
-
assert_equal "TestApp", mounter.app_class
|
25
|
-
assert_equal "/path/to/test.rb", mounter.app_file
|
26
|
-
assert_equal "/test_app", mounter.uri_root
|
27
|
-
assert_equal File.dirname(mounter.app_file), mounter.app_root
|
28
|
-
end
|
29
|
-
|
30
|
-
should 'check locate_app_file with __FILE__' do
|
31
|
-
mounter = Padrino::Mounter.new("test_app", :app_file => __FILE__)
|
32
|
-
mounter.to("/test_app")
|
33
|
-
assert_equal "test_app", mounter.name
|
34
|
-
assert_equal "TestApp", mounter.app_class
|
35
|
-
assert_equal __FILE__, mounter.app_file
|
36
|
-
assert_equal "/test_app", mounter.uri_root
|
37
|
-
assert_equal File.dirname(mounter.app_file), mounter.app_root
|
38
|
-
end
|
39
|
-
|
40
|
-
should 'mount an app' do
|
41
|
-
class ::AnApp < Padrino::Application; end
|
42
|
-
Padrino.mount("an_app").to("/")
|
43
|
-
assert_equal AnApp, Padrino.mounted_apps.first.app_obj
|
44
|
-
assert_equal ["an_app"], Padrino.mounted_apps.map(&:name)
|
45
|
-
end
|
46
|
-
|
47
|
-
should 'correctly mount an app in a namespace' do
|
48
|
-
module ::SomeNamespace
|
49
|
-
class AnApp < Padrino::Application; end
|
50
|
-
end
|
51
|
-
Padrino.mount("some_namespace/an_app").to("/")
|
52
|
-
assert_equal SomeNamespace::AnApp, Padrino.mounted_apps.first.app_obj
|
53
|
-
assert_equal ["some_namespace/an_app"], Padrino.mounted_apps.map(&:name)
|
54
|
-
end
|
55
|
-
|
56
|
-
should 'mount a primary app to root uri' do
|
57
|
-
mounter = Padrino.mount("test_app", :app_file => __FILE__).to("/")
|
58
|
-
assert_equal "test_app", mounter.name
|
59
|
-
assert_equal "TestApp", mounter.app_class
|
60
|
-
assert_equal TestApp, mounter.app_obj
|
61
|
-
assert_equal __FILE__, mounter.app_file
|
62
|
-
assert_equal "/", mounter.uri_root
|
63
|
-
assert_equal File.dirname(mounter.app_file), mounter.app_root
|
64
|
-
end
|
65
|
-
|
66
|
-
should 'mount a primary app to sub_uri' do
|
67
|
-
mounter = Padrino.mount("test_app", :app_file => __FILE__).to('/me')
|
68
|
-
assert_equal "test_app", mounter.name
|
69
|
-
assert_equal "TestApp", mounter.app_class
|
70
|
-
assert_equal TestApp, mounter.app_obj
|
71
|
-
assert_equal __FILE__, mounter.app_file
|
72
|
-
assert_equal "/me", mounter.uri_root
|
73
|
-
assert_equal File.dirname(mounter.app_file), mounter.app_root
|
74
|
-
end
|
75
|
-
|
76
|
-
should "raise error when app has no located file" do
|
77
|
-
# TODO enabling this screws minitest
|
78
|
-
# assert_raises(Padrino::Mounter::MounterException) { Padrino.mount("tester_app").to('/test') }
|
79
|
-
assert_equal 0, Padrino.mounted_apps.size
|
80
|
-
end
|
81
|
-
|
82
|
-
should "raise error when app has no located object" do
|
83
|
-
assert_raises(Padrino::Mounter::MounterException) { Padrino.mount("tester_app", :app_file => "/path/to/file.rb").to('/test') }
|
84
|
-
assert_equal 0, Padrino.mounted_apps.size
|
85
|
-
end
|
86
|
-
|
87
|
-
should 'mount multiple apps' do
|
88
|
-
class ::OneApp < Padrino::Application; end
|
89
|
-
class ::TwoApp < Padrino::Application; end
|
90
|
-
|
91
|
-
Padrino.mount("one_app").to("/one_app")
|
92
|
-
Padrino.mount("two_app").to("/two_app")
|
93
|
-
# And testing no duplicates
|
94
|
-
Padrino.mount("one_app").to("/one_app")
|
95
|
-
Padrino.mount("two_app").to("/two_app")
|
96
|
-
|
97
|
-
assert_equal OneApp, Padrino.mounted_apps[0].app_obj
|
98
|
-
assert_equal TwoApp, Padrino.mounted_apps[1].app_obj
|
99
|
-
assert_equal 2, Padrino.mounted_apps.size, "should not mount duplicate apps"
|
100
|
-
assert_equal ["one_app", "two_app"], Padrino.mounted_apps.map(&:name)
|
101
|
-
end
|
102
|
-
|
103
|
-
should 'change mounted_root' do
|
104
|
-
Padrino.mounted_root = "fixtures"
|
105
|
-
assert_equal Padrino.root("fixtures", "test", "app.rb"), Padrino.mounted_root("test", "app.rb")
|
106
|
-
Padrino.mounted_root = "apps"
|
107
|
-
assert_equal Padrino.root("apps", "test", "app.rb"), Padrino.mounted_root("test", "app.rb")
|
108
|
-
Padrino.mounted_root = nil
|
109
|
-
assert_equal Padrino.root("test", "app.rb"), Padrino.mounted_root("test", "app.rb")
|
110
|
-
end
|
111
|
-
|
112
|
-
should "be able to access routes data for mounted apps" do
|
113
|
-
class ::OneApp < Padrino::Application
|
114
|
-
get("/test") { "test" }
|
115
|
-
get(:index, :provides => [:js, :json]) { "index" }
|
116
|
-
controllers :posts do
|
117
|
-
get(:index) { "index" }
|
118
|
-
get(:new, :provides => :js) { "new" }
|
119
|
-
get(:show, :provides => [:js, :html], :with => :id) { "show" }
|
120
|
-
post(:create, :provides => :js, :with => :id) { "create" }
|
121
|
-
end
|
122
|
-
end
|
123
|
-
class ::TwoApp < Padrino::Application
|
124
|
-
controllers :users do
|
125
|
-
get(:index) { "users" }
|
126
|
-
get(:new) { "users new" }
|
127
|
-
post(:create) { "users create" }
|
128
|
-
put(:update) { "users update" }
|
129
|
-
delete(:destroy) { "users delete" }
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
Padrino.mount("one_app").to("/")
|
134
|
-
Padrino.mount("two_app").to("/two_app")
|
135
|
-
|
136
|
-
assert_equal 11, Padrino.mounted_apps[0].routes.size
|
137
|
-
assert_equal 7, Padrino.mounted_apps[1].routes.size
|
138
|
-
assert_equal 5, Padrino.mounted_apps[0].named_routes.size
|
139
|
-
assert_equal 5, Padrino.mounted_apps[1].named_routes.size
|
140
|
-
|
141
|
-
first_route = Padrino.mounted_apps[0].named_routes[3]
|
142
|
-
assert_equal "posts_show", first_route.identifier.to_s
|
143
|
-
assert_equal "(:posts, :show)", first_route.name
|
144
|
-
assert_equal "GET", first_route.verb
|
145
|
-
assert_equal "/posts/show/:id(.:format)", first_route.path
|
146
|
-
another_route = Padrino.mounted_apps[1].named_routes[2]
|
147
|
-
assert_equal "users_create", another_route.identifier.to_s
|
148
|
-
assert_equal "(:users, :create)", another_route.name
|
149
|
-
assert_equal "POST", another_route.verb
|
150
|
-
assert_equal "/two_app/users/create", another_route.path
|
151
|
-
end
|
152
|
-
|
153
|
-
should 'correctly instantiate a new padrino application' do
|
154
|
-
mock_app do
|
155
|
-
get("/demo_1"){ "Im Demo 1" }
|
156
|
-
get("/demo_2"){ "Im Demo 2" }
|
157
|
-
end
|
158
|
-
|
159
|
-
get '/demo_1'
|
160
|
-
assert_equal "Im Demo 1", response.body
|
161
|
-
get '/demo_2'
|
162
|
-
assert_equal "Im Demo 2", response.body
|
163
|
-
end
|
164
|
-
|
165
|
-
should "not clobber the public setting when mounting an app" do
|
166
|
-
class ::PublicApp < Padrino::Application
|
167
|
-
set :root, "/root"
|
168
|
-
set :public_folder, File.expand_path(File.dirname(__FILE__))
|
169
|
-
end
|
170
|
-
|
171
|
-
Padrino.mount("public_app").to("/public")
|
172
|
-
res = Rack::MockRequest.new(Padrino.application).get("/public/test_mounter.rb")
|
173
|
-
assert res.ok?
|
174
|
-
assert_equal File.read(__FILE__), res.body
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/fixtures/apps/complex')
|
3
|
-
|
4
|
-
describe "ComplexReloader" do
|
5
|
-
|
6
|
-
context 'for complex reload functionality' do
|
7
|
-
setup do
|
8
|
-
Padrino.clear!
|
9
|
-
Padrino.mount("complex_1_demo").to("/complex_1_demo")
|
10
|
-
Padrino.mount("complex_2_demo").to("/complex_2_demo")
|
11
|
-
end
|
12
|
-
|
13
|
-
should 'correctly instantiate Complex(1-2)Demo fixture' do
|
14
|
-
assert_equal ["/complex_1_demo", "/complex_2_demo"], Padrino.mounted_apps.map(&:uri_root)
|
15
|
-
assert_equal ["complex_1_demo", "complex_2_demo"], Padrino.mounted_apps.map(&:name)
|
16
|
-
assert Complex1Demo.reload?
|
17
|
-
assert Complex2Demo.reload?
|
18
|
-
assert_match %r{fixtures/apps/complex.rb}, Complex1Demo.app_file
|
19
|
-
assert_match %r{fixtures/apps/complex.rb}, Complex2Demo.app_file
|
20
|
-
end
|
21
|
-
|
22
|
-
should 'correctly reload Complex(1-2)Demo fixture' do
|
23
|
-
assert_match %r{fixtures/apps/complex.rb}, Complex1Demo.app_file
|
24
|
-
@app = Padrino.application
|
25
|
-
|
26
|
-
get "/"
|
27
|
-
assert_equal 404, status
|
28
|
-
|
29
|
-
get "/complex_1_demo"
|
30
|
-
assert_equal "Given random #{LibDemo.give_me_a_random}", body
|
31
|
-
|
32
|
-
get "/complex_2_demo"
|
33
|
-
assert_equal 200, status
|
34
|
-
|
35
|
-
get "/complex_1_demo/old"
|
36
|
-
assert_equal 200, status
|
37
|
-
|
38
|
-
get "/complex_2_demo/old"
|
39
|
-
assert_equal 200, status
|
40
|
-
|
41
|
-
get "/complex_2_demo/var/destroy"
|
42
|
-
assert_equal '{}', body
|
43
|
-
|
44
|
-
new_phrase = "The magick number is: #{rand(2**255)}!"
|
45
|
-
buffer = File.read(Complex1Demo.app_file)
|
46
|
-
new_buffer = buffer.gsub(/The magick number is: \d+!/, new_phrase)
|
47
|
-
new_buffer.gsub!(/get\(:destroy\)/, 'get(:destroy, :with => :id)')
|
48
|
-
begin
|
49
|
-
File.open(Complex1Demo.app_file, "w") { |f| f.write(new_buffer) }
|
50
|
-
sleep 1.2 # We need at least a cooldown of 1 sec.
|
51
|
-
get "/complex_2_demo"
|
52
|
-
assert_equal new_phrase, body
|
53
|
-
|
54
|
-
# Re-Check that we didn't forget any route
|
55
|
-
get "/complex_1_demo"
|
56
|
-
assert_equal "Given random #{LibDemo.give_me_a_random}", body
|
57
|
-
|
58
|
-
get "/complex_2_demo"
|
59
|
-
assert_equal 200, status
|
60
|
-
|
61
|
-
get "/complex_1_demo/old"
|
62
|
-
assert_equal 200, status
|
63
|
-
|
64
|
-
get "/complex_2_demo/old"
|
65
|
-
assert_equal 200, status
|
66
|
-
|
67
|
-
get "/complex_2_demo/var/destroy/variable"
|
68
|
-
assert_equal '{:id=>"variable"}', body
|
69
|
-
ensure
|
70
|
-
# Now we need to prevent to commit a new changed file so we revert it
|
71
|
-
File.open(Complex1Demo.app_file, "w") { |f| f.write(buffer) }
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,98 +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 "SimpleReloader" do
|
5
|
-
|
6
|
-
context 'for simple reset functionality' do
|
7
|
-
|
8
|
-
should 'reset routes' do
|
9
|
-
mock_app do
|
10
|
-
(1..10).each do |i|
|
11
|
-
get("/#{i}") { "Foo #{i}" }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
(1..10).each do |i|
|
15
|
-
get "/#{i}"
|
16
|
-
assert_equal "Foo #{i}", body
|
17
|
-
end
|
18
|
-
@app.reset_routes!
|
19
|
-
(1..10).each do |i|
|
20
|
-
get "/#{i}"
|
21
|
-
assert_equal 404, status
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
should 'keep sinatra routes on development' do
|
26
|
-
mock_app do
|
27
|
-
set :environment, :development
|
28
|
-
get("/"){ "ok" }
|
29
|
-
end
|
30
|
-
assert_equal :development, @app.environment
|
31
|
-
get "/"
|
32
|
-
assert_equal 200, status
|
33
|
-
get "/__sinatra__/404.png"
|
34
|
-
assert_equal 200, status
|
35
|
-
assert_match /image\/png/, response["Content-Type"]
|
36
|
-
@app.reset_routes!
|
37
|
-
get "/"
|
38
|
-
assert_equal 404, status
|
39
|
-
get "/__sinatra__/404.png"
|
40
|
-
assert_equal 200, status
|
41
|
-
assert_match /image\/png/, response["Content-Type"]
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'for simple reload functionality' do
|
46
|
-
|
47
|
-
should 'correctly instantiate SimpleDemo fixture' do
|
48
|
-
Padrino.clear!
|
49
|
-
Padrino.mount("simple_demo").to("/")
|
50
|
-
assert_equal ["simple_demo"], Padrino.mounted_apps.map(&:name)
|
51
|
-
assert SimpleDemo.reload?
|
52
|
-
assert_match %r{fixtures/apps/simple.rb}, SimpleDemo.app_file
|
53
|
-
end
|
54
|
-
|
55
|
-
should_eventually 'correctly reload SimpleDemo fixture' do
|
56
|
-
# TODO fix this test
|
57
|
-
@app = SimpleDemo
|
58
|
-
get "/"
|
59
|
-
assert ok?
|
60
|
-
new_phrase = "The magick number is: #{rand(2**255)}!"
|
61
|
-
buffer = File.read(SimpleDemo.app_file)
|
62
|
-
new_buffer = buffer.gsub(/The magick number is: \d+!/, new_phrase)
|
63
|
-
File.open(SimpleDemo.app_file, "w") { |f| f.write(new_buffer) }
|
64
|
-
sleep 2 # We need at least a cooldown of 1 sec.
|
65
|
-
get "/"
|
66
|
-
assert_equal new_phrase, body
|
67
|
-
|
68
|
-
# Now we need to prevent to commit a new changed file so we revert it
|
69
|
-
File.open(SimpleDemo.app_file, "w") { |f| f.write(buffer) }
|
70
|
-
Padrino.reload!
|
71
|
-
end
|
72
|
-
|
73
|
-
should 'correctly reset SimpleDemo fixture' do
|
74
|
-
@app = SimpleDemo
|
75
|
-
@app.reload!
|
76
|
-
get "/rand"
|
77
|
-
assert ok?
|
78
|
-
last_body = body
|
79
|
-
assert_equal 2, @app.filters[:before].size # one is ours the other is default_filter for content type
|
80
|
-
assert_equal 1, @app.errors.size
|
81
|
-
assert_equal 1, @app.filters[:after].size
|
82
|
-
assert_equal 0, @app.middleware.size
|
83
|
-
assert_equal 4, @app.routes.size # GET+HEAD of "/" + GET+HEAD of "/rand" = 4
|
84
|
-
assert_equal 2, @app.extensions.size # [Padrino::Routing, Padrino::Rendering]
|
85
|
-
assert_equal 0, @app.templates.size
|
86
|
-
@app.reload!
|
87
|
-
get "/rand"
|
88
|
-
assert_not_equal last_body, body
|
89
|
-
assert_equal 2, @app.filters[:before].size # one is ours the other is default_filter for content type
|
90
|
-
assert_equal 1, @app.errors.size
|
91
|
-
assert_equal 1, @app.filters[:after].size
|
92
|
-
assert_equal 0, @app.middleware.size
|
93
|
-
assert_equal 4, @app.routes.size # GET+HEAD of "/" = 2
|
94
|
-
assert_equal 2, @app.extensions.size # [Padrino::Routing, Padrino::Rendering]
|
95
|
-
assert_equal 0, @app.templates.size
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|