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,65 +1,38 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
|
-
require 'rad/environment'
|
4
3
|
require 'rad/spec/environment'
|
5
4
|
|
6
5
|
describe "Environment basic spec" do
|
7
6
|
with_load_path "#{spec_dir}/path1", "#{spec_dir}/path2"
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
before :all do
|
7
|
+
|
8
|
+
before :all do
|
12
9
|
@path1, @path2 = "#{spec_dir}/path1", "#{spec_dir}/path2"
|
13
10
|
end
|
14
11
|
|
15
12
|
describe 'files' do
|
16
|
-
with_environment
|
17
|
-
|
18
13
|
it "find_files?" do
|
19
|
-
|
20
|
-
|
14
|
+
environment.file_exist?('/some_folder/some_file').should be_true
|
15
|
+
environment.file_exist?('/file1').should be_true
|
21
16
|
end
|
22
|
-
|
17
|
+
|
23
18
|
it "find_file" do
|
24
|
-
lambda{
|
25
|
-
|
26
|
-
lambda{
|
19
|
+
lambda{environment.find_file('/some_folder/some_file')}.should raise_error(/Found multiple files/)
|
20
|
+
environment.find_file('/file1').should == "#{@path1}/file1"
|
21
|
+
lambda{environment.find_file('file1')}.should raise_error(AssertionError)
|
27
22
|
end
|
28
|
-
|
23
|
+
|
29
24
|
it "find_files" do
|
30
|
-
|
25
|
+
environment.find_files('/some_folder/some_file').sort.should == ["#{@path1}/some_folder/some_file", "#{@path2}/some_folder/some_file"]
|
31
26
|
end
|
32
|
-
|
27
|
+
|
33
28
|
it "find_files_by_pattern" do
|
34
|
-
|
29
|
+
environment.find_files_by_pattern('/*/some_file').sort.should == ["#{@path1}/some_folder/some_file", "#{@path2}/some_folder/some_file"]
|
35
30
|
end
|
36
31
|
end
|
37
32
|
|
38
33
|
describe 'config' do
|
39
|
-
with_environment
|
40
|
-
|
41
34
|
it "smoke test" do
|
42
|
-
config
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "spec should be isolated (via swap_metadata)" do
|
47
|
-
describe "first spec" do
|
48
|
-
with_environment
|
49
|
-
|
50
|
-
before :all do
|
51
|
-
rad.register(:spec_component)
|
52
|
-
end
|
53
|
-
|
54
|
-
it "check" do
|
55
|
-
Micon.metadata.should include(:spec_component)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe "second spec" do
|
60
|
-
it "check" do
|
61
|
-
Micon.metadata.should_not include(:spec_component)
|
62
|
-
end
|
35
|
+
rad.config
|
63
36
|
end
|
64
37
|
end
|
65
38
|
end
|
@@ -1,19 +1,10 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
|
-
require 'rad
|
3
|
+
require 'rad'
|
4
|
+
require 'rad/spec/environment'
|
4
5
|
|
5
6
|
describe "Environment basic spec" do
|
6
|
-
before :all do
|
7
|
-
rad.clear
|
8
|
-
::SILENCE_LOGGER = true
|
9
|
-
end
|
10
|
-
|
11
|
-
after :all do
|
12
|
-
rad.clear
|
13
|
-
remove_constants :SILENCE_LOGGER
|
14
|
-
end
|
15
|
-
|
16
7
|
it "logger should work before Rad initialized" do
|
17
|
-
rad
|
8
|
+
rad.logger.should_not be_nil
|
18
9
|
end
|
19
10
|
end
|
@@ -1 +1 @@
|
|
1
|
-
rad
|
1
|
+
rad.mode = :test, true
|
@@ -1,25 +1,23 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
|
-
require 'rad
|
3
|
+
require 'rad'
|
4
4
|
|
5
|
-
describe "
|
6
|
-
inject env: :environment
|
5
|
+
describe "Minimal App" do
|
6
|
+
# inject env: :environment
|
7
|
+
|
8
|
+
# with_micon
|
7
9
|
|
8
10
|
before :all do
|
9
11
|
load "#{spec_dir}/app.rb"
|
10
12
|
end
|
11
13
|
|
12
|
-
after :all do
|
13
|
-
rad.clear
|
14
|
-
end
|
15
|
-
|
16
14
|
it "core components" do
|
17
|
-
rad
|
18
|
-
rad
|
19
|
-
rad
|
15
|
+
rad.logger.should_not be_nil
|
16
|
+
rad.environment.should_not be_nil
|
17
|
+
rad.config.should_not be_nil
|
20
18
|
end
|
21
19
|
|
22
|
-
it "application
|
23
|
-
|
24
|
-
end
|
20
|
+
# it "application runtime_path" do
|
21
|
+
# environment.config.runtime_path?.should be_false
|
22
|
+
# end
|
25
23
|
end
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
$spec_result << "plugin_a"
|
@@ -1,15 +1,9 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
|
-
require 'rad
|
3
|
+
require 'rad'
|
4
4
|
require 'rad/spec/environment'
|
5
5
|
|
6
6
|
describe "Environment basic spec" do
|
7
|
-
before :each do
|
8
|
-
SpecResult.clear
|
9
|
-
end
|
10
|
-
|
11
|
-
inject environment: :environment
|
12
|
-
|
13
7
|
the_spec_dir = with_tmp_spec_dir
|
14
8
|
|
15
9
|
with_load_path(
|
@@ -18,31 +12,29 @@ describe "Environment basic spec" do
|
|
18
12
|
"#{the_spec_dir}/app/lib"
|
19
13
|
)
|
20
14
|
|
21
|
-
|
15
|
+
before do
|
16
|
+
rad.runtime_path = the_spec_dir, true
|
17
|
+
$spec_result = []
|
18
|
+
end
|
22
19
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
20
|
+
after :all do
|
21
|
+
rad.delete_all :custom_component
|
22
|
+
end
|
27
23
|
|
28
|
-
before
|
24
|
+
before do
|
29
25
|
load "app/init.rb"
|
30
26
|
end
|
31
27
|
|
32
|
-
after :all do
|
33
|
-
remove_constants %w(SpecResult)
|
34
|
-
end
|
35
|
-
|
36
28
|
it "core components" do
|
37
|
-
rad
|
38
|
-
rad
|
39
|
-
rad
|
29
|
+
rad.logger.should_not be_nil
|
30
|
+
rad.environment.should_not be_nil
|
31
|
+
rad.config.should_not be_nil
|
40
32
|
end
|
41
33
|
|
42
34
|
it "loading order" do
|
43
|
-
rad
|
44
|
-
rad.register
|
45
|
-
rad
|
46
|
-
|
35
|
+
rad.environment
|
36
|
+
rad.register(:custom_component){true}
|
37
|
+
rad.custom_component
|
38
|
+
$spec_result.should == %w(init plugin_a)
|
47
39
|
end
|
48
40
|
end
|
@@ -1,10 +1,13 @@
|
|
1
1
|
require 'html/spec_helper'
|
2
2
|
|
3
|
-
require 'rad/spec/xhtml'
|
4
|
-
|
5
3
|
describe "BasicHtmlHelper" do
|
6
|
-
before
|
4
|
+
before do
|
7
5
|
@t = Rad::MockTemplateContext.new
|
6
|
+
@t.class_eval do
|
7
|
+
def url_for *args
|
8
|
+
args.join(' ')
|
9
|
+
end
|
10
|
+
end
|
8
11
|
end
|
9
12
|
|
10
13
|
it "tag" do
|
@@ -13,7 +16,7 @@ describe "BasicHtmlHelper" do
|
|
13
16
|
@t.buffer.should == %(<div class="hidden">content</div>)
|
14
17
|
end
|
15
18
|
|
16
|
-
it "stylesheet_link_tag"
|
19
|
+
it "stylesheet_link_tag" do
|
17
20
|
@t.stylesheet_link_tag('/public/js/app.css').should == %(<link href="/public/js/app.css" media="screen" rel="stylesheet" type="text/css"></link>)
|
18
21
|
end
|
19
22
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'html/spec_helper'
|
2
2
|
|
3
3
|
describe "FormHelper" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
before do
|
5
|
+
class MockFormHelperContext < Rad::MockTemplateContext
|
6
|
+
include Rad::Html::FormHelper
|
7
|
+
end
|
8
|
+
|
9
9
|
@t = MockFormHelperContext.new
|
10
10
|
end
|
11
11
|
|
@@ -1,11 +1,15 @@
|
|
1
1
|
require 'html/spec_helper'
|
2
2
|
|
3
3
|
describe "BasicHtmlHelper" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
before do
|
5
|
+
class MockJavascriptHelperContext < Rad::MockTemplateContext
|
6
|
+
inherit Rad::Html::JavascriptHelper
|
7
|
+
|
8
|
+
def url_for *args
|
9
|
+
args.join(' ')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
9
13
|
@t = MockJavascriptHelperContext.new
|
10
14
|
end
|
11
15
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'html/spec_helper'
|
2
2
|
|
3
3
|
describe "ModelHelper" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
before do
|
5
|
+
class MockModelHelperContext < Rad::MockTemplateContext
|
6
|
+
inherit Rad::Html::FormHelper
|
7
|
+
end
|
8
|
+
|
9
9
|
@t = MockModelHelperContext.new
|
10
10
|
end
|
11
11
|
|
@@ -68,9 +68,12 @@ describe "ModelHelper" do
|
|
68
68
|
} }
|
69
69
|
doc = @t.buffer.to_xhtml
|
70
70
|
|
71
|
+
# checkbox is special case, we are using it with <input type='hidden' .../> tag.
|
72
|
+
doc.css("*[type='hidden']").first.should_be_fuzzy_equal_to name: "book[available]", value: '0'
|
71
73
|
doc.css("*[type='checkbox']").first.should_be_fuzzy_equal_to name: "book[available]", value: '1'
|
74
|
+
|
72
75
|
doc.css("*[type='file']").first.should_be_fuzzy_equal_to name: "book[title]"
|
73
|
-
doc.css("*[type='hidden']").
|
76
|
+
doc.css("*[type='hidden']").last.should_be_fuzzy_equal_to name: "book[title]", value: 'Super Hero'
|
74
77
|
doc.css("*[type='password']").first.should_be_fuzzy_equal_to name: "book[title]"
|
75
78
|
doc.css("*[type='radio']").first.should_be_fuzzy_equal_to name: "book[available]", value: '1'
|
76
79
|
doc.css("*[type='submit']").first.should_be_fuzzy_equal_to value: 'Ok'
|
@@ -2,9 +2,9 @@ require 'html/spec_helper'
|
|
2
2
|
|
3
3
|
describe "ScopedParams" do
|
4
4
|
it "basic" do
|
5
|
-
workspace = Rad::Workspace.new.update(params: {"book[title]" => "Super Hero"})
|
5
|
+
workspace = Rad::Conveyors::Workspace.new.update(params: {"book[title]" => "Super Hero"})
|
6
6
|
|
7
|
-
@processor = Rad::Processors::ScopedParams.new(lambda{})
|
7
|
+
@processor = Rad::Html::Processors::ScopedParams.new(lambda{})
|
8
8
|
@processor.stub(:workspace).and_return(workspace)
|
9
9
|
@processor.call
|
10
10
|
|
data/spec/html/spec_helper.rb
CHANGED
@@ -1,28 +1,20 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rad/spec/xhtml'
|
2
3
|
|
3
|
-
|
4
|
+
class Rad::MockTemplateContext
|
5
|
+
inherit Rad::Html::BasicHtmlHelper
|
6
|
+
|
7
|
+
inject workspace: :workspace
|
4
8
|
|
5
|
-
|
6
|
-
class MockTemplateContext
|
7
|
-
inject config: :config, workspace: :workspace
|
8
|
-
|
9
|
-
attr_accessor :output, :capture, :buffer
|
9
|
+
attr_accessor :output, :capture, :buffer
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
def concat value = nil
|
16
|
-
@buffer ||= ""
|
17
|
-
@buffer << value
|
18
|
-
nil
|
19
|
-
end
|
20
|
-
|
21
|
-
inherit Rad::BasicHtmlHelper
|
22
|
-
# include BasicHtmlHelper, FlashHelper, FormHelper, JavascriptHelper, UrlHelper
|
11
|
+
def capture &block
|
12
|
+
block.call
|
23
13
|
end
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
14
|
+
|
15
|
+
def concat value = nil
|
16
|
+
@buffer ||= ""
|
17
|
+
@buffer << value
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
end
|
data/spec/http/http_spec.rb
CHANGED
@@ -1,46 +1,25 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "
|
4
|
-
|
3
|
+
describe "Http basics" do
|
4
|
+
with_prepare_params
|
5
|
+
inject environment: :environment, conveyors: :conveyors
|
5
6
|
|
6
|
-
|
7
|
-
with_environment environment: :development, runtime_dir: "#{the_spec_dir}/app/runtime"
|
7
|
+
isolate :conveyors
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
before :all do
|
16
|
-
rad.after :environment do
|
17
|
-
rad.conveyors.web do |web|
|
18
|
-
web.use Rad::Processors::HttpWriter
|
19
|
-
web.use Rad::Processors::PrepareParams
|
20
|
-
web.use Rad::Processors::EvaluateFormat
|
21
|
-
end
|
9
|
+
before do
|
10
|
+
rad.conveyors.web do |web|
|
11
|
+
web.use Rad::Http::Processors::HttpWriter
|
12
|
+
web.use Rad::Http::Processors::PrepareParams
|
13
|
+
web.use Rad::Http::Processors::EvaluateFormat
|
22
14
|
end
|
23
15
|
end
|
24
|
-
|
25
|
-
after :all do
|
26
|
-
remove_constants %w(PrepareParamsStub)
|
27
|
-
end
|
28
|
-
|
29
|
-
before :each do
|
30
|
-
load "app/init.rb"
|
31
|
-
end
|
32
|
-
|
33
|
-
it "public symlink" do
|
34
|
-
rad[:environment]
|
35
|
-
rad.config.environment.should == 'development'
|
36
|
-
File.should exist("#{spec_dir}/app/runtime/public/plugin_b")
|
37
|
-
end
|
38
|
-
|
16
|
+
|
39
17
|
it "http call" do
|
40
18
|
workspace = nil
|
41
|
-
|
19
|
+
|
20
|
+
rad.http.call rad.http.mock_environment do |c|
|
42
21
|
c.call
|
43
|
-
workspace = rad
|
22
|
+
workspace = rad.workspace
|
44
23
|
end
|
45
24
|
# .should == [200, {"Content-Type" => "text/html"}, ""]
|
46
25
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "
|
3
|
+
describe "Http basics" do
|
4
4
|
it "response should accept string status messages" do
|
5
|
-
response = Rad::Response.new
|
5
|
+
response = Rad::Http::Response.new
|
6
6
|
|
7
7
|
response.status = :error
|
8
8
|
response.status.should == 500
|
File without changes
|
@@ -1,19 +1,17 @@
|
|
1
|
-
require "
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
|
-
describe "
|
4
|
-
with_environment
|
5
|
-
with_mail
|
3
|
+
describe "MailerController" do
|
6
4
|
with_view_path "#{spec_dir}/views"
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
isolate :conveyors
|
7
|
+
|
8
|
+
before{load 'rad/profiles/mailer.rb'}
|
11
9
|
|
12
10
|
after :all do
|
13
|
-
remove_constants %w(
|
14
|
-
MailController
|
11
|
+
remove_constants %w(
|
15
12
|
ExplicitBodySpec
|
16
13
|
BodyTemplateSpec
|
14
|
+
CopyParamsSpec
|
17
15
|
)
|
18
16
|
end
|
19
17
|
|
@@ -24,7 +22,7 @@ describe "MailController" do
|
|
24
22
|
describe "building letter" do
|
25
23
|
it "shouldn't render view if body explicitly specified" do
|
26
24
|
class ::ExplicitBodySpec
|
27
|
-
inherit
|
25
|
+
inherit Rad::Mailer::MailerController
|
28
26
|
|
29
27
|
def signup model
|
30
28
|
@from, @to, @subject = model.from, model.to, model.subject
|
@@ -38,7 +36,7 @@ describe "MailController" do
|
|
38
36
|
|
39
37
|
it "should use template for body" do
|
40
38
|
class ::BodyTemplateSpec
|
41
|
-
inherit
|
39
|
+
inherit Rad::Mailer::MailerController
|
42
40
|
|
43
41
|
def signup model, name
|
44
42
|
@name = name
|
@@ -49,10 +47,36 @@ describe "MailController" do
|
|
49
47
|
letter = BodyTemplateSpec.signup(common_letter, "Ben")
|
50
48
|
letter.to_h.to_openobject.should == common_letter.merge(body: 'Hello Ben, signup notification.')
|
51
49
|
end
|
50
|
+
|
51
|
+
it "should copy workspace variables from current :cycle (from error, all checks important, don't delete anything!)" do
|
52
|
+
class ::CopyParamsSpec
|
53
|
+
inherit Rad::Mailer::MailerController
|
54
|
+
|
55
|
+
def signup model
|
56
|
+
@from, @to, @subject = model.from, model.to, model.subject
|
57
|
+
@body = "language: #{params.l}, key: #{workspace.key}, space: #{rad.space}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
rad.register :space, scope: :cycle
|
62
|
+
|
63
|
+
letter = nil
|
64
|
+
rad.activate :cycle, {} do
|
65
|
+
rad.space = 'space'
|
66
|
+
w = rad.workspace = Rad::Conveyors::Workspace.new
|
67
|
+
w.key = 'value'
|
68
|
+
w.params = Rad::Conveyors::Params.new
|
69
|
+
w.params.l = 'ru'
|
70
|
+
|
71
|
+
letter = CopyParamsSpec.signup(common_letter)
|
72
|
+
end
|
73
|
+
|
74
|
+
letter.to_h.to_openobject.should == common_letter.merge(body: 'language: ru, key: value, space: space')
|
75
|
+
end
|
52
76
|
end
|
53
77
|
|
54
78
|
it "delivering" do
|
55
|
-
letter = Rad::Letter.new common_letter.merge(body: "some text")
|
79
|
+
letter = Rad::Mailer::Letter.new common_letter.merge(body: "some text")
|
56
80
|
letter.deliver
|
57
81
|
letter.deliver
|
58
82
|
|
data/spec/remote/remote_spec.rb
CHANGED
@@ -1,12 +1,28 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "Remote Basic" do
|
4
|
-
|
5
|
-
|
4
|
+
isolate :conveyors
|
5
|
+
|
6
|
+
before do
|
7
|
+
rad.conveyors.services do |ss|
|
8
|
+
ss.use Rad::Remote::Processors::RemoteCaller, :content
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
old_mode = rad.mode
|
13
|
+
after :all do
|
14
|
+
remove_constants %w(
|
15
|
+
BasicSpec
|
16
|
+
JsonErrorSpec
|
17
|
+
UnregisteredReturnValueSpec
|
18
|
+
)
|
19
|
+
|
20
|
+
rad.mode = old_mode, true
|
21
|
+
end
|
6
22
|
|
7
23
|
it "basic" do
|
8
24
|
class BasicSpec
|
9
|
-
inherit Rad::Remote
|
25
|
+
inherit Rad::Remote::RemoteController
|
10
26
|
|
11
27
|
def call
|
12
28
|
{result: 'some result'}
|
@@ -31,15 +47,14 @@ describe "Remote Basic" do
|
|
31
47
|
describe "error handling should behave different in :production, :development and :test modes" do
|
32
48
|
it "error in :development mode" do
|
33
49
|
class JsonErrorSpec
|
34
|
-
inherit Rad::Remote
|
50
|
+
inherit Rad::Remote::RemoteController
|
35
51
|
|
36
52
|
def call_with_error
|
37
53
|
raise 'some error'
|
38
54
|
end
|
39
55
|
end
|
40
56
|
|
41
|
-
|
42
|
-
silence_logger!
|
57
|
+
rad.mode = :development, true
|
43
58
|
|
44
59
|
workspace = rcall JsonErrorSpec, 'call_with_error', format: 'json'
|
45
60
|
|
@@ -61,7 +76,7 @@ describe "Remote Basic" do
|
|
61
76
|
|
62
77
|
it "should not allow unregistered object types be used as return value" do
|
63
78
|
class UnregisteredReturnValueSpec
|
64
|
-
inherit Rad::Remote
|
79
|
+
inherit Rad::Remote::RemoteController
|
65
80
|
|
66
81
|
def call
|
67
82
|
Object.new
|