thorero 0.9.4.4 → 0.9.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +1 -1
- data/README +21 -0
- data/Rakefile +275 -108
- data/TODO +0 -0
- data/bin/merb +12 -0
- data/bin/merb-specs +5 -0
- data/docs/bootloading.dox +58 -0
- data/docs/documentation_standards +40 -0
- data/docs/merb-core-call-stack-diagram.mmap +0 -0
- data/docs/merb-core-call-stack-diagram.pdf +0 -0
- data/docs/merb-core-call-stack-diagram.png +0 -0
- data/docs/new_render_api +51 -0
- data/lib/merb-core.rb +603 -0
- data/lib/merb-core/autoload.rb +32 -0
- data/lib/merb-core/bootloader.rb +708 -0
- data/lib/merb-core/config.rb +303 -0
- data/lib/merb-core/constants.rb +43 -0
- data/lib/merb-core/controller/abstract_controller.rb +578 -0
- data/lib/merb-core/controller/exceptions.rb +302 -0
- data/lib/merb-core/controller/merb_controller.rb +256 -0
- data/lib/merb-core/controller/mime.rb +106 -0
- data/lib/merb-core/controller/mixins/authentication.rb +87 -0
- data/lib/merb-core/controller/mixins/controller.rb +290 -0
- data/lib/merb-core/controller/mixins/render.rb +481 -0
- data/lib/merb-core/controller/mixins/responder.rb +472 -0
- data/lib/merb-core/controller/template.rb +254 -0
- data/lib/merb-core/core_ext.rb +8 -0
- data/lib/merb-core/core_ext/kernel.rb +319 -0
- data/lib/merb-core/dispatch/cookies.rb +91 -0
- data/lib/merb-core/dispatch/dispatcher.rb +278 -0
- data/lib/merb-core/dispatch/exceptions.html.erb +303 -0
- data/lib/merb-core/dispatch/request.rb +603 -0
- data/lib/merb-core/dispatch/router.rb +179 -0
- data/lib/merb-core/dispatch/router/behavior.rb +867 -0
- data/lib/merb-core/dispatch/router/cached_proc.rb +52 -0
- data/lib/merb-core/dispatch/router/route.rb +321 -0
- data/lib/merb-core/dispatch/session.rb +78 -0
- data/lib/merb-core/dispatch/session/cookie.rb +168 -0
- data/lib/merb-core/dispatch/session/memcached.rb +184 -0
- data/lib/merb-core/dispatch/session/memory.rb +241 -0
- data/lib/merb-core/dispatch/worker.rb +28 -0
- data/lib/merb-core/gem_ext/erubis.rb +77 -0
- data/lib/{extlib → merb-core}/logger.rb +2 -2
- data/lib/merb-core/plugins.rb +59 -0
- data/lib/merb-core/rack.rb +21 -0
- data/lib/merb-core/rack/adapter.rb +44 -0
- data/lib/merb-core/rack/adapter/ebb.rb +25 -0
- data/lib/merb-core/rack/adapter/evented_mongrel.rb +26 -0
- data/lib/merb-core/rack/adapter/fcgi.rb +17 -0
- data/lib/merb-core/rack/adapter/irb.rb +118 -0
- data/lib/merb-core/rack/adapter/mongrel.rb +26 -0
- data/lib/merb-core/rack/adapter/runner.rb +28 -0
- data/lib/merb-core/rack/adapter/swiftiplied_mongrel.rb +26 -0
- data/lib/merb-core/rack/adapter/thin.rb +39 -0
- data/lib/merb-core/rack/adapter/thin_turbo.rb +24 -0
- data/lib/merb-core/rack/adapter/webrick.rb +36 -0
- data/lib/merb-core/rack/application.rb +18 -0
- data/lib/merb-core/rack/handler/mongrel.rb +97 -0
- data/lib/merb-core/rack/middleware.rb +26 -0
- data/lib/merb-core/rack/middleware/path_prefix.rb +31 -0
- data/lib/merb-core/rack/middleware/profiler.rb +19 -0
- data/lib/merb-core/rack/middleware/static.rb +45 -0
- data/lib/merb-core/server.rb +252 -0
- data/lib/merb-core/tasks/audit.rake +68 -0
- data/lib/merb-core/tasks/merb.rb +1 -0
- data/lib/merb-core/tasks/merb_rake_helper.rb +12 -0
- data/lib/merb-core/test.rb +11 -0
- data/lib/merb-core/test/helpers.rb +9 -0
- data/lib/merb-core/test/helpers/controller_helper.rb +8 -0
- data/lib/merb-core/test/helpers/multipart_request_helper.rb +175 -0
- data/lib/merb-core/test/helpers/request_helper.rb +344 -0
- data/lib/merb-core/test/helpers/route_helper.rb +33 -0
- data/lib/merb-core/test/helpers/view_helper.rb +121 -0
- data/lib/merb-core/test/matchers.rb +9 -0
- data/lib/merb-core/test/matchers/controller_matchers.rb +319 -0
- data/lib/merb-core/test/matchers/route_matchers.rb +136 -0
- data/lib/merb-core/test/matchers/view_matchers.rb +335 -0
- data/lib/merb-core/test/run_specs.rb +47 -0
- data/lib/merb-core/test/tasks/spectasks.rb +68 -0
- data/lib/merb-core/test/test_ext/hpricot.rb +32 -0
- data/lib/merb-core/test/test_ext/object.rb +14 -0
- data/lib/merb-core/test/test_ext/string.rb +14 -0
- data/lib/merb-core/vendor/facets.rb +2 -0
- data/lib/merb-core/vendor/facets/dictionary.rb +433 -0
- data/lib/merb-core/vendor/facets/inflect.rb +345 -0
- data/lib/merb-core/version.rb +11 -0
- data/spec/private/config/adapter_spec.rb +32 -0
- data/spec/private/config/config_spec.rb +202 -0
- data/spec/private/config/environment_spec.rb +13 -0
- data/spec/private/config/spec_helper.rb +1 -0
- data/spec/private/core_ext/kernel_spec.rb +169 -0
- data/spec/private/dispatch/bootloader_spec.rb +24 -0
- data/spec/private/dispatch/cookies_spec.rb +107 -0
- data/spec/private/dispatch/dispatch_spec.rb +35 -0
- data/spec/private/dispatch/fixture/app/controllers/application.rb +4 -0
- data/spec/private/dispatch/fixture/app/controllers/exceptions.rb +27 -0
- data/spec/private/dispatch/fixture/app/controllers/foo.rb +21 -0
- data/spec/private/dispatch/fixture/app/helpers/global_helpers.rb +8 -0
- data/spec/private/dispatch/fixture/app/views/exeptions/client_error.html.erb +37 -0
- data/spec/private/dispatch/fixture/app/views/exeptions/internal_server_error.html.erb +216 -0
- data/spec/private/dispatch/fixture/app/views/exeptions/not_acceptable.html.erb +38 -0
- data/spec/private/dispatch/fixture/app/views/exeptions/not_found.html.erb +40 -0
- data/spec/private/dispatch/fixture/app/views/foo/bar.html.erb +0 -0
- data/spec/private/dispatch/fixture/app/views/layout/application.html.erb +11 -0
- data/spec/private/dispatch/fixture/config/black_hole.rb +12 -0
- data/spec/private/dispatch/fixture/config/environments/development.rb +6 -0
- data/spec/private/dispatch/fixture/config/environments/production.rb +5 -0
- data/spec/private/dispatch/fixture/config/environments/test.rb +6 -0
- data/spec/private/dispatch/fixture/config/init.rb +45 -0
- data/spec/private/dispatch/fixture/config/rack.rb +11 -0
- data/spec/private/dispatch/fixture/config/router.rb +35 -0
- data/spec/private/dispatch/fixture/log/merb_test.log +1874 -0
- data/spec/private/dispatch/fixture/public/images/merb.jpg +0 -0
- data/spec/private/dispatch/fixture/public/merb.fcgi +4 -0
- data/spec/private/dispatch/fixture/public/stylesheets/master.css +119 -0
- data/spec/private/dispatch/route_params_spec.rb +24 -0
- data/spec/private/dispatch/session_mixin_spec.rb +47 -0
- data/spec/private/dispatch/spec_helper.rb +1 -0
- data/spec/private/plugins/plugin_spec.rb +166 -0
- data/spec/private/rack/application_spec.rb +49 -0
- data/spec/private/router/behavior_spec.rb +60 -0
- data/spec/private/router/fixture/log/merb_test.log +139 -0
- data/spec/private/router/route_spec.rb +414 -0
- data/spec/private/router/router_spec.rb +175 -0
- data/spec/private/vendor/facets/plural_spec.rb +564 -0
- data/spec/private/vendor/facets/singular_spec.rb +489 -0
- data/spec/public/DEFINITIONS +11 -0
- data/spec/public/abstract_controller/controllers/alt_views/layout/application.erb +1 -0
- data/spec/public/abstract_controller/controllers/alt_views/layout/merb/test/fixtures/abstract/render_string_controller_layout.erb +1 -0
- data/spec/public/abstract_controller/controllers/alt_views/layout/merb/test/fixtures/abstract/render_template_controller_layout.erb +1 -0
- data/spec/public/abstract_controller/controllers/alt_views/merb/test/fixtures/abstract/display_object_with_multiple_roots/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/alt_views/merb/test/fixtures/abstract/display_object_with_multiple_roots/show.erb +1 -0
- data/spec/public/abstract_controller/controllers/alt_views/merb/test/fixtures/abstract/render_template_multiple_roots/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/alt_views/partial/basic_partial_with_multiple_roots/_partial.erb +1 -0
- data/spec/public/abstract_controller/controllers/alt_views/render_template_multiple_roots_and_custom_location/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/alt_views/render_template_multiple_roots_inherited/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/cousins.rb +41 -0
- data/spec/public/abstract_controller/controllers/display.rb +54 -0
- data/spec/public/abstract_controller/controllers/filters.rb +193 -0
- data/spec/public/abstract_controller/controllers/helpers.rb +41 -0
- data/spec/public/abstract_controller/controllers/partial.rb +121 -0
- data/spec/public/abstract_controller/controllers/render.rb +113 -0
- data/spec/public/abstract_controller/controllers/views/helpers/capture/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/helpers/capture_eq/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/helpers/capture_with_args/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/helpers/concat/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/layout/alt.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/layout/custom.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/display_object/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/display_object_with_action/new.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_template/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_template_app_layout/index.erb +0 -0
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_template_custom_layout/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_template_multiple_roots/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_template_multiple_roots/show.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_two_throw_contents/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/another_directory/_partial.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/basic_partial/_partial.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/basic_partial/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/basic_partial_with_multiple_roots/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/nested_partial/_first.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/nested_partial/_second.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/nested_partial/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/partial_in_another_directory/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_both/_collection.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_both/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections/_collection.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_as/_collection.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_as/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_counter/_collection.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_counter/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_locals/_variables.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_locals/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_with_and_locals/_both.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_with_and_locals/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/with_absolute_partial/_partial.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/with_absolute_partial/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/with_as_partial/_with_partial.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/with_as_partial/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/with_nil_partial/_with_partial.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/with_nil_partial/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/with_partial/_with_partial.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/partial/with_partial/index.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/test_display/foo.html.erb +1 -0
- data/spec/public/abstract_controller/controllers/views/test_render/foo.html.erb +0 -0
- data/spec/public/abstract_controller/controllers/views/wonderful/index.erb +1 -0
- data/spec/public/abstract_controller/display_spec.rb +33 -0
- data/spec/public/abstract_controller/filter_spec.rb +106 -0
- data/spec/public/abstract_controller/helper_spec.rb +21 -0
- data/spec/public/abstract_controller/partial_spec.rb +61 -0
- data/spec/public/abstract_controller/render_spec.rb +90 -0
- data/spec/public/abstract_controller/spec_helper.rb +31 -0
- data/spec/public/boot_loader/boot_loader_spec.rb +33 -0
- data/spec/public/boot_loader/spec_helper.rb +1 -0
- data/spec/public/controller/authentication_spec.rb +103 -0
- data/spec/public/controller/base_spec.rb +36 -0
- data/spec/public/controller/controllers/authentication.rb +45 -0
- data/spec/public/controller/controllers/base.rb +36 -0
- data/spec/public/controller/controllers/display.rb +118 -0
- data/spec/public/controller/controllers/redirect.rb +30 -0
- data/spec/public/controller/controllers/responder.rb +93 -0
- data/spec/public/controller/controllers/url.rb +7 -0
- data/spec/public/controller/controllers/views/layout/custom.html.erb +1 -0
- data/spec/public/controller/controllers/views/layout/custom_arg.html.erb +1 -0
- data/spec/public/controller/controllers/views/layout/custom_arg.json.erb +1 -0
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_and_local_provides/index.html.erb +1 -0
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_and_local_provides/index.xml.erb +1 -0
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_provides/index.html.erb +1 -0
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_provides/index.xml.erb +1 -0
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/display_with_template/index.html.erb +1 -0
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/display_with_template/no_layout.html.erb +1 -0
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/display_with_template_argument/index.html.erb +1 -0
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/html_default/index.html.erb +1 -0
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/layout/custom.html.erb +1 -0
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/local_provides/index.html.erb +1 -0
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/local_provides/index.xml.erb +1 -0
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/multi_provides/index.html.erb +1 -0
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/multi_provides/index.js.erb +1 -0
- data/spec/public/controller/display_spec.rb +84 -0
- data/spec/public/controller/redirect_spec.rb +27 -0
- data/spec/public/controller/responder_spec.rb +163 -0
- data/spec/public/controller/spec_helper.rb +11 -0
- data/spec/public/controller/url_spec.rb +180 -0
- data/spec/public/core/merb_core_spec.rb +45 -0
- data/spec/public/core_ext/class_spec.rb +91 -0
- data/spec/public/core_ext/fixtures/core_ext_dependency.rb +2 -0
- data/spec/public/core_ext/kernel_spec.rb +9 -0
- data/spec/public/core_ext/spec_helper.rb +1 -0
- data/spec/public/directory_structure/directory/app/controllers/application.rb +3 -0
- data/spec/public/directory_structure/directory/app/controllers/base.rb +13 -0
- data/spec/public/directory_structure/directory/app/controllers/custom.rb +19 -0
- data/spec/public/directory_structure/directory/app/views/base/template.html.erb +1 -0
- data/spec/public/directory_structure/directory/app/views/wonderful/template.erb +1 -0
- data/spec/public/directory_structure/directory/config/router.rb +3 -0
- data/spec/public/directory_structure/directory/log/merb_test.log +562 -0
- data/spec/public/directory_structure/directory_spec.rb +44 -0
- data/spec/public/logger/logger_spec.rb +181 -0
- data/spec/public/logger/spec_helper.rb +1 -0
- data/spec/public/reloading/directory/app/controllers/application.rb +3 -0
- data/spec/public/reloading/directory/app/controllers/reload.rb +6 -0
- data/spec/public/reloading/directory/config/init.rb +2 -0
- data/spec/public/reloading/directory/log/merb_test.log +138 -0
- data/spec/public/reloading/reload_spec.rb +103 -0
- data/spec/public/request/multipart_spec.rb +41 -0
- data/spec/public/request/request_spec.rb +228 -0
- data/spec/public/router/default_spec.rb +21 -0
- data/spec/public/router/deferred_spec.rb +22 -0
- data/spec/public/router/fixation_spec.rb +27 -0
- data/spec/public/router/fixture/log/merb_test.log +1556 -0
- data/spec/public/router/namespace_spec.rb +113 -0
- data/spec/public/router/nested_matches_spec.rb +97 -0
- data/spec/public/router/nested_resources_spec.rb +41 -0
- data/spec/public/router/resource_spec.rb +37 -0
- data/spec/public/router/resources_spec.rb +82 -0
- data/spec/public/router/spec_helper.rb +90 -0
- data/spec/public/router/special_spec.rb +61 -0
- data/spec/public/router/string_spec.rb +61 -0
- data/spec/public/template/template_spec.rb +104 -0
- data/spec/public/template/templates/error.html.erb +2 -0
- data/spec/public/template/templates/template.html.erb +1 -0
- data/spec/public/template/templates/template.html.myt +1 -0
- data/spec/public/test/controller_matchers_spec.rb +402 -0
- data/spec/public/test/controllers/controller_assertion_mock.rb +7 -0
- data/spec/public/test/controllers/dispatch_controller.rb +11 -0
- data/spec/public/test/controllers/spec_helper_controller.rb +38 -0
- data/spec/public/test/multipart_request_helper_spec.rb +159 -0
- data/spec/public/test/multipart_upload_text_file.txt +1 -0
- data/spec/public/test/request_helper_spec.rb +221 -0
- data/spec/public/test/route_helper_spec.rb +71 -0
- data/spec/public/test/route_matchers_spec.rb +162 -0
- data/spec/public/test/view_helper_spec.rb +96 -0
- data/spec/public/test/view_matchers_spec.rb +183 -0
- data/spec/spec_helper.rb +68 -0
- metadata +493 -41
- data/README.txt +0 -3
- data/lib/extlib.rb +0 -32
- data/lib/extlib/assertions.rb +0 -8
- data/lib/extlib/blank.rb +0 -42
- data/lib/extlib/class.rb +0 -175
- data/lib/extlib/hash.rb +0 -410
- data/lib/extlib/hook.rb +0 -366
- data/lib/extlib/inflection.rb +0 -141
- data/lib/extlib/lazy_array.rb +0 -106
- data/lib/extlib/mash.rb +0 -143
- data/lib/extlib/module.rb +0 -37
- data/lib/extlib/object.rb +0 -165
- data/lib/extlib/object_space.rb +0 -13
- data/lib/extlib/pathname.rb +0 -5
- data/lib/extlib/pooling.rb +0 -233
- data/lib/extlib/rubygems.rb +0 -38
- data/lib/extlib/simple_set.rb +0 -39
- data/lib/extlib/string.rb +0 -132
- data/lib/extlib/struct.rb +0 -8
- data/lib/extlib/tasks/release.rb +0 -9
- data/lib/extlib/time.rb +0 -12
- data/lib/extlib/version.rb +0 -3
- data/lib/extlib/virtual_file.rb +0 -10
@@ -0,0 +1,113 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Merb::Test::Fixtures
|
4
|
+
|
5
|
+
module Abstract
|
6
|
+
|
7
|
+
class Testing < Merb::AbstractController
|
8
|
+
self._template_root = File.dirname(__FILE__) / "views"
|
9
|
+
end
|
10
|
+
|
11
|
+
class RenderTwoThrowContents < Testing
|
12
|
+
|
13
|
+
def index
|
14
|
+
render
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class RenderString < Testing
|
19
|
+
|
20
|
+
def index
|
21
|
+
render "the index"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class RenderStringCustomLayout < RenderString
|
26
|
+
layout :custom
|
27
|
+
end
|
28
|
+
|
29
|
+
class RenderStringAppLayout < RenderString
|
30
|
+
self._template_root = File.dirname(__FILE__) / "alt_views"
|
31
|
+
end
|
32
|
+
|
33
|
+
class RenderStringControllerLayout < RenderString
|
34
|
+
self._template_root = File.dirname(__FILE__) / "alt_views"
|
35
|
+
end
|
36
|
+
|
37
|
+
class RenderStringDynamicLayout < RenderString
|
38
|
+
layout :determine_layout
|
39
|
+
|
40
|
+
def alt_index
|
41
|
+
render "the alt index"
|
42
|
+
end
|
43
|
+
|
44
|
+
def determine_layout
|
45
|
+
action_name.index('alt') == 0 ? 'alt' : 'custom'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class RenderTemplate < Testing
|
50
|
+
|
51
|
+
def index
|
52
|
+
render
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class RenderTemplateCustomLayout < RenderString
|
57
|
+
layout :custom
|
58
|
+
end
|
59
|
+
|
60
|
+
class RenderTemplateAppLayout < RenderString
|
61
|
+
self._template_root = File.dirname(__FILE__) / "alt_views"
|
62
|
+
end
|
63
|
+
|
64
|
+
class RenderTemplateControllerLayout < RenderString
|
65
|
+
self._template_root = File.dirname(__FILE__) / "alt_views"
|
66
|
+
end
|
67
|
+
|
68
|
+
class RenderNoDefaultAppLayout < RenderString
|
69
|
+
self._template_root = File.dirname(__FILE__) / "alt_views"
|
70
|
+
self.layout false
|
71
|
+
end
|
72
|
+
|
73
|
+
class RenderNoDefaultAppLayoutInherited < RenderNoDefaultAppLayout
|
74
|
+
end
|
75
|
+
|
76
|
+
class RenderDefaultAppLayoutInheritedOverride < RenderNoDefaultAppLayout
|
77
|
+
self.default_layout
|
78
|
+
end
|
79
|
+
|
80
|
+
class RenderTemplateCustomLocation < RenderTemplate
|
81
|
+
def _template_location(context, type = nil, controller = controller_name)
|
82
|
+
"wonderful/#{context}"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
class RenderTemplateAbsolutePath < RenderTemplate
|
87
|
+
|
88
|
+
def index
|
89
|
+
render :template => File.expand_path(self._template_root) / 'wonderful' / 'index'
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
class RenderTemplateMultipleRoots < RenderTemplate
|
95
|
+
self._template_roots << [File.dirname(__FILE__) / "alt_views", :_template_location]
|
96
|
+
|
97
|
+
def show
|
98
|
+
render :layout => false
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
class RenderTemplateMultipleRootsAndCustomLocation < RenderTemplate
|
103
|
+
self._template_roots = [[File.dirname(__FILE__) / "alt_views", :_custom_template_location]]
|
104
|
+
|
105
|
+
def _custom_template_location(context, type = nil, controller = controller_name)
|
106
|
+
"#{self.class.name.split('::')[-1].to_const_path}/#{context}"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
class RenderTemplateMultipleRootsInherited < RenderTemplateMultipleRootsAndCustomLocation
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<% x = capture do -%>Capture<% end -%><%= x %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Pre. <%= helper_using_capture do %>Capturing<% end =%>. Post.
|
@@ -0,0 +1 @@
|
|
1
|
+
<% x = capture('one', 'two') do |one, two| -%>Capture: <%= one %>, <%= two %><% end -%><%= x %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<% concatter do -%>Hello<% end -%>
|
@@ -0,0 +1 @@
|
|
1
|
+
Alt: <%= catch_content(:for_layout) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Custom: <%= catch_content(:for_layout) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
the index
|
@@ -0,0 +1 @@
|
|
1
|
+
new action
|
@@ -0,0 +1 @@
|
|
1
|
+
the index
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
the index
|
@@ -0,0 +1 @@
|
|
1
|
+
This is overriden by the custom template root
|
@@ -0,0 +1 @@
|
|
1
|
+
default show
|
@@ -0,0 +1 @@
|
|
1
|
+
<% throw_content(:foo, "Foo") %><% throw_content(:foo, "Bar") %><%= catch_content(:foo) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Partial in another directory
|
@@ -0,0 +1 @@
|
|
1
|
+
Partial
|
@@ -0,0 +1 @@
|
|
1
|
+
Index <%= partial :partial %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Base Index: <%= partial :partial %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= msg %> <%= partial 'second', :another => 'second' %> <%= msg %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= another %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= partial 'first', :msg => 'first' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Index <%= partial 'another_directory/partial' %>
|
data/spec/public/abstract_controller/controllers/views/partial/partial_with_both/_collection.erb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<%= letter %><%= delimiter %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Partial with <%= partial :collection, :with => @foo, :as => :letter, :delimiter => @delimiter %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= collection %>
|
data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections/index.erb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Partial with <%= partial :collection, :with => @foo %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= letter %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Partial with <%= partial :collection, :with => @foo, :as => :letter %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= collection_index %>/<%= collection_size %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Partial counting: <%= partial :collection, :with => @foo %>
|
data/spec/public/abstract_controller/controllers/views/partial/partial_with_locals/_variables.erb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<%= local %> <%= variables %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Partial with <%= partial :variables, :local => @foo, :variables => @bar %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= first %> <%= second %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Partial with <%= partial :both, :with => @foo, :as => :first, :second => @bar %>
|
data/spec/public/abstract_controller/controllers/views/partial/with_absolute_partial/_partial.erb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Absolute Partial
|
data/spec/public/abstract_controller/controllers/views/partial/with_absolute_partial/index.erb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Index <%= partial @absolute_partial_path %>
|
data/spec/public/abstract_controller/controllers/views/partial/with_as_partial/_with_partial.erb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<%= w00t %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Partial with <%= partial :with_partial, :with => @foo, :as => :w00t %>
|
data/spec/public/abstract_controller/controllers/views/partial/with_nil_partial/_with_partial.erb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<%= with_partial || "nil local" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Partial with <%= partial :with_partial, :with => nil %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= with_partial || "nil local" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Partial with <%= partial :with_partial, :with => @foo %>
|
@@ -0,0 +1 @@
|
|
1
|
+
fooness
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
Wonderful
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "spec_helper")
|
2
|
+
|
3
|
+
describe Merb::AbstractController, " displaying objects with templates" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
Merb.push_path(:layout, File.dirname(__FILE__) / "controllers" / "views" / "layouts")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should allow you to pass an object" do
|
10
|
+
dispatch_should_make_body("DisplayObject", "the index")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should allow you to pass an object with an action specified" do
|
14
|
+
dispatch_should_make_body("DisplayObjectWithAction", "new action", :create)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should allow you to pass an object with a path specified for the template" do
|
18
|
+
dispatch_should_make_body("DisplayObjectWithPath", "fooness")
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should allow you to pass an object using multiple template root" do
|
22
|
+
dispatch_should_make_body("DisplayObjectWithMultipleRoots", "App: new index")
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should allow you to pass an object using multiple template root, with layout" do
|
26
|
+
dispatch_should_make_body("DisplayObjectWithMultipleRoots", "Alt: new show", "show")
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should allow you to pass an object using multiple template root, without layout" do
|
30
|
+
dispatch_should_make_body("DisplayObjectWithMultipleRoots", "fooness", "another")
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# ==== Public API
|
2
|
+
# Merb::AbstractController.before(filter<Symbol, Proc>, opts<Hash>)
|
3
|
+
# Merb::AbstractController.after(filter<Symbol, Proc>, opts<Hash>)
|
4
|
+
# Merb::AbstractController.skip_before(filter<Symbol>)
|
5
|
+
# Merb::AbstractController.skip_after(filter<Symbol>)
|
6
|
+
#
|
7
|
+
# ==== Semipublic API
|
8
|
+
# Merb::AbstractController#_body
|
9
|
+
# Merb::AbstractController#_dispatch(action<~to_s>)
|
10
|
+
|
11
|
+
require File.join(File.dirname(__FILE__), "spec_helper")
|
12
|
+
|
13
|
+
describe Merb::AbstractController, " should support before and after filters" do
|
14
|
+
|
15
|
+
it "should support before filters" do
|
16
|
+
dispatch_should_make_body("TestBeforeFilter", "foo filter")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should support after filters" do
|
20
|
+
dispatch_should_make_body("TestAfterFilter", "foo filter")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should support skipping filters that were defined in a superclass" do
|
24
|
+
dispatch_should_make_body("TestSkipFilter", "")
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should append before filters when added" do
|
28
|
+
dispatch_should_make_body("TestBeforeFilterOrder", "bar filter")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should append after filters when added" do
|
32
|
+
dispatch_should_make_body("TestAfterFilterOrder", "bar filter")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should support proc arguments to filters evaluated in the controller's instance" do
|
36
|
+
dispatch_should_make_body("TestProcFilter", "proc filter1 proc filter2")
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should support filters that skip specific actions via :exclude" do
|
40
|
+
dispatch_should_make_body("TestExcludeFilter", " ", :index)
|
41
|
+
dispatch_should_make_body("TestExcludeFilter", "foo filter bar filter", :show)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should support filters that work only on specific actions via :only" do
|
45
|
+
dispatch_should_make_body("TestOnlyFilter", "foo filter bar filter", :index)
|
46
|
+
dispatch_should_make_body("TestOnlyFilter", " ", :show)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should throw an error if both :exclude and :only are passed to a filter" do
|
50
|
+
running { Merb::Test::Fixtures::Abstract.class_eval do
|
51
|
+
|
52
|
+
class TestErrorFilter < Merb::Test::Fixtures::Abstract::Testing
|
53
|
+
before :foo, :only => :index, :exclude => :show
|
54
|
+
end
|
55
|
+
end }.should raise_error(ArgumentError, /either :only or :exclude/)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should support filters that work only when a condition is met via :if" do
|
59
|
+
dispatch_should_make_body("TestConditionalFilterWithMethod", "foo filter", :index, :presets => {:bar= => true})
|
60
|
+
dispatch_should_make_body("TestConditionalFilterWithMethod", "", :index, :presets => {:bar= => false})
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should support filters that work only when a condition is met via :unless" do
|
64
|
+
dispatch_should_make_body("TestConditionalFilterWithProc", "foo filter", :index, :presets => {:bar= => 'baz'})
|
65
|
+
dispatch_should_make_body("TestConditionalFilterWithProc", "index action", :index, :presets => {:bar= => 'bar'})
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should throw an error if both :if and :unless are passed to a filter" do
|
69
|
+
running { Merb::Test::Fixtures::Abstract.class_eval do
|
70
|
+
|
71
|
+
class TestErrorFilter < Merb::Test::Fixtures::Abstract::Testing
|
72
|
+
before :foo, :if => :index, :unless => :show
|
73
|
+
end
|
74
|
+
end }.should raise_error(ArgumentError, /either :if or :unless/)
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should throw an error" do
|
78
|
+
running { dispatch_should_make_body("TestConditionalFilterWithNoProcOrSymbol", "") }.should raise_error(ArgumentError, /a Symbol or a Proc/)
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should throw an error if an unknown option is passed to a filter" do
|
82
|
+
running { Merb::Test::Fixtures::Abstract.class_eval do
|
83
|
+
|
84
|
+
class TestErrorFilter < Merb::Test::Fixtures::Abstract::Testing
|
85
|
+
before :foo, :except => :index
|
86
|
+
end
|
87
|
+
end }.should raise_error(ArgumentError, /known filter options/)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should support passing an argument to a before filter method" do
|
91
|
+
dispatch_should_make_body("TestBeforeFilterWithArgument", "index action")
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should support passing arguments to a before filter method" do
|
95
|
+
dispatch_should_make_body("TestBeforeFilterWithArguments", "index action")
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should inherit before filters" do
|
99
|
+
dispatch_should_make_body("FilterChild2", "Before Limited", :limited)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should not get contaminated by cousins" do
|
103
|
+
pending
|
104
|
+
dispatch_should_make_body("FilterChild2", "Before Index")
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "spec_helper")
|
2
|
+
|
3
|
+
describe Merb::AbstractController, " with capture and concat" do
|
4
|
+
|
5
|
+
it "should support capture" do
|
6
|
+
dispatch_should_make_body("Capture", "Capture")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should support capture with arguments" do
|
10
|
+
dispatch_should_make_body("CaptureWithArgs", "Capture: one, two")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should support basic helpers that use capture with <%=" do
|
14
|
+
dispatch_should_make_body("CaptureEq", "Pre. Beginning... Capturing... Done. Post.")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should support concat" do
|
18
|
+
dispatch_should_make_body("Concat", "Concat")
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "spec_helper")
|
2
|
+
|
3
|
+
describe Merb::AbstractController, " Partials" do
|
4
|
+
|
5
|
+
it "should work with no options" do
|
6
|
+
dispatch_should_make_body("BasicPartial", "Index Partial")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should work with :with" do
|
10
|
+
dispatch_should_make_body("WithPartial", "Partial with With")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should work with nil :with" do
|
14
|
+
dispatch_should_make_body("WithNilPartial", "Partial with nil local")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should work with :with and :as" do
|
18
|
+
dispatch_should_make_body("WithAsPartial", "Partial with With and As")
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should work with collections" do
|
22
|
+
dispatch_should_make_body("PartialWithCollections", "Partial with collection")
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should work with collections and :as" do
|
26
|
+
dispatch_should_make_body("PartialWithCollectionsAndAs", "Partial with collection")
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should work with key/value pairs of locals" do
|
30
|
+
dispatch_should_make_body("PartialWithLocals", "Partial with local variables")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should work with both collections and locals" do
|
34
|
+
dispatch_should_make_body("PartialWithBoth", "Partial with c-o-l-l-e-c-t-i-o-n-")
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should work with both :with/:as and regular locals" do
|
38
|
+
dispatch_should_make_body("PartialWithWithAndLocals", "Partial with with and locals")
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should work with a partial in another directory" do
|
42
|
+
dispatch_should_make_body("PartialInAnotherDirectory", "Index Partial in another directory")
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should work with nested partials with locals" do
|
46
|
+
dispatch_should_make_body("NestedPartial", "first second first")
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should work with multiple template roots" do
|
50
|
+
dispatch_should_make_body("BasicPartialWithMultipleRoots", "Base Index: Alt Partial")
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should be able to count collections" do
|
54
|
+
dispatch_should_make_body("PartialWithCollectionsAndCounter", "Partial counting: 0/5 1/5 2/5 3/5 4/5 ")
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should render a partial using an absolute path" do
|
58
|
+
dispatch_should_make_body("WithAbsolutePartial", "Index Absolute Partial")
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|