rad_core 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -3
- data/lib/components/config.rb +6 -0
- data/lib/components/controller.rb +5 -0
- data/lib/components/controller.yml +3 -0
- data/lib/components/conveyors.rb +7 -0
- data/lib/components/environment.rb +5 -0
- data/lib/components/environment.yml +3 -0
- data/lib/components/flash.rb +5 -0
- data/lib/components/html.rb +4 -0
- data/lib/components/html.yml +3 -0
- data/lib/components/http.rb +6 -0
- data/lib/components/http.yml +13 -0
- data/lib/components/logger.rb +5 -0
- data/lib/components/mailer.rb +9 -0
- data/lib/components/remote.rb +4 -0
- data/lib/components/router.rb +13 -0
- data/lib/components/router.yml +2 -0
- data/lib/components/template.rb +8 -0
- data/lib/components/template.yml +1 -0
- data/lib/components/web.rb +8 -0
- data/lib/components/workspace.rb +1 -0
- data/lib/rad/{support → _support}/active_support/locales/en/actionpack.yml +0 -0
- data/lib/rad/{support → _support}/active_support/locales/en/activesupport.yml +0 -0
- data/lib/rad/_support/active_support/locales/ru/actionview.yml +162 -0
- data/lib/rad/_support/active_support/locales/ru/activesupport.yml +16 -0
- data/lib/rad/_support/active_support/locales/ru/datetime.yml +49 -0
- data/lib/rad/{support → _support}/active_support/micelaneous.rb +0 -0
- data/lib/rad/{support → _support}/active_support/time.rb +0 -0
- data/lib/rad/{support → _support}/active_support.rb +14 -2
- data/lib/rad/{support → _support}/addressable.rb +0 -0
- data/lib/rad/_support/callbacks.rb +166 -0
- data/lib/rad/_support/class_loader.rb +9 -0
- data/lib/rad/_support/encoding.rb +3 -0
- data/lib/rad/_support/exception.rb +45 -0
- data/lib/rad/_support/extensions.rb +20 -0
- data/lib/rad/_support/filters.rb +32 -0
- data/lib/rad/{support → _support}/hacks_and_fixes.rb +0 -0
- data/lib/rad/{support → _support}/mime.rb +6 -0
- data/lib/rad/{support → _support}/module.rb +7 -9
- data/lib/rad/_support/require.rb +62 -0
- data/lib/rad/{support → _support}/rson.rb +0 -0
- data/lib/rad/{support → _support}/ruby_ext_with_active_support.rb +0 -0
- data/lib/rad/{support → _support}/string.rb +9 -1
- data/lib/rad/controller/_abstract/micelaneous.rb +27 -0
- data/lib/rad/controller/_abstract/render.rb +159 -0
- data/lib/rad/controller/_abstract/responder.rb +13 -0
- data/lib/rad/controller/_abstract.rb +37 -0
- data/lib/rad/controller/_context.rb +15 -0
- data/lib/rad/controller/_http.rb +50 -0
- data/lib/rad/controller/_require.rb +19 -0
- data/lib/rad/controller/abstract.rb +1 -0
- data/lib/rad/controller/context.rb +1 -0
- data/lib/rad/controller/http.rb +1 -0
- data/lib/rad/controller/processors/controller_caller.rb +22 -24
- data/lib/rad/controller/processors/controller_error_handling.rb +46 -48
- data/lib/rad/controller/processors/controller_logger.rb +7 -9
- data/lib/rad/controller.rb +1 -28
- data/lib/rad/conveyors/_conveyor.rb +73 -0
- data/lib/rad/conveyors/_conveyors.rb +19 -0
- data/lib/rad/conveyors/_params.rb +10 -0
- data/lib/rad/conveyors/_processor.rb +13 -0
- data/lib/rad/conveyors/_require.rb +10 -0
- data/lib/rad/conveyors/_workspace.rb +34 -0
- data/lib/rad/conveyors/params.rb +1 -0
- data/lib/rad/conveyors/processor.rb +1 -0
- data/lib/rad/conveyors/processors/conveyor_logger.rb +23 -0
- data/lib/rad/conveyors/workspace.rb +1 -0
- data/lib/rad/conveyors.rb +1 -0
- data/lib/rad/core_web/_controller_micelaneous_helper.rb +17 -0
- data/lib/rad/core_web/_require.rb +25 -0
- data/lib/rad/core_web/_router/abstract_routing_helper.rb +20 -0
- data/lib/rad/core_web/_router/controller_routing_helper.rb +56 -0
- data/lib/rad/core_web/_router/view_routing_helper.rb +57 -0
- data/lib/rad/environment/_config.rb +27 -0
- data/lib/rad/environment/_environment.rb +17 -0
- data/lib/rad/environment/_files_helper.rb +55 -0
- data/lib/rad/environment/_logger.rb +53 -0
- data/lib/rad/environment/_require.rb +24 -0
- data/lib/rad/environment/config.rb +1 -111
- data/lib/rad/environment.rb +1 -55
- data/lib/{rad_core → rad}/gems.rb +2 -3
- data/lib/rad/html/_flash.rb +40 -0
- data/lib/rad/html/_helpers/basic_html_helper.rb +72 -0
- data/lib/rad/html/_helpers/flash_helper.rb +3 -0
- data/lib/rad/html/_helpers/form_helper.rb +114 -0
- data/lib/rad/html/_helpers/html_helper.rb +3 -0
- data/lib/rad/html/_helpers/javascript_helper.rb +27 -0
- data/lib/rad/html/_helpers/model_helper.rb +143 -0
- data/lib/rad/html/_require.rb +15 -0
- data/lib/rad/html/processors/prepare_flash.rb +22 -23
- data/lib/rad/html/processors/scoped_params.rb +18 -21
- data/lib/rad/html.rb +1 -26
- data/lib/rad/http/_http.rb +11 -0
- data/lib/rad/http/_http_adapter.rb +44 -0
- data/lib/rad/http/_request.rb +50 -0
- data/lib/rad/http/_require.rb +33 -0
- data/lib/rad/http/_response.rb +84 -0
- data/lib/rad/http/{support → _support}/rack/fixes.rb +0 -0
- data/lib/rad/http/_support/rack/rack_adapter.rb +57 -0
- data/lib/rad/http/processors/evaluate_format.rb +16 -19
- data/lib/rad/http/processors/http_logger.rb +10 -12
- data/lib/rad/http/processors/http_writer.rb +24 -26
- data/lib/rad/http/processors/prepare_params.rb +19 -18
- data/lib/rad/http/request.rb +1 -0
- data/lib/rad/http/response.rb +1 -0
- data/lib/rad/http.rb +1 -48
- data/lib/rad/mailer/_letter.rb +28 -0
- data/lib/rad/mailer/_mailer.rb +13 -0
- data/lib/rad/mailer/_mailer_controller.rb +38 -0
- data/lib/rad/mailer/_require.rb +7 -0
- data/lib/rad/mailer/mailer_controller.rb +1 -0
- data/lib/rad/mailer/processors/letter_builder.rb +34 -0
- data/lib/rad/mailer.rb +1 -0
- data/lib/rad/profiles/mailer.rb +5 -0
- data/lib/rad/profiles/web.rb +29 -52
- data/lib/rad/remote/_remote_controller.rb +9 -0
- data/lib/rad/remote/_require.rb +6 -0
- data/lib/rad/remote/processors/remote_caller.rb +44 -46
- data/lib/rad/remote/processors/remote_logger.rb +8 -10
- data/lib/rad/remote/remote_controller.rb +1 -0
- data/lib/rad/remote.rb +1 -9
- data/lib/rad/router/_abstract_router.rb +50 -0
- data/lib/rad/router/_alias_router.rb +124 -0
- data/lib/rad/router/_basic_router.rb +72 -0
- data/lib/rad/router/_configurator.rb +19 -0
- data/lib/rad/router/_core_routing_helper.rb +39 -0
- data/lib/rad/router/_default_format_processor.rb +10 -0
- data/lib/rad/router/_object_router.rb +184 -0
- data/lib/rad/router/_require.rb +31 -0
- data/lib/rad/router/_restful_router.rb +124 -0
- data/lib/rad/router/_router.rb +294 -0
- data/lib/rad/router/_simple_router.rb +21 -0
- data/lib/rad/router/abstract_router.rb +1 -0
- data/lib/rad/router/alias_router.rb +1 -0
- data/lib/rad/router/configurator.rb +1 -0
- data/lib/rad/router/micelaneous_router.rb +1 -0
- data/lib/rad/router/object_router.rb +1 -0
- data/lib/rad/router/processors/router.rb +23 -0
- data/lib/rad/router/restful_router.rb +1 -0
- data/lib/rad/{html/include_into_controller.rb → router/simple_router.rb} +0 -0
- data/lib/rad/router.rb +1 -29
- data/lib/rad/spec/controller.rb +20 -11
- data/lib/rad/spec/environment.rb +22 -38
- data/lib/rad/spec/http.rb +13 -86
- data/lib/rad/spec/http_controller.rb +105 -0
- data/lib/rad/spec/mailer.rb +27 -0
- data/lib/rad/spec/remote.rb +2 -2
- data/lib/rad/spec/router.rb +9 -11
- data/lib/rad/spec/template.rb +8 -2
- data/lib/rad/spec/xhtml.rb +0 -2
- data/lib/rad/spec.rb +4 -2
- data/lib/rad/template/_context.rb +92 -0
- data/lib/rad/template/_relative_path_resolver.rb +8 -0
- data/lib/rad/template/_require.rb +15 -0
- data/lib/rad/template/{support → _support}/tilt.rb +0 -0
- data/lib/rad/template/{support → _support}/tilt_fixes.rb +0 -0
- data/lib/rad/template/_template.rb +175 -0
- data/lib/rad/template/template_context.rb +1 -62
- data/lib/rad/template.rb +1 -25
- data/lib/rad.rb +8 -0
- data/readme.md +40 -12
- data/spec/controller/{abstract_controller_spec → abstract_spec}/views/OperationsOrderSpec/action.erb +0 -0
- data/spec/controller/{abstract_controller_spec → abstract_spec}/views/ViewVariablesSpec/action.erb +0 -0
- data/spec/controller/abstract_spec.rb +126 -0
- data/spec/controller/{controller_context_spec/views/ItemSpec → context_spec/views/NamespaceSpec/ClassSpec}/show.erb +0 -0
- data/spec/controller/{controller_context_spec/views/ItemSpec → context_spec/views/item_spec}/actions.erb +0 -0
- data/spec/controller/{controller_context_spec/views/NamespaceSpec/ClassSpec → context_spec/views/item_spec}/show.erb +0 -0
- data/spec/controller/{controller_context_spec/views/ItemSpec → context_spec/views/item_spec}/update.erb +0 -0
- data/spec/controller/{controller_context_spec → context_spec}/views/namespace_spec/class_spec/update.erb +0 -0
- data/spec/controller/{controller_context_spec/views/PageSpec → context_spec/views/page_spec}/actions.erb +0 -0
- data/spec/controller/{controller_context_spec/views/PageSpec → context_spec/views/page_spec}/show.erb +0 -0
- data/spec/controller/context_spec.rb +123 -0
- data/spec/controller/error_handling_spec.rb +21 -27
- data/spec/controller/{controller_helper_spec → helper_spec}/views/HelperMethodSpec/action.erb +0 -0
- data/spec/controller/{controller_helper_spec → helper_spec}/views/HelperSpec/action.erb +0 -0
- data/spec/controller/{controller_helper_spec.rb → helper_spec.rb} +7 -13
- data/spec/controller/{http_controller_spec.rb → http_spec.rb} +17 -23
- data/spec/controller/{controller_render_spec/views/AlreadyRenderedSpec → render_spec/views/already_rendered_spec}/action.erb +0 -0
- data/spec/controller/{controller_render_spec/views/AlreadyRenderedSpec → render_spec/views/already_rendered_spec}/custom_template.erb +0 -0
- data/spec/controller/{controller_render_spec/views/AnotherActionSpec → render_spec/views/another_action_spec}/another_action.erb +0 -0
- data/spec/controller/{controller_render_spec/views/AnotherLayout → render_spec/views/another_layout}/action.erb +0 -0
- data/spec/controller/{controller_render_spec/views/ForbidPartialAsActionSpec → render_spec/views/forbid_partial_as_action_spec}/_action.erb +0 -0
- data/spec/controller/{controller_render_spec/views/FormatSpec → render_spec/views/format_spec}/action.html.erb +0 -0
- data/spec/controller/{controller_render_spec/views/FormatSpec → render_spec/views/format_spec}/action.js.erb +0 -0
- data/spec/controller/{controller_render_spec/views/LayoutFiltersSpec → render_spec/views/layout_filters_spec}/action_with_layout.erb +0 -0
- data/spec/controller/{controller_render_spec/views/LayoutFiltersSpec → render_spec/views/layout_filters_spec}/action_without_layout.erb +0 -0
- data/spec/controller/{controller_render_spec/views/LayoutSpec → render_spec/views/layout_spec}/action.erb +0 -0
- data/spec/controller/{controller_render_spec → render_spec}/views/layouts/admin.erb +0 -0
- data/spec/controller/{controller_render_spec → render_spec}/views/layouts/app.html.erb +0 -0
- data/spec/controller/{controller_render_spec → render_spec}/views/layouts/app.js.erb +0 -0
- data/spec/controller/{controller_render_spec/views/MultipleActions → render_spec/views/multiple_actions}/actions.haml +0 -0
- data/spec/controller/render_spec/views/relative_spec/a/form.erb +1 -0
- data/spec/controller/render_spec/views/relative_spec/a/show.erb +1 -0
- data/spec/controller/render_spec/views/relative_spec/b/form.erb +1 -0
- data/spec/controller/{controller_render_spec → render_spec}/views/some_template.erb +0 -0
- data/spec/controller/{controller_render_spec → render_spec}/views/standalone.html.erb +0 -0
- data/spec/controller/{controller_render_spec.rb → render_spec.rb} +37 -27
- data/spec/{conveyor/conveyor_spec.rb → conveyors/conveyors_spec.rb} +36 -14
- data/spec/environment/config_spec.rb +13 -21
- data/spec/environment/environment_spec.rb +14 -41
- data/spec/environment/logger_spec.rb +4 -13
- data/spec/environment/minimal_app_spec/app.rb +1 -1
- data/spec/environment/minimal_app_spec.rb +12 -14
- data/spec/environment/standard_app_spec/app/lib/app/init.rb +1 -1
- data/spec/environment/standard_app_spec/plugin_a/lib/plugin_a/init.rb +1 -1
- data/spec/environment/standard_app_spec.rb +17 -25
- data/spec/html/basic_html_helper_spec.rb +7 -4
- data/spec/html/form_helper_spec.rb +5 -5
- data/spec/html/javascript_helper_spec.rb +9 -5
- data/spec/html/model_helper_spec.rb +9 -6
- data/spec/html/scoped_params_spec.rb +2 -2
- data/spec/html/spec_helper.rb +16 -24
- data/spec/http/http_spec.rb +14 -35
- data/spec/http/micelaneous_spec.rb +3 -3
- data/spec/{mail → mailer}/mail_controller_spec/views/body_template_spec/signup.erb +0 -0
- data/spec/{mail → mailer}/mail_controller_spec.rb +36 -12
- data/spec/mailer/spec_helper.rb +5 -0
- data/spec/remote/remote_spec.rb +23 -8
- data/spec/router/alias_router_spec.rb +29 -30
- data/spec/router/basic_router_spec.rb +44 -0
- data/spec/router/configurator_spec.rb +9 -6
- data/spec/router/integration_spec.rb +10 -7
- data/spec/router/object_router_spec.rb +186 -0
- data/spec/router/persistent_params_spec.rb +4 -4
- data/spec/router/restful_router_spec.rb +61 -53
- data/spec/router/{basic_spec.rb → router_spec.rb} +26 -23
- data/spec/router/routing_helper_spec.rb +5 -6
- data/spec/spec_helper.rb +4 -0
- data/spec/support/callbacks_spec.rb +1 -1
- data/spec/support/filters_spec.rb +2 -2
- data/spec/support/spec_helper.rb +1 -1
- data/spec/template/template_spec/views/format_for_partials/dialog.js.erb +1 -1
- data/spec/template/template_spec/views/nested/format/a.erb +1 -1
- data/spec/template/template_spec/views/nested/format/b.js.erb +1 -0
- data/spec/template/template_spec/views/nesting_format/dialog.js.erb +1 -1
- data/spec/template/template_spec.rb +62 -48
- data/spec/template/tilt_spec/views/concat_and_capture.erb +1 -1
- data/spec/template/tilt_spec/views/concat_and_capture.haml +1 -1
- data/spec/template/tilt_spec.rb +17 -19
- data/spec/{integration → web}/basic_spec/views/smoke_test_spec/action.erb +0 -0
- data/spec/{integration → web}/basic_spec.rb +31 -12
- data/spec/{integration → web}/controller_routing_helper_spec.rb +13 -11
- data/spec/{integration → web}/flash_spec.rb +57 -42
- data/spec/{integration → web}/spec_helper_spec.rb +11 -10
- data/spec/{integration → web}/view_routing_helper_spec.rb +44 -36
- metadata +338 -318
- data/lib/rad/controller/abstract_controller/micelaneous.rb +0 -31
- data/lib/rad/controller/abstract_controller/render.rb +0 -160
- data/lib/rad/controller/abstract_controller/responder.rb +0 -17
- data/lib/rad/controller/abstract_controller.rb +0 -64
- data/lib/rad/controller/controller_context.rb +0 -15
- data/lib/rad/controller/http_controller.rb +0 -48
- data/lib/rad/conveyor/conveyor.rb +0 -74
- data/lib/rad/conveyor/conveyors.rb +0 -20
- data/lib/rad/conveyor/params.rb +0 -14
- data/lib/rad/conveyor/processor.rb +0 -68
- data/lib/rad/conveyor/processors/conveyor_logger.rb +0 -25
- data/lib/rad/conveyor/workspace.rb +0 -36
- data/lib/rad/conveyor.rb +0 -29
- data/lib/rad/environment/dependency_resolver.rb +0 -107
- data/lib/rad/environment/environment.rb +0 -29
- data/lib/rad/environment/files_helper.rb +0 -55
- data/lib/rad/environment/logger.rb +0 -21
- data/lib/rad/html/flash.rb +0 -42
- data/lib/rad/html/helpers/basic_html_helper.rb +0 -83
- data/lib/rad/html/helpers/flash_helper.rb +0 -5
- data/lib/rad/html/helpers/form_helper.rb +0 -115
- data/lib/rad/html/helpers/html_helper.rb +0 -5
- data/lib/rad/html/helpers/javascript_helper.rb +0 -18
- data/lib/rad/html/helpers/model_helper.rb +0 -135
- data/lib/rad/http/http.rb +0 -21
- data/lib/rad/http/http_adapter.rb +0 -36
- data/lib/rad/http/middleware/static_files.rb +0 -21
- data/lib/rad/http/support/rack/rack_adapter.rb +0 -67
- data/lib/rad/http/support/rack/request.rb +0 -42
- data/lib/rad/http/support/rack/response.rb +0 -86
- data/lib/rad/integration/controller_micelaneous_helper.rb +0 -19
- data/lib/rad/integration/router/abstract_routing_helper.rb +0 -22
- data/lib/rad/integration/router/controller_routing_helper.rb +0 -58
- data/lib/rad/integration/router/view_routing_helper.rb +0 -104
- data/lib/rad/integration.rb +0 -30
- data/lib/rad/mail/letter.rb +0 -30
- data/lib/rad/mail/mail_controller.rb +0 -31
- data/lib/rad/mail/mailer.rb +0 -23
- data/lib/rad/mail/processors/letter_builder.rb +0 -36
- data/lib/rad/mail.rb +0 -15
- data/lib/rad/profiles/mail.rb +0 -16
- data/lib/rad/profiles/web_require.rb +0 -5
- data/lib/rad/remote/remote.rb +0 -15
- data/lib/rad/router/core/configurator.rb +0 -25
- data/lib/rad/router/core/core_routing_helper.rb +0 -41
- data/lib/rad/router/core/default_format_processor.rb +0 -12
- data/lib/rad/router/core/processors/router.rb +0 -29
- data/lib/rad/router/core/router.rb +0 -271
- data/lib/rad/router/core/simple_router.rb +0 -23
- data/lib/rad/router/routers/abstract_router.rb +0 -62
- data/lib/rad/router/routers/alias_router.rb +0 -113
- data/lib/rad/router/routers/restful_router.rb +0 -113
- data/lib/rad/spec/mail.rb +0 -31
- data/lib/rad/spec/view.rb +0 -10
- data/lib/rad/support/buffered_logger.rb +0 -44
- data/lib/rad/support/callbacks.rb +0 -168
- data/lib/rad/support/exception.rb +0 -31
- data/lib/rad/support/filters.rb +0 -34
- data/lib/rad/support/format.rb +0 -17
- data/lib/rad/support/micon.rb +0 -13
- data/lib/rad/support.rb +0 -63
- data/lib/rad/template/template.rb +0 -250
- data/spec/controller/abstract_controller_spec.rb +0 -132
- data/spec/controller/controller_context_spec.rb +0 -123
- data/spec/controller/controller_render_spec/views/rem ExplicitRenderSpec/action.erb +0 -1
- data/spec/controller/controller_render_spec/views/rem ExplicitRenderSpec/another_action.erb +0 -1
- data/spec/controller/spec_helper.rb +0 -19
- data/spec/conveyor/spec_helper.rb +0 -3
- data/spec/environment/config_spec/config.default.yml +0 -3
- data/spec/environment/config_spec/config.development.yml +0 -3
- data/spec/environment/config_spec/config.yml +0 -5
- data/spec/environment/spec_helper.rb +0 -1
- data/spec/http/http_spec/app/lib/app/init.rb +0 -10
- data/spec/http/http_spec/app/runtime/public/emptygit +0 -0
- data/spec/http/http_spec/plugin_a/lib/plugin_a/init.rb +0 -0
- data/spec/http/http_spec/plugin_b/lib/plugin_b/init.rb +0 -5
- data/spec/http/http_spec/plugin_b/static/emptygit +0 -0
- data/spec/http/spec_helper.rb +0 -5
- data/spec/integration/spec_helper.rb +0 -5
- data/spec/mail/spec_helper.rb +0 -7
- data/spec/remote/spec_helper.rb +0 -17
- data/spec/router/spec_helper.rb +0 -20
- data/spec/template/spec_helper.rb +0 -6
- data/spec/template/template_spec/views/nested/format/b.erb +0 -1
@@ -1,132 +0,0 @@
|
|
1
|
-
require "controller/spec_helper"
|
2
|
-
|
3
|
-
describe "AbstractController" do
|
4
|
-
with_environment
|
5
|
-
with_abstract_controller_spec
|
6
|
-
with_view_path "#{spec_dir}/views"
|
7
|
-
|
8
|
-
before :all do
|
9
|
-
AbstractController = Rad::AbstractController
|
10
|
-
end
|
11
|
-
|
12
|
-
after :all do
|
13
|
-
remove_constants %w(
|
14
|
-
WorkspaceVariablesSpec
|
15
|
-
SpecialResultSpec
|
16
|
-
RespondToSpec
|
17
|
-
ViewVariablesSpec
|
18
|
-
OperationsOrderSpec
|
19
|
-
NoTemplateSpec
|
20
|
-
AbstractController
|
21
|
-
)
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should set workspace variables" do
|
25
|
-
class ::WorkspaceVariablesSpec
|
26
|
-
inherit AbstractController
|
27
|
-
|
28
|
-
def action; end
|
29
|
-
end
|
30
|
-
|
31
|
-
ccall WorkspaceVariablesSpec, :action
|
32
|
-
|
33
|
-
workspace.controller.should be_a(WorkspaceVariablesSpec)
|
34
|
-
workspace.response.should respond_to("body=")
|
35
|
-
|
36
|
-
expected_result = {
|
37
|
-
params: {},
|
38
|
-
|
39
|
-
class: WorkspaceVariablesSpec,
|
40
|
-
method_name: :action,
|
41
|
-
action: :action
|
42
|
-
}
|
43
|
-
workspace.to_h(true).subset(expected_result.keys).should == expected_result
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should be able to throw :halt_render in controller or view and that result must be assigned as result" do
|
47
|
-
class ::SpecialResultSpec
|
48
|
-
inherit AbstractController
|
49
|
-
def action
|
50
|
-
throw :halt_render, 'some content'
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
ccall(SpecialResultSpec, :action).should == "some content"
|
55
|
-
end
|
56
|
-
|
57
|
-
it "respond_to" do
|
58
|
-
class ::RespondToSpec
|
59
|
-
inherit AbstractController
|
60
|
-
|
61
|
-
def action
|
62
|
-
respond_to do |format|
|
63
|
-
format.html{render inline: 'html'}
|
64
|
-
format.json{render json: {a: 'b'}}
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
ccall(RespondToSpec, :action, format: 'html').should == 'html'
|
70
|
-
ccall(RespondToSpec, :action, format: 'json').should == %({"a":"b"})
|
71
|
-
lambda{ccall(RespondToSpec, :action, format: 'js')}.should raise_error(/can't respond to 'js' format/)
|
72
|
-
end
|
73
|
-
|
74
|
-
it "controller's instance variables must be available in view, and also other variables" do
|
75
|
-
class ::ViewVariablesSpec
|
76
|
-
inherit AbstractController
|
77
|
-
|
78
|
-
def action
|
79
|
-
@instance_variable = "iv value"
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
ccall(ViewVariablesSpec, :action, param: 'param value', format: 'html').should == %(\
|
84
|
-
controller: ViewVariablesSpec
|
85
|
-
controller_name: ViewVariablesSpec
|
86
|
-
|
87
|
-
class: ViewVariablesSpec
|
88
|
-
method_name: action
|
89
|
-
action: action
|
90
|
-
|
91
|
-
instance_variable: iv value
|
92
|
-
|
93
|
-
params: param value
|
94
|
-
format: html)
|
95
|
-
end
|
96
|
-
|
97
|
-
it "operations order" do
|
98
|
-
class ::OperationsOrderSpec
|
99
|
-
inherit AbstractController
|
100
|
-
|
101
|
-
def self.result
|
102
|
-
@result ||= []
|
103
|
-
end
|
104
|
-
|
105
|
-
around do |controller, block|
|
106
|
-
begin
|
107
|
-
OperationsOrderSpec.result << :before
|
108
|
-
block.call
|
109
|
-
ensure
|
110
|
-
OperationsOrderSpec.result << :after
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def action
|
115
|
-
OperationsOrderSpec.result << :action
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
ccall(OperationsOrderSpec, :action)
|
120
|
-
OperationsOrderSpec.result.should == [:before, :action, :template, :after]
|
121
|
-
end
|
122
|
-
|
123
|
-
it "should write empty response if no template for action" do
|
124
|
-
class NoTemplateSpec
|
125
|
-
inherit AbstractController
|
126
|
-
|
127
|
-
def action; end
|
128
|
-
end
|
129
|
-
|
130
|
-
ccall(NoTemplateSpec, :action).should == ""
|
131
|
-
end
|
132
|
-
end
|
@@ -1,123 +0,0 @@
|
|
1
|
-
require "controller/spec_helper"
|
2
|
-
|
3
|
-
describe "ControllerContext" do
|
4
|
-
with_environment environment: :development
|
5
|
-
with_view_path "#{spec_dir}/views"
|
6
|
-
|
7
|
-
before :all do
|
8
|
-
AbstractController = Rad::AbstractController
|
9
|
-
|
10
|
-
class ItemSpec
|
11
|
-
inherit AbstractController
|
12
|
-
|
13
|
-
def show; end
|
14
|
-
def update; end
|
15
|
-
def delete; end
|
16
|
-
def increase; end
|
17
|
-
def decrease; end
|
18
|
-
end
|
19
|
-
|
20
|
-
class PageSpec < ItemSpec
|
21
|
-
def show; end
|
22
|
-
def increase; end
|
23
|
-
end
|
24
|
-
|
25
|
-
module NamespaceSpec
|
26
|
-
class ClassSpec
|
27
|
-
inherit AbstractController
|
28
|
-
|
29
|
-
def show; end
|
30
|
-
def update; end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
after :all do
|
36
|
-
remove_constants %w(
|
37
|
-
ItemSpec
|
38
|
-
PageSpec
|
39
|
-
NamespaceSpec
|
40
|
-
ItemSpecHelper
|
41
|
-
PageSpecHelper
|
42
|
-
AbstractController
|
43
|
-
)
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "basic" do
|
47
|
-
it "should provide template name for non-existing template" do
|
48
|
-
ItemSpec.template_name_for(:delete).should == "/ItemSpec/delete"
|
49
|
-
PageSpec.template_name_for(:delete).should == "/ItemSpec/delete"
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should provide template name for existing template" do
|
53
|
-
ItemSpec.template_name_for(:update).should == "/ItemSpec/update"
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should inherit template name for template existing in parent" do
|
57
|
-
PageSpec.template_name_for(:update).should == "/ItemSpec/update"
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should override template name for template existing in both self and parent" do
|
61
|
-
ItemSpec.template_name_for(:show).should == "/ItemSpec/show"
|
62
|
-
PageSpec.template_name_for(:show).should == "/PageSpec/show"
|
63
|
-
end
|
64
|
-
|
65
|
-
it "should transfer namespaces into folders" do
|
66
|
-
NamespaceSpec::ClassSpec.template_name_for(:show).should == "/NamespaceSpec/ClassSpec/show"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe "actions" do
|
71
|
-
it "should be able to check for action inside of actions.xxx files" do
|
72
|
-
ItemSpec.template_name_for(:increase).should == "/ItemSpec/actions"
|
73
|
-
end
|
74
|
-
|
75
|
-
it "should be able to check for action inside of actions.xxx files" do
|
76
|
-
ItemSpec.template_name_for(:increase).should == "/ItemSpec/actions"
|
77
|
-
ItemSpec.template_name_for(:decrease).should == "/ItemSpec/actions"
|
78
|
-
ItemSpec.template_name_for(:action_not_defined_inside_of_actions_file).should == "/ItemSpec/action_not_defined_inside_of_actions_file"
|
79
|
-
end
|
80
|
-
|
81
|
-
it "should inherit actions.xxx" do
|
82
|
-
PageSpec.template_name_for(:increase).should == "/ItemSpec/actions"
|
83
|
-
PageSpec.template_name_for(:decrease).should == "/PageSpec/actions"
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
describe "controller_context_class, helper" do
|
88
|
-
before :each do
|
89
|
-
ItemSpec.instance_variable_set "@controller_context_class", nil
|
90
|
-
ItemSpec.instance_variable_set "@controller_context_class", nil
|
91
|
-
end
|
92
|
-
|
93
|
-
it "controller_context_class" do
|
94
|
-
ItemSpec.controller_context_class.should == ItemSpec::ItemSpecControllerContext
|
95
|
-
PageSpec.controller_context_class.should == PageSpec::PageSpecControllerContext
|
96
|
-
PageSpec::PageSpecControllerContext.is?(PageSpec::ItemSpecControllerContext).should be_true
|
97
|
-
end
|
98
|
-
|
99
|
-
it "helper" do
|
100
|
-
module ::ItemSpecHelper
|
101
|
-
def controller_item; end
|
102
|
-
end
|
103
|
-
|
104
|
-
module ::PageSpecHelper
|
105
|
-
def controller_page; end
|
106
|
-
end
|
107
|
-
|
108
|
-
ItemSpec.helper ItemSpecHelper
|
109
|
-
PageSpec.helper PageSpecHelper
|
110
|
-
|
111
|
-
ItemSpec::ItemSpecControllerContext.instance_methods.should include(:controller_item)
|
112
|
-
|
113
|
-
PageSpec::PageSpecControllerContext.instance_methods.should include(:controller_item)
|
114
|
-
PageSpec::PageSpecControllerContext.instance_methods.should include(:controller_page)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
describe "other" do
|
119
|
-
it "should understand underscored paths" do
|
120
|
-
NamespaceSpec::ClassSpec.template_name_for(:update).should == "/namespace_spec/class_spec/update"
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
action
|
@@ -1 +0,0 @@
|
|
1
|
-
another action
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'rspec_ext'
|
2
|
-
|
3
|
-
require 'rad/controller'
|
4
|
-
require 'rad/controller/http_controller'
|
5
|
-
require 'rad/http'
|
6
|
-
|
7
|
-
require 'rad/spec'
|
8
|
-
|
9
|
-
rspec do
|
10
|
-
def self.with_abstract_controller_spec
|
11
|
-
before :all do
|
12
|
-
rad.after :environment do
|
13
|
-
rad.conveyors.web do |web|
|
14
|
-
web.use Rad::Processors::ControllerCaller
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'rspec_ext'
|
File without changes
|
File without changes
|
File without changes
|
data/spec/http/spec_helper.rb
DELETED
data/spec/mail/spec_helper.rb
DELETED
data/spec/remote/spec_helper.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'rspec_ext'
|
2
|
-
|
3
|
-
require 'rad/remote'
|
4
|
-
|
5
|
-
require 'rad/spec/remote'
|
6
|
-
|
7
|
-
rspec do
|
8
|
-
def self.with_remote_spec
|
9
|
-
before :all do
|
10
|
-
rad.after :environment do
|
11
|
-
rad.conveyors.services do |ss|
|
12
|
-
ss.use Rad::Processors::RemoteCaller, :content
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/spec/router/spec_helper.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'rspec_ext'
|
2
|
-
|
3
|
-
require 'rad/http'
|
4
|
-
require 'rad/router'
|
5
|
-
|
6
|
-
require 'rad/spec/environment'
|
7
|
-
|
8
|
-
rspec do
|
9
|
-
def self.with_router_spec
|
10
|
-
before :all do
|
11
|
-
rad.after :environment do
|
12
|
-
rad.register :router, depends_on: :environment do
|
13
|
-
Rad::Router.new(:class, [[:default_router, Rad::SimpleRouter.new]])
|
14
|
-
end
|
15
|
-
|
16
|
-
rad.conveyors.web.use Rad::Processors::Router, :class_variable, :method_variable
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= options.format %> format
|