browsercms 3.4.2 → 3.5.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -0
- data/app/assets/images/cms/file-uploading.gif +0 -0
- data/app/assets/javascripts/cms/application.js +1 -0
- data/app/assets/javascripts/cms/attachment_manager.js.erb +87 -0
- data/app/assets/javascripts/cms/core_library.js.erb +38 -25
- data/app/assets/stylesheets/cms/application.css.erb +1 -0
- data/app/assets/stylesheets/cms/attachment_manager.css.scss +28 -0
- data/app/controllers/cms/application_controller.rb +1 -1
- data/app/controllers/cms/attachments_controller.rb +45 -10
- data/app/controllers/cms/cache_controller.rb +1 -1
- data/app/controllers/cms/content_block_controller.rb +134 -122
- data/app/controllers/cms/content_controller.rb +143 -155
- data/app/controllers/cms/dashboard_controller.rb +11 -9
- data/app/controllers/cms/error_handling.rb +19 -7
- data/app/controllers/cms/file_blocks_controller.rb +2 -2
- data/app/controllers/cms/home_controller.rb +3 -0
- data/app/controllers/cms/section_nodes_controller.rb +52 -44
- data/app/controllers/cms/sections_controller.rb +4 -2
- data/app/controllers/cms/toolbar_controller.rb +14 -10
- data/app/helpers/cms/application_helper.rb +23 -19
- data/app/helpers/cms/form_builder.rb +65 -18
- data/app/helpers/cms/mobile_helper.rb +19 -0
- data/app/helpers/cms/path_helper.rb +30 -4
- data/app/helpers/cms/rendering_helper.rb +9 -1
- data/app/models/cms/abstract_file_block.rb +6 -6
- data/app/models/cms/attachment.rb +196 -107
- data/app/models/cms/category.rb +3 -0
- data/app/models/cms/category_type.rb +2 -0
- data/app/models/cms/connector.rb +3 -0
- data/app/models/cms/content_type.rb +3 -0
- data/app/models/cms/content_type_group.rb +2 -0
- data/app/models/cms/dynamic_view.rb +4 -0
- data/app/models/cms/email_message.rb +2 -0
- data/app/models/cms/file_block.rb +9 -2
- data/app/models/cms/group.rb +5 -2
- data/app/models/cms/group_permission.rb +2 -0
- data/app/models/cms/group_section.rb +3 -0
- data/app/models/cms/group_type.rb +2 -0
- data/app/models/cms/group_type_permission.rb +2 -0
- data/app/models/cms/html_block.rb +3 -2
- data/app/models/cms/image_block.rb +13 -2
- data/app/models/cms/page.rb +14 -3
- data/app/models/cms/page_route.rb +4 -0
- data/app/models/cms/page_route_condition.rb +1 -0
- data/app/models/cms/page_route_option.rb +2 -0
- data/app/models/cms/page_route_requirement.rb +1 -0
- data/app/models/cms/permission.rb +3 -0
- data/app/models/cms/portlet.rb +2 -2
- data/app/models/cms/redirect.rb +2 -0
- data/app/models/cms/section.rb +15 -1
- data/app/models/cms/section_node.rb +1 -0
- data/app/models/cms/site.rb +3 -0
- data/app/models/cms/tag.rb +2 -0
- data/app/models/cms/tagging.rb +3 -0
- data/app/models/cms/task.rb +5 -1
- data/app/models/cms/user.rb +1 -1
- data/app/models/cms/user_group_membership.rb +3 -0
- data/app/views/cms/attachments/_attachment.html.erb +14 -0
- data/app/views/cms/attachments/_attachment_table.html.erb +17 -0
- data/app/views/cms/attachments/_attachment_wrapper.html.erb +4 -0
- data/app/views/cms/blocks/index.html.erb +2 -3
- data/app/views/cms/blocks/show.html.erb +1 -1
- data/app/views/cms/dynamic_views/index.html.erb +1 -1
- data/app/views/cms/email_messages/index.html.erb +1 -1
- data/app/views/cms/file_blocks/_form.html.erb +1 -27
- data/app/views/cms/file_blocks/_section_selector.html.erb +13 -0
- data/app/views/cms/file_blocks/render.html.erb +3 -3
- data/app/views/cms/form_builder/_cms_attachment_manager.html.erb +26 -0
- data/app/views/cms/form_builder/_cms_file_field.html.erb +27 -35
- data/app/views/cms/groups/index.html.erb +1 -1
- data/app/views/cms/image_blocks/_form.html.erb +1 -27
- data/app/views/cms/image_blocks/render.html.erb +4 -1
- data/app/views/cms/page_routes/index.html.erb +3 -0
- data/app/views/cms/shared/error.xml.erb +8 -0
- data/app/views/cms/tags/render.html.erb +1 -1
- data/app/views/cms/toolbar/_mobile_toggle.html.erb +33 -0
- data/app/views/cms/users/index.html.erb +1 -1
- data/app/views/layouts/_page_toolbar.html.erb +2 -1
- data/bin/bcms +21 -26
- data/config/routes.rb +3 -2
- data/db/browsercms.seeds.rb +2 -1
- data/db/migrate/20111130221145_browsercms340.rb +5 -4
- data/db/migrate/20120329144406_browsercms350.rb +32 -0
- data/{test/dummy/db → db}/schema.rb +97 -128
- data/{performance_tuning_notes.md → doc/performance_tuning_notes.md} +0 -0
- data/doc/release_notes.md +74 -0
- data/lib/browsercms.rb +3 -0
- data/lib/cms/acts/content_block.rb +10 -2
- data/lib/cms/addressable.rb +8 -0
- data/lib/cms/attachments/attachment_serving.rb +59 -0
- data/lib/cms/attachments/configuration.rb +88 -0
- data/lib/cms/behaviors/attaching.rb +305 -136
- data/lib/cms/behaviors/connecting.rb +3 -4
- data/lib/cms/behaviors/dynamic_attributes.rb +121 -118
- data/lib/cms/behaviors/flush_cache_on_change.rb +1 -3
- data/lib/cms/behaviors/naming.rb +16 -0
- data/lib/cms/behaviors/pagination.rb +4 -1
- data/lib/cms/behaviors/publishing.rb +9 -3
- data/lib/cms/behaviors/searching.rb +3 -8
- data/lib/cms/behaviors/soft_deleting.rb +1 -0
- data/lib/cms/behaviors/taggable.rb +2 -0
- data/lib/cms/behaviors/versioning.rb +73 -120
- data/lib/cms/caching.rb +53 -11
- data/lib/cms/commands/actions.rb +19 -2
- data/lib/cms/configuration.rb +44 -0
- data/lib/cms/content_rendering_support.rb +9 -6
- data/lib/cms/default_accessible.rb +13 -0
- data/lib/cms/domain_support.rb +22 -0
- data/lib/cms/engine.rb +40 -19
- data/lib/cms/engine_helper.rb +54 -0
- data/lib/cms/extensions/active_record/connection_adapters/abstract/schema_statements.rb +14 -2
- data/lib/cms/mobile_aware.rb +67 -0
- data/lib/cms/route_extensions.rb +3 -0
- data/lib/cms/upgrades/v3_5_0.rb +155 -0
- data/lib/cms/version.rb +6 -1
- data/lib/generators/cms/content_block/content_block_generator.rb +14 -9
- data/lib/generators/cms/content_block/templates/_form.html.erb +17 -6
- data/lib/generators/cms/content_block/templates/render.html.erb +12 -5
- data/lib/generators/cms/template/template_generator.rb +11 -2
- data/lib/tasks/cms.rake +23 -0
- data/lib/templates/active_record/model/model.rb +6 -0
- metadata +127 -517
- data/.gitignore +0 -24
- data/.rvmrc +0 -2
- data/Gemfile +0 -29
- data/Gemfile.lock +0 -196
- data/Rakefile +0 -97
- data/app/assets/images/browsercms/.gitkeep +0 -0
- data/app/controllers/browsercms/application_controller.rb +0 -4
- data/browsercms.gemspec +0 -35
- data/config/cucumber.yml +0 -8
- data/config/database.jdbcmysql.yml +0 -30
- data/config/database.mysql.yml +0 -27
- data/config/database.postgres.yml +0 -25
- data/config/database.sqlite3.yml +0 -11
- data/config/environment.rb +0 -6
- data/config/initializers/query_reviewer_patch.rb +0 -12
- data/config/initializers/rack_1_2_1_patch.rb +0 -12
- data/config/locales/en.yml +0 -5
- data/features/acts_as_content_page.feature +0 -62
- data/features/add_content_to_pages.feature +0 -45
- data/features/caching.feature +0 -13
- data/features/ckeditor.feature +0 -11
- data/features/commands/confirm_aruba_works.feature +0 -24
- data/features/commands/generate_module.feature +0 -54
- data/features/commands/install_browsercms.feature +0 -21
- data/features/commands/new_demo_project.feature +0 -30
- data/features/commands/new_projects.feature +0 -50
- data/features/commands/upgrade_modules_to_3_4_0_from_3_1_x.feature +0 -19
- data/features/commands/upgrade_project_to_3_4_0_from_3_3_x.feature +0 -52
- data/features/commands/upgrading_modules.feature +0 -67
- data/features/content_blocks/manage_custom_blocks.feature +0 -67
- data/features/content_blocks/manage_html_blocks.feature +0 -48
- data/features/content_blocks/manage_image_blocks.feature +0 -41
- data/features/content_files.feature +0 -37
- data/features/content_pages.feature +0 -21
- data/features/generators/content_blocks_for_modules.feature +0 -58
- data/features/generators/content_blocks_for_projects.feature +0 -109
- data/features/install_content.feature +0 -25
- data/features/jquery-testplan.txt +0 -12
- data/features/manage_groups.feature +0 -33
- data/features/manage_page_routes.feature +0 -72
- data/features/manage_redirects.feature +0 -20
- data/features/manage_sections.feature +0 -12
- data/features/manage_tasks.feature +0 -25
- data/features/manage_users.feature +0 -38
- data/features/page_templates.feature +0 -49
- data/features/portlets/email_friend_portlet.feature +0 -29
- data/features/portlets/portlets.feature +0 -100
- data/features/portlets/tag_cloud_portlet.feature +0 -28
- data/features/sitemap/create_pages.feature +0 -15
- data/features/sitemap/manage_links.feature +0 -29
- data/features/sitemap/sitemap.feature +0 -18
- data/features/step_definitions/acts_as_content_page_steps.rb.rb +0 -3
- data/features/step_definitions/ckeditor_steps.rb +0 -13
- data/features/step_definitions/command_line_steps.rb +0 -212
- data/features/step_definitions/content_pages_steps.rb +0 -170
- data/features/step_definitions/data_steps.rb +0 -48
- data/features/step_definitions/edit_page_templates_steps.rb +0 -21
- data/features/step_definitions/html_blocks_steps.rb +0 -9
- data/features/step_definitions/install_content_steps.rb +0 -4
- data/features/step_definitions/manage_content_blocks_steps.rb +0 -26
- data/features/step_definitions/manage_image_blocks_steps.rb +0 -31
- data/features/step_definitions/manage_sections_steps.rb +0 -18
- data/features/step_definitions/manage_user_steps.rb +0 -22
- data/features/step_definitions/more_custom_block_steps.rb +0 -34
- data/features/step_definitions/page_route_steps.rb +0 -65
- data/features/step_definitions/page_template_steps.rb +0 -5
- data/features/step_definitions/permissions_steps.rb +0 -13
- data/features/step_definitions/portlets_steps.rb +0 -64
- data/features/step_definitions/redirect_steps.rb +0 -12
- data/features/step_definitions/sitemap_steps.rb +0 -18
- data/features/step_definitions/tag_cloud_steps.rb +0 -11
- data/features/step_definitions/task_steps.rb +0 -4
- data/features/step_definitions/taxonomy_steps.rb +0 -16
- data/features/step_definitions/upgrade_module_steps.rb +0 -76
- data/features/step_definitions/web_steps.rb +0 -211
- data/features/support/async_support.rb +0 -17
- data/features/support/command_line_helpers.rb +0 -63
- data/features/support/debug_formatter.rb +0 -7
- data/features/support/debugging.rb +0 -28
- data/features/support/env.rb +0 -73
- data/features/support/git_api.rb +0 -9
- data/features/support/open_on_first_failure.rb +0 -25
- data/features/support/paths.rb +0 -32
- data/features/support/rails_api.rb +0 -8
- data/features/support/selectors.rb +0 -39
- data/features/support/transforms.rb +0 -7
- data/features/taxonomy/add_content_with_category.feature +0 -30
- data/features/taxonomy/manage_categories.feature +0 -20
- data/features/taxonomy/manage_category_types.feature +0 -16
- data/lib/cms/init.rb +0 -105
- data/lib/tasks/data.rake +0 -43
- data/lib/tasks/db.rake +0 -82
- data/public/styled_file_field/index.html +0 -72
- data/script/cucumber +0 -10
- data/script/rails +0 -6
- data/test/console_helper.rb +0 -5
- data/test/custom_assertions.rb +0 -84
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -9
- data/test/dummy/app/assets/javascripts/content_page.js +0 -2
- data/test/dummy/app/assets/stylesheets/application.css +0 -7
- data/test/dummy/app/assets/stylesheets/content_page.css +0 -4
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/controllers/cms/products_controller.rb +0 -2
- data/test/dummy/app/controllers/cms/sample_blocks_controller.rb +0 -3
- data/test/dummy/app/controllers/content_page_controller.rb +0 -13
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/helpers/content_page_helper.rb +0 -2
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/models/cms/sample_block.rb +0 -22
- data/test/dummy/app/models/product.rb +0 -5
- data/test/dummy/app/views/cms/products/_form.html.erb +0 -7
- data/test/dummy/app/views/cms/products/render.html.erb +0 -3
- data/test/dummy/app/views/content_page/custom_page.html.erb +0 -3
- data/test/dummy/app/views/content_page/index.html.erb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/app/views/layouts/templates/default.html.erb +0 -17
- data/test/dummy/app/views/layouts/templates/subpage.html.erb +0 -16
- data/test/dummy/app/views/test_route/index.html.erb +0 -14
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -45
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -27
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -32
- data/test/dummy/config/environments/production.rb +0 -60
- data/test/dummy/config/environments/test.rb +0 -46
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/browsercms.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -10
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/quiet_sprocket_assets.rb +0 -13
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -23
- data/test/dummy/db/migrate/20111228141250_create_products.rb +0 -16
- data/test/dummy/db/seeds.rb +0 -1
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -26
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/dummy/test/functional/content_page_controller_test.rb +0 -9
- data/test/dummy/test/unit/helpers/content_page_helper_test.rb +0 -4
- data/test/factories.rb +0 -235
- data/test/fixtures/multipart/foo.jpg +0 -0
- data/test/fixtures/multipart/sample_upload.txt +0 -1
- data/test/fixtures/multipart/second_upload.txt +0 -1
- data/test/fixtures/multipart/test.jpg +0 -0
- data/test/fixtures/multipart/version1.txt +0 -1
- data/test/fixtures/multipart/version2.txt +0 -1
- data/test/functional/cms/cache_controller_test.rb +0 -16
- data/test/functional/cms/categories_controller_test.rb +0 -28
- data/test/functional/cms/connectors_controller_test.rb +0 -64
- data/test/functional/cms/content_block_controller_test.rb +0 -127
- data/test/functional/cms/content_controller_test.rb +0 -351
- data/test/functional/cms/dashboard_controller_test.rb +0 -20
- data/test/functional/cms/file_blocks_controller_test.rb +0 -55
- data/test/functional/cms/home_controller_test.rb +0 -160
- data/test/functional/cms/html_blocks_controller_test.rb +0 -159
- data/test/functional/cms/image_blocks_controller_test.rb +0 -78
- data/test/functional/cms/links_controller_test.rb +0 -92
- data/test/functional/cms/log/test.log +0 -0
- data/test/functional/cms/pages_controller_test.rb +0 -233
- data/test/functional/cms/portlets_controller_test.rb +0 -57
- data/test/functional/cms/sections_controller_test.rb +0 -234
- data/test/functional/cms/sessions_controller_test.rb +0 -80
- data/test/functional/cms/tasks_controller_test.rb +0 -64
- data/test/functional/cms/toolbar_controller_test.rb +0 -76
- data/test/functional/cms/users_controller_test.rb +0 -218
- data/test/integration/cms/password_management_test.rb +0 -66
- data/test/integration/sitemap_performance_test.rb +0 -26
- data/test/mock_file.rb +0 -33
- data/test/performance/browsing_test.rb +0 -9
- data/test/support/engine_controller_hacks.rb +0 -34
- data/test/support/factory_helpers.rb +0 -57
- data/test/support/rails_3_1_routes_hack.rb +0 -70
- data/test/test_helper.rb +0 -199
- data/test/test_logging.rb +0 -67
- data/test/unit/active_record_callbacks.rb +0 -50
- data/test/unit/behaviors/attaching_test.rb +0 -370
- data/test/unit/behaviors/cms_user_test.rb +0 -67
- data/test/unit/behaviors/connectable_test.rb +0 -32
- data/test/unit/behaviors/connecting_test.rb +0 -56
- data/test/unit/behaviors/dynamic_attributes_test.rb +0 -74
- data/test/unit/behaviors/namespacing_test.rb +0 -76
- data/test/unit/behaviors/publishable_test.rb +0 -83
- data/test/unit/behaviors/rendering_test.rb +0 -68
- data/test/unit/behaviors/searching_test.rb +0 -102
- data/test/unit/behaviors/taggable_test.rb +0 -110
- data/test/unit/behaviors/userstamping_test.rb +0 -27
- data/test/unit/behaviors/versioning_test.rb +0 -102
- data/test/unit/extensions/active_record/base_test.rb +0 -25
- data/test/unit/extensions/hash_test.rb +0 -26
- data/test/unit/extensions/integer_test.rb +0 -10
- data/test/unit/extensions/string_test.rb +0 -14
- data/test/unit/factories_test.rb +0 -50
- data/test/unit/generators/install_generator_test.rb +0 -15
- data/test/unit/helpers/application_helper_test.rb +0 -104
- data/test/unit/helpers/date_picker_test.rb +0 -17
- data/test/unit/helpers/menu_helper_test.rb +0 -240
- data/test/unit/helpers/page_helper_test.rb +0 -69
- data/test/unit/helpers/path_helper_test.rb +0 -38
- data/test/unit/helpers/rendering_helper_test.rb +0 -8
- data/test/unit/lib/acts_as_content_page_test.rb +0 -72
- data/test/unit/lib/cms/authentication/controller_test.rb +0 -20
- data/test/unit/lib/cms/engine_helper_test.rb +0 -119
- data/test/unit/lib/cms/sitemap_test.rb +0 -210
- data/test/unit/lib/cms_domain_support_test.rb +0 -44
- data/test/unit/lib/command_line_test.rb +0 -70
- data/test/unit/lib/content_block_test.rb +0 -304
- data/test/unit/lib/content_rendering_support_test.rb +0 -40
- data/test/unit/lib/generators_test.rb +0 -40
- data/test/unit/lib/routes_test.rb +0 -98
- data/test/unit/mock_file_test.rb +0 -19
- data/test/unit/models/attachment_test.rb +0 -160
- data/test/unit/models/category_test.rb +0 -40
- data/test/unit/models/category_type_test.rb +0 -8
- data/test/unit/models/connector_test.rb +0 -152
- data/test/unit/models/content_type_group_test.rb +0 -26
- data/test/unit/models/content_type_test.rb +0 -177
- data/test/unit/models/dynamic_views_test.rb +0 -36
- data/test/unit/models/email_page_portlet_test.rb +0 -20
- data/test/unit/models/file_block_test.rb +0 -246
- data/test/unit/models/group_test.rb +0 -29
- data/test/unit/models/html_block_test.rb +0 -121
- data/test/unit/models/image_block_test.rb +0 -35
- data/test/unit/models/link_test.rb +0 -52
- data/test/unit/models/namespaces_test.rb +0 -57
- data/test/unit/models/page_partial_test.rb +0 -37
- data/test/unit/models/page_route_test.rb +0 -113
- data/test/unit/models/page_template_test.rb +0 -50
- data/test/unit/models/page_test.rb +0 -879
- data/test/unit/models/permission_test.rb +0 -10
- data/test/unit/models/portlet_test.rb +0 -99
- data/test/unit/models/sections_test.rb +0 -278
- data/test/unit/models/site_test.rb +0 -50
- data/test/unit/models/task_test.rb +0 -150
- data/test/unit/models/user_test.rb +0 -358
- data/test/unit/schema_statements_test.rb +0 -137
- data/todo_list.markdown +0 -50
@@ -1,20 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
require 'mocha'
|
3
|
-
|
4
|
-
class ProtectedController < ActionController::Base
|
5
|
-
include Cms::Authentication::Controller
|
6
|
-
end
|
7
|
-
|
8
|
-
class ControllerTest < ActiveSupport::TestCase
|
9
|
-
|
10
|
-
test "Sets current user in thread local" do
|
11
|
-
u = Cms::User.new()
|
12
|
-
|
13
|
-
c = ProtectedController.new
|
14
|
-
c.expects(:session).returns({})
|
15
|
-
|
16
|
-
c.send(:current_user=, u)
|
17
|
-
|
18
|
-
assert_equal u, Cms::User.current
|
19
|
-
end
|
20
|
-
end
|
@@ -1,119 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module Cms
|
4
|
-
class CoreContentBlock
|
5
|
-
include EngineHelper
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
class MainAppThing
|
10
|
-
include Cms::EngineHelper
|
11
|
-
end
|
12
|
-
|
13
|
-
class NewThing
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
module BcmsWidgets
|
18
|
-
class Engine < Rails::Engine
|
19
|
-
end
|
20
|
-
class ContentBlock
|
21
|
-
include Cms::EngineHelper
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class BcmsParts
|
26
|
-
class ContentThing
|
27
|
-
include Cms::EngineHelper
|
28
|
-
end
|
29
|
-
end
|
30
|
-
module Cms
|
31
|
-
class EngineHelperTest < ActiveSupport::TestCase
|
32
|
-
|
33
|
-
def setup
|
34
|
-
@cms_block = Cms::CoreContentBlock.new
|
35
|
-
@main_app_block = MainAppThing.new
|
36
|
-
end
|
37
|
-
|
38
|
-
test "main_app?" do
|
39
|
-
assert_equal true, @main_app_block.main_app_model?
|
40
|
-
assert_equal false, @cms_block.main_app_model?
|
41
|
-
assert_equal false, BcmsWidgets::ContentBlock.new.main_app_model?
|
42
|
-
end
|
43
|
-
|
44
|
-
test "If there is no Engine, engine_name should be the main app." do
|
45
|
-
assert_equal "main_app", BcmsParts::ContentThing.new.engine_name
|
46
|
-
end
|
47
|
-
|
48
|
-
test "Module Name" do
|
49
|
-
assert_equal "Cms", EngineHelper.module_name(Cms::CoreContentBlock)
|
50
|
-
assert_nil EngineHelper.module_name(NewThing)
|
51
|
-
assert_equal "BcmsWidgets", EngineHelper.module_name(BcmsWidgets::ContentBlock)
|
52
|
-
end
|
53
|
-
|
54
|
-
test "path_for_widget" do
|
55
|
-
name = BcmsWidgets::ContentBlock.new.engine_name
|
56
|
-
assert_not_nil name
|
57
|
-
assert_equal BcmsWidgets::Engine.engine_name, name
|
58
|
-
end
|
59
|
-
|
60
|
-
test "Decorate" do
|
61
|
-
n = NewThing.new
|
62
|
-
EngineHelper.decorate(n)
|
63
|
-
assert_equal true, n.respond_to?(:engine_name)
|
64
|
-
end
|
65
|
-
|
66
|
-
test "Decorate class" do
|
67
|
-
EngineHelper.decorate(NewThing)
|
68
|
-
assert_equal true, NewThing.respond_to?(:engine_name)
|
69
|
-
end
|
70
|
-
|
71
|
-
test "Don't decorate twice'" do
|
72
|
-
class DecorateOnce
|
73
|
-
include EngineHelper
|
74
|
-
|
75
|
-
def engine_name
|
76
|
-
"Original"
|
77
|
-
end
|
78
|
-
end
|
79
|
-
subject = DecorateOnce.new
|
80
|
-
EngineHelper.decorate(subject)
|
81
|
-
assert_equal "Original", subject.engine_name
|
82
|
-
|
83
|
-
end
|
84
|
-
test "Engine Name" do
|
85
|
-
assert_equal "cms", Cms::Engine.engine_name
|
86
|
-
end
|
87
|
-
|
88
|
-
test "calculate engine_name" do
|
89
|
-
assert_equal "cms", Cms::CoreContentBlock.new.engine_name
|
90
|
-
end
|
91
|
-
|
92
|
-
test "Blocks without namespace should be in main app" do
|
93
|
-
assert_equal "main_app", MainAppThing.new.engine_name
|
94
|
-
end
|
95
|
-
|
96
|
-
test "path_elements for an instance of a class in an application" do
|
97
|
-
assert_equal ["cms", @main_app_block], @main_app_block.path_elements
|
98
|
-
end
|
99
|
-
|
100
|
-
test "path_elements for a class in an application" do
|
101
|
-
MainAppThing.extend EngineHelper
|
102
|
-
assert_equal ["cms", MainAppThing], MainAppThing.path_elements
|
103
|
-
end
|
104
|
-
|
105
|
-
test "path_elements for an instance of in Cms namespace" do
|
106
|
-
assert_equal [@cms_block], @cms_block.path_elements
|
107
|
-
end
|
108
|
-
|
109
|
-
test "path_elements for a class in Cms namespace" do
|
110
|
-
Cms::CoreContentBlock.extend EngineHelper
|
111
|
-
assert_equal [Cms::CoreContentBlock], Cms::CoreContentBlock.path_elements
|
112
|
-
end
|
113
|
-
|
114
|
-
test "path_elements for a class in a module" do
|
115
|
-
BcmsWidgets::ContentBlock.extend EngineHelper
|
116
|
-
assert_equal [BcmsWidgets::ContentBlock], BcmsWidgets::ContentBlock.path_elements
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
@@ -1,210 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module Cms
|
4
|
-
class MoveSections < ActiveSupport::TestCase
|
5
|
-
|
6
|
-
def setup
|
7
|
-
@root = Factory(:root_section)
|
8
|
-
@parent = Factory(:section, :parent => @root, :name => "Parent")
|
9
|
-
@a = Factory(:section, :parent => @parent, :name => "A")
|
10
|
-
@a1 = Factory(:page, :section => @a, :name => "A1")
|
11
|
-
@a2 = Factory(:page, :section => @a, :name => "A2")
|
12
|
-
@a3 = Factory(:page, :section => @a, :name => "A3")
|
13
|
-
@b = Factory(:section, :parent => @parent, :name => "B")
|
14
|
-
@b1 = Factory(:page, :section => @b, :name => "B1")
|
15
|
-
@b2 = Factory(:page, :section => @b, :name => "B2")
|
16
|
-
@b3 = Factory(:page, :section => @b, :name => "B3")
|
17
|
-
|
18
|
-
@node_a = @a.node
|
19
|
-
@node_b = @b.node
|
20
|
-
@node_a1 = @a1.section_node
|
21
|
-
@node_a2 = @a2.section_node
|
22
|
-
@node_a3 = @a3.section_node
|
23
|
-
@node_b1 = @b1.section_node
|
24
|
-
@node_b2 = @b2.section_node
|
25
|
-
@node_b3 = @b3.section_node
|
26
|
-
reset(:node_a, :node_a1, :node_a2, :node_a3, :node_b, :node_b1, :node_b2, :node_b3)
|
27
|
-
|
28
|
-
# Use this to print out complete table data
|
29
|
-
# log_table_without_stamps(SectionNode)
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_reorder_nodes_within_same_section
|
33
|
-
@node_a2.move_to(@a, 1)
|
34
|
-
reset(:node_a, :node_a1, :node_a2, :node_a3, :node_b, :node_b1, :node_b2, :node_b3)
|
35
|
-
assert_properties(@node_a, :ancestry => ancestry_for(@parent), :node_type => "Cms::Section", :node_id => @a.id, :position => 1)
|
36
|
-
assert_properties(@node_b, :ancestry => ancestry_for(@parent), :node_type => "Cms::Section", :node_id => @b.id, :position => 2)
|
37
|
-
assert_properties(@node_a1, :ancestry => ancestry_for(@a), :node_type => "Cms::Page", :node_id => @a1.id, :position => 2)
|
38
|
-
assert_properties(@node_a2, :ancestry => ancestry_for(@a), :node_type => "Cms::Page", :node_id => @a2.id, :position => 1)
|
39
|
-
assert_properties(@node_a3, :ancestry => ancestry_for(@a), :node_type => "Cms::Page", :node_id => @a3.id, :position => 3)
|
40
|
-
assert_properties(@node_b1, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @b1.id, :position => 1)
|
41
|
-
assert_properties(@node_b2, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @b2.id, :position => 2)
|
42
|
-
assert_properties(@node_b3, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @b3.id, :position => 3)
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_move_nodes_to_different_section
|
46
|
-
@node_a2.move_to(@b, 2)
|
47
|
-
reset(:node_a, :node_a1, :node_a2, :node_a3, :node_b, :node_b1, :node_b2, :node_b3)
|
48
|
-
assert_properties(@node_a, :ancestry => ancestry_for(@parent), :node_type => "Cms::Section", :node_id => @a.id, :position => 1)
|
49
|
-
assert_properties(@node_b, :ancestry => ancestry_for(@parent), :node_type => "Cms::Section", :node_id => @b.id, :position => 2)
|
50
|
-
assert_properties(@node_a1, :ancestry => ancestry_for(@a), :node_type => "Cms::Page", :node_id => @a1.id, :position => 1)
|
51
|
-
assert_properties(@node_a2, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @a2.id, :position => 2)
|
52
|
-
assert_properties(@node_a3, :ancestry => ancestry_for(@a), :node_type => "Cms::Page", :node_id => @a3.id, :position => 2)
|
53
|
-
assert_properties(@node_b1, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @b1.id, :position => 1)
|
54
|
-
assert_properties(@node_b2, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @b2.id, :position => 3)
|
55
|
-
assert_properties(@node_b3, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @b3.id, :position => 4)
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_move_nodes_to_beginning_of_different_section
|
59
|
-
@node_a2.move_to(@b, 1)
|
60
|
-
reset(:node_a, :node_a1, :node_a2, :node_a3, :node_b, :node_b1, :node_b2, :node_b3)
|
61
|
-
assert_properties(@node_a, :ancestry => ancestry_for(@parent), :node_type => "Cms::Section", :node_id => @a.id, :position => 1)
|
62
|
-
assert_properties(@node_b, :ancestry => ancestry_for(@parent), :node_type => "Cms::Section", :node_id => @b.id, :position => 2)
|
63
|
-
assert_properties(@node_a1, :ancestry => ancestry_for(@a), :node_type => "Cms::Page", :node_id => @a1.id, :position => 1)
|
64
|
-
assert_properties(@node_a2, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @a2.id, :position => 1)
|
65
|
-
assert_properties(@node_a3, :ancestry => ancestry_for(@a), :node_type => "Cms::Page", :node_id => @a3.id, :position => 2)
|
66
|
-
assert_properties(@node_b1, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @b1.id, :position => 2)
|
67
|
-
assert_properties(@node_b2, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @b2.id, :position => 3)
|
68
|
-
assert_properties(@node_b3, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @b3.id, :position => 4)
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_move_nodes_to_end_of_different_section
|
72
|
-
@node_a2.move_to(@b, 99)
|
73
|
-
reset(:node_a, :node_a1, :node_a2, :node_a3, :node_b, :node_b1, :node_b2, :node_b3)
|
74
|
-
assert_properties(@node_a, :ancestry => ancestry_for(@parent), :node_type => "Cms::Section", :node_id => @a.id, :position => 1)
|
75
|
-
assert_properties(@node_b, :ancestry => ancestry_for(@parent), :node_type => "Cms::Section", :node_id => @b.id, :position => 2)
|
76
|
-
assert_properties(@node_a1, :ancestry => ancestry_for(@a), :node_type => "Cms::Page", :node_id => @a1.id, :position => 1)
|
77
|
-
assert_properties(@node_a2, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @a2.id, :position => 4)
|
78
|
-
assert_properties(@node_a3, :ancestry => ancestry_for(@a), :node_type => "Cms::Page", :node_id => @a3.id, :position => 2)
|
79
|
-
assert_properties(@node_b1, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @b1.id, :position => 1)
|
80
|
-
assert_properties(@node_b2, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @b2.id, :position => 2)
|
81
|
-
assert_properties(@node_b3, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @b3.id, :position => 3)
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_put_page_at_the_bottom_when_section_is_changed
|
85
|
-
@a2.update_attributes(:section => @b)
|
86
|
-
reset(:node_a, :node_a1, :node_a2, :node_a3, :node_b, :node_b1, :node_b2, :node_b3)
|
87
|
-
assert_properties(@node_a, :ancestry => ancestry_for(@parent), :node_type => "Cms::Section", :node_id => @a.id, :position => 1)
|
88
|
-
assert_properties(@node_b, :ancestry => ancestry_for(@parent), :node_type => "Cms::Section", :node_id => @b.id, :position => 2)
|
89
|
-
assert_properties(@node_a1, :ancestry => ancestry_for(@a), :node_type => "Cms::Page", :node_id => @a1.id, :position => 1)
|
90
|
-
assert_properties(@node_a2, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @a2.id, :position => 4)
|
91
|
-
assert_properties(@node_a3, :ancestry => ancestry_for(@a), :node_type => "Cms::Page", :node_id => @a3.id, :position => 2)
|
92
|
-
assert_properties(@node_b1, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @b1.id, :position => 1)
|
93
|
-
assert_properties(@node_b2, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @b2.id, :position => 2)
|
94
|
-
assert_properties(@node_b3, :ancestry => ancestry_for(@b), :node_type => "Cms::Page", :node_id => @b3.id, :position => 3)
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_find_ancestors
|
98
|
-
assert @root.ancestors.empty?
|
99
|
-
assert_equal [@root], @parent.ancestors
|
100
|
-
assert_equal [@root, @parent], @a.ancestors
|
101
|
-
assert_equal [@root, @parent, @a], @a1.ancestors
|
102
|
-
end
|
103
|
-
|
104
|
-
def ancestry_for(section_or_page)
|
105
|
-
"#{section_or_page.ancestry}/#{section_or_page.node.id}"
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
class SitemapNavTest < ActiveSupport::TestCase
|
110
|
-
|
111
|
-
def setup
|
112
|
-
given_a_site_exists
|
113
|
-
@page = Factory(:public_page, :section => root_section)
|
114
|
-
@link = Factory(:link, :section => root_section)
|
115
|
-
end
|
116
|
-
|
117
|
-
test "access_status" do
|
118
|
-
assert_equal @page.section.status, @page.access_status
|
119
|
-
assert_equal @link.section.status, @link.access_status
|
120
|
-
end
|
121
|
-
|
122
|
-
end
|
123
|
-
class SitemapTest < ActiveSupport::TestCase
|
124
|
-
|
125
|
-
def setup
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
def teardown
|
130
|
-
end
|
131
|
-
|
132
|
-
test "ancestry_path" do
|
133
|
-
section = Factory(:public_section)
|
134
|
-
assert_equal "#{section.parent.node.id}/#{section.node.id}", section.node.ancestry_path
|
135
|
-
end
|
136
|
-
test "Build root section from factory" do
|
137
|
-
root = Factory(:root_section)
|
138
|
-
assert_not_nil root
|
139
|
-
assert root.root?
|
140
|
-
end
|
141
|
-
|
142
|
-
test "Build section with parent = root_section from factory" do
|
143
|
-
section = Factory(:public_section)
|
144
|
-
assert_not_nil section
|
145
|
-
assert_equal false, section.root?
|
146
|
-
assert_equal true, section.parent.root?
|
147
|
-
end
|
148
|
-
|
149
|
-
test "Section has parent based on ancestry" do
|
150
|
-
s = Section.create!(:name => "A", :parent => root, :path => "/a")
|
151
|
-
assert_equal "#{root.node.id}", s.ancestry
|
152
|
-
end
|
153
|
-
|
154
|
-
|
155
|
-
test "Assign Parent sections" do
|
156
|
-
child_section = SectionNode.create!(:parent => root.node)
|
157
|
-
assert_equal "#{root.node.id}", child_section.ancestry
|
158
|
-
assert_equal root.node, child_section.parent
|
159
|
-
end
|
160
|
-
|
161
|
-
test "Each Section has a section node (even the root one)" do
|
162
|
-
r = root
|
163
|
-
assert_not_nil r.node
|
164
|
-
assert_nil r.node.ancestry
|
165
|
-
end
|
166
|
-
|
167
|
-
test "child_nodes" do
|
168
|
-
page = Factory(:page, :section => root)
|
169
|
-
section = Factory :public_section, :parent => root
|
170
|
-
|
171
|
-
assert_equal [page.section_node, section.node], root.child_nodes
|
172
|
-
end
|
173
|
-
|
174
|
-
test "pages" do
|
175
|
-
page1 = Factory(:page, :section => root)
|
176
|
-
page2 = Factory(:page, :section => root)
|
177
|
-
section = Factory :public_section, :parent => root
|
178
|
-
|
179
|
-
assert_equal [page1, page2], root.pages
|
180
|
-
end
|
181
|
-
|
182
|
-
test "child_sections" do
|
183
|
-
page1 = Factory(:page, :section => root)
|
184
|
-
page2 = Factory(:page, :section => root)
|
185
|
-
section = Factory :public_section, :parent => root
|
186
|
-
|
187
|
-
assert_equal [section], root.child_sections
|
188
|
-
end
|
189
|
-
|
190
|
-
test "Order of pages should be unique within each section" do
|
191
|
-
page = Factory(:page, :section => root)
|
192
|
-
assert_equal 1, page.section_node.position
|
193
|
-
|
194
|
-
subsection = Factory(:section, :parent => root)
|
195
|
-
page3 = Factory(:page, :section => subsection)
|
196
|
-
log_table_without_stamps(SectionNode)
|
197
|
-
assert_equal 1, page3.section_node.position
|
198
|
-
end
|
199
|
-
|
200
|
-
test "The root section node has no parent section" do
|
201
|
-
assert_nil SectionNode.new.parent_section
|
202
|
-
end
|
203
|
-
|
204
|
-
private
|
205
|
-
|
206
|
-
def root
|
207
|
-
@root ||= Factory(:root_section)
|
208
|
-
end
|
209
|
-
end
|
210
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
require 'mocha'
|
4
|
-
|
5
|
-
class CmsDomainSupportTest < ActiveSupport::TestCase
|
6
|
-
|
7
|
-
def setup
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
test "cms_site? determines if the first subdomain is 'cms'" do
|
16
|
-
c = Cms::ApplicationController.new
|
17
|
-
request = mock
|
18
|
-
|
19
|
-
c.expects(:request).returns(request)
|
20
|
-
request.expects(:subdomains).returns(["cms"])
|
21
|
-
|
22
|
-
assert c.send :cms_site?
|
23
|
-
end
|
24
|
-
|
25
|
-
test "A url that isn't a cms domain" do
|
26
|
-
c = Cms::ApplicationController.new
|
27
|
-
request = mock
|
28
|
-
|
29
|
-
c.expects(:request).returns(request)
|
30
|
-
request.expects(:subdomains).returns(["www"])
|
31
|
-
|
32
|
-
assert_equal false, c.send(:cms_site?)
|
33
|
-
end
|
34
|
-
|
35
|
-
test "default cms domain" do
|
36
|
-
c = Cms::ApplicationController.new
|
37
|
-
|
38
|
-
assert_equal "cms", c.send(:cms_domain_prefix)
|
39
|
-
end
|
40
|
-
|
41
|
-
test "prepare_for_rendererable" do
|
42
|
-
|
43
|
-
end
|
44
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
require "mocha"
|
3
|
-
|
4
|
-
class CommandLineTest < ActiveSupport::TestCase
|
5
|
-
|
6
|
-
test "Use the correct demo template with '-m demo'" do
|
7
|
-
CommandLine.expects(:template).with("demo.rb").returns("./templates/demo.rb")
|
8
|
-
args = ["-m", "demo"]
|
9
|
-
|
10
|
-
CommandLine.set_template(args)
|
11
|
-
|
12
|
-
assert_equal ["-m", "./templates/demo.rb"], args
|
13
|
-
end
|
14
|
-
|
15
|
-
test "template_file looks up files based on the current directory" do
|
16
|
-
CommandLine.expects(:template_dir).returns("./templates")
|
17
|
-
|
18
|
-
assert_equal "./templates/bar.rb", CommandLine.template("bar.rb")
|
19
|
-
end
|
20
|
-
|
21
|
-
test "ARGV gets replaced" do
|
22
|
-
CommandLine.expects(:template).with("demo.rb").returns("./templates/demo.rb")
|
23
|
-
ARGV = ["-m", "demo"]
|
24
|
-
|
25
|
-
CommandLine.set_template(ARGV)
|
26
|
-
|
27
|
-
assert_equal ["-m", "./templates/demo.rb"], ARGV
|
28
|
-
end
|
29
|
-
|
30
|
-
test "Sets blank template if empty" do
|
31
|
-
CommandLine.expects(:template).with("blank.rb").returns("./templates/blank.rb")
|
32
|
-
args = []
|
33
|
-
|
34
|
-
CommandLine.set_template(args)
|
35
|
-
|
36
|
-
assert_equal ["-m", "./templates/blank.rb"], args
|
37
|
-
end
|
38
|
-
|
39
|
-
test "Sets module template with -m" do
|
40
|
-
CommandLine.expects(:template).with("module.rb").returns("./templates/module.rb")
|
41
|
-
args = ["-m", "module"]
|
42
|
-
|
43
|
-
CommandLine.set_template(args)
|
44
|
-
|
45
|
-
assert_equal ["-m", "./templates/module.rb"], args
|
46
|
-
end
|
47
|
-
|
48
|
-
test "Sets the module template with --template" do
|
49
|
-
CommandLine.expects(:template).with("module.rb").returns("./templates/module.rb")
|
50
|
-
args = ["--template", "module"]
|
51
|
-
|
52
|
-
CommandLine.set_template(args)
|
53
|
-
|
54
|
-
assert_equal ["--template", "./templates/module.rb"], args
|
55
|
-
end
|
56
|
-
|
57
|
-
test "Sets the demo template with --template" do
|
58
|
-
CommandLine.expects(:template).with("demo.rb").returns("./templates/demo.rb")
|
59
|
-
args = ["--template", "demo"]
|
60
|
-
|
61
|
-
CommandLine.set_template(args)
|
62
|
-
|
63
|
-
assert_equal ["--template", "./templates/demo.rb"], args
|
64
|
-
end
|
65
|
-
|
66
|
-
test "Set usage" do
|
67
|
-
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|