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,10 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class PermissionTest < ActiveSupport::TestCase
|
4
|
-
def test_create
|
5
|
-
perm = Factory(:permission, :name => "test")
|
6
|
-
assert !Factory.build(:permission, :name => "").valid?
|
7
|
-
assert !Factory.build(:permission, :name => "test").valid?
|
8
|
-
assert_equal perm, Cms::Permission.named("test").first
|
9
|
-
end
|
10
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
# These Portlet classes cannot be defined within the PortletTest class. Something
|
4
|
-
# related to the dynamic attributes causes other tests to fail otherwise.
|
5
|
-
class NoInlinePortlet < Cms::Portlet
|
6
|
-
render_inline false
|
7
|
-
end
|
8
|
-
|
9
|
-
class InlinePortlet < Cms::Portlet
|
10
|
-
end
|
11
|
-
|
12
|
-
class NonEditablePortlet < Cms::Portlet
|
13
|
-
enable_template_editor false
|
14
|
-
end
|
15
|
-
|
16
|
-
class EditablePortlet < Cms::Portlet
|
17
|
-
enable_template_editor true
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
class PortletTest < ActiveSupport::TestCase
|
22
|
-
|
23
|
-
def setup
|
24
|
-
@portlet = Factory(:portlet)
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
test "destroy should mark a portlet as deleted" do
|
29
|
-
@portlet.destroy
|
30
|
-
@portlet.reload!
|
31
|
-
assert_equal true, @portlet.deleted?
|
32
|
-
#Cms::Portlet.find(@portlet.id)
|
33
|
-
#assert_raise(ActiveRecord::RecordNotFound){
|
34
|
-
# Cms::Portlet.find(@portlet.id)
|
35
|
-
#}
|
36
|
-
end
|
37
|
-
|
38
|
-
test "update_attributes" do
|
39
|
-
@portlet.update_attributes(:b => "whatever")
|
40
|
-
assert_equal "whatever", @portlet.b
|
41
|
-
end
|
42
|
-
|
43
|
-
test "attributes=" do
|
44
|
-
@portlet.attributes=({:b => "b"})
|
45
|
-
assert_equal "b", @portlet.b
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_dynamic_attributes
|
49
|
-
portlet = DynamicPortlet.create(:name => "Test", :foo => "FOO")
|
50
|
-
assert_equal "FOO", Cms::Portlet.find(portlet.id).foo
|
51
|
-
assert_equal "Dynamic Portlet", portlet.portlet_type_name
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_portlets_consistently_load_the_same_number_of_types
|
55
|
-
|
56
|
-
list = Cms::Portlet.types
|
57
|
-
assert list.size > 0
|
58
|
-
|
59
|
-
DynamicPortlet.create!(:name=>"test 1")
|
60
|
-
DynamicPortlet.create!(:name=>"test 2")
|
61
|
-
|
62
|
-
assert_equal list.size, Cms::Portlet.types.size
|
63
|
-
end
|
64
|
-
|
65
|
-
|
66
|
-
test "render_inline" do
|
67
|
-
assert_equal false, NoInlinePortlet.render_inline
|
68
|
-
end
|
69
|
-
|
70
|
-
test "Portlets should default to render_inline is true" do
|
71
|
-
assert InlinePortlet.render_inline
|
72
|
-
end
|
73
|
-
|
74
|
-
test "allow_template_editing" do
|
75
|
-
assert_equal true, EditablePortlet.render_inline
|
76
|
-
|
77
|
-
assert_equal false, NonEditablePortlet.render_inline
|
78
|
-
end
|
79
|
-
|
80
|
-
test "If render_inline is true, should return the value of 'template'" do
|
81
|
-
p = EditablePortlet.new
|
82
|
-
p.template = "<b>CODE HERE</b>"
|
83
|
-
|
84
|
-
assert_equal p.template, p.inline_options[:inline]
|
85
|
-
end
|
86
|
-
test "If render_inline is true, but template is blank, don't render inline" do
|
87
|
-
p = EditablePortlet.new
|
88
|
-
|
89
|
-
p.template = nil
|
90
|
-
assert_equal({}, p.inline_options)
|
91
|
-
|
92
|
-
p.template = ""
|
93
|
-
assert_equal({}, p.inline_options)
|
94
|
-
end
|
95
|
-
|
96
|
-
test "Portlets should be considered 'connectable?, and therefore can have a /usages route.'" do
|
97
|
-
assert Cms::Portlet.connectable?
|
98
|
-
end
|
99
|
-
end
|
@@ -1,278 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Cms
|
4
|
-
class SectionTest < ActiveSupport::TestCase
|
5
|
-
|
6
|
-
def setup
|
7
|
-
@root = Factory(:root_section)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_not_allow_slash_in_name
|
11
|
-
section = Factory.build(:section, :name => "OMG / WTF / BBQ")
|
12
|
-
assert !section.valid?
|
13
|
-
assert_has_error_on section, :name, "cannot contain '/'"
|
14
|
-
end
|
15
|
-
|
16
|
-
test "sections return all child sections of a section" do
|
17
|
-
s = Factory(:public_section)
|
18
|
-
assert_equal [s], s.parent.sections
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_create_sub_section
|
22
|
-
sub = Factory(:section, :name => "Sub Section", :parent => root_section)
|
23
|
-
assert_equal sub, root_section.sections.last
|
24
|
-
assert_equal root_section, sub.parent
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_move_into_another_section
|
28
|
-
foo = Factory(:section, :name => "Foo", :parent => @root)
|
29
|
-
bar = Factory(:section, :name => "Bar", :parent => @root)
|
30
|
-
assert_equal @root, foo.parent
|
31
|
-
assert foo.move_to(bar)
|
32
|
-
assert_equal bar, foo.parent
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_cannot_move_root_section
|
36
|
-
foo = Factory(:section, :name => "Foo", :parent => @root)
|
37
|
-
assert !@root.move_to(foo)
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_find_first_page_or_link_in_section_page
|
41
|
-
@a = Factory(:section, :parent => @root, :name => "A")
|
42
|
-
@a1 = Factory(:section, :parent => @a, :name => "A1")
|
43
|
-
@a1a = Factory(:section, :parent => @a1, :name => "A1a")
|
44
|
-
@foo = Factory(:page, :section => @a1a, :name => "Foo")
|
45
|
-
@b = Factory(:section, :parent => @root, :name => "B")
|
46
|
-
|
47
|
-
assert_equal @foo, @a.first_page_or_link
|
48
|
-
assert_equal @foo, @a1.first_page_or_link
|
49
|
-
assert_equal @foo, @a1a.first_page_or_link
|
50
|
-
assert_nil @b.first_page_or_link
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_find_first_page_or_link_in_section_link
|
54
|
-
@a = Factory(:section, :parent => @root, :name => "A")
|
55
|
-
@a1 = Factory(:link, :section => @a, :name => "A1")
|
56
|
-
@a2 = Factory(:page, :section => @a, :name => "A2")
|
57
|
-
|
58
|
-
assert_equal @a1, @a.first_page_or_link
|
59
|
-
|
60
|
-
@a2.section_node.move_to(@a, 0)
|
61
|
-
|
62
|
-
assert_equal @a2, @a.first_page_or_link
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_find_first_page_or_link_after_delete
|
66
|
-
@a = Factory(:section, :parent => @root, :name => "A")
|
67
|
-
@a1 = Factory(:page, :section => @a, :name => "A1")
|
68
|
-
@a2 = Factory(:page, :section => @a, :name => "A2")
|
69
|
-
@a3 = Factory(:page, :section => @a, :name => "A3")
|
70
|
-
assert_equal @a1, @a.first_page_or_link
|
71
|
-
@a1.destroy
|
72
|
-
|
73
|
-
assert_equal @a2, @a.first_page_or_link
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_find_by_name_path
|
77
|
-
@a = Factory(:section, :parent => root_section, :name => "A")
|
78
|
-
@b = Factory(:section, :parent => @a, :name => "B")
|
79
|
-
@c = Factory(:section, :parent => @b, :name => "C")
|
80
|
-
|
81
|
-
assert_equal root_section, Cms::Section.find_by_name_path("/")
|
82
|
-
assert_equal @a, Cms::Section.find_by_name_path("/A/")
|
83
|
-
assert_equal @b, Cms::Section.find_by_name_path("/A/B/")
|
84
|
-
assert_equal @c, Cms::Section.find_by_name_path("/A/B/C/")
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_section_with_sub_section
|
88
|
-
@section = Factory(:section, :parent => root_section)
|
89
|
-
Factory(:section, :parent => @section)
|
90
|
-
|
91
|
-
assert !@section.empty?
|
92
|
-
assert !@section.deletable?
|
93
|
-
|
94
|
-
section_count = Cms::Section.count
|
95
|
-
assert !@section.destroy
|
96
|
-
assert_equal section_count, Cms::Section.count
|
97
|
-
|
98
|
-
end
|
99
|
-
|
100
|
-
test "sections with pages should not be empty?" do
|
101
|
-
@section = Factory(:section, :parent => @root)
|
102
|
-
Factory(:page, :section => @section)
|
103
|
-
|
104
|
-
assert_equal false, @section.empty?
|
105
|
-
end
|
106
|
-
|
107
|
-
def test_section_with_page_should_not_be_deletable
|
108
|
-
@section = Factory(:section, :parent => @root)
|
109
|
-
Factory(:page, :section => @section)
|
110
|
-
|
111
|
-
assert !@section.deletable?
|
112
|
-
|
113
|
-
section_count = Cms::Section.count
|
114
|
-
assert !@section.destroy
|
115
|
-
assert_equal section_count, Cms::Section.count
|
116
|
-
end
|
117
|
-
|
118
|
-
def test_a_root_section_shouldnt_be_deletable_even_without_children
|
119
|
-
|
120
|
-
assert !root_section.deletable?
|
121
|
-
|
122
|
-
section_count = Cms::Section.count
|
123
|
-
assert !root_section.destroy
|
124
|
-
assert_equal section_count, Cms::Section.count
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_empty_section
|
128
|
-
@section = Factory(:section, :parent => @root)
|
129
|
-
|
130
|
-
assert @section.empty?
|
131
|
-
assert @section.deletable?
|
132
|
-
|
133
|
-
section_count = Cms::Section.count
|
134
|
-
section_node_count = Cms::SectionNode.count
|
135
|
-
assert @section.destroy
|
136
|
-
assert_decremented section_count, Cms::Section.count
|
137
|
-
assert_decremented section_node_count, Cms::SectionNode.count
|
138
|
-
end
|
139
|
-
|
140
|
-
def test_creating_page_with_reserved_path
|
141
|
-
@section = Cms::Section.new(:name => "FAIL", :path => "/cms")
|
142
|
-
assert_not_valid @section
|
143
|
-
assert_has_error_on(@section, :path, "is invalid, '/cms' a reserved path")
|
144
|
-
|
145
|
-
@section = Cms::Section.new(:name => "FAIL", :path => "/cache")
|
146
|
-
assert_not_valid @section
|
147
|
-
assert_has_error_on(@section, :path, "is invalid, '/cache' a reserved path")
|
148
|
-
|
149
|
-
@section = Cms::Section.new(:name => "FTW", :path => "/whatever")
|
150
|
-
assert_valid @section
|
151
|
-
end
|
152
|
-
|
153
|
-
def test_old_syntax_for_marking_group_sections
|
154
|
-
given_there_is_a_group = Factory(:group)
|
155
|
-
|
156
|
-
groups = Cms::Group.all(&:id)
|
157
|
-
assert_equal Cms::Group, groups[0].class, "This is previous"
|
158
|
-
|
159
|
-
groups = Cms::Group.all()
|
160
|
-
assert_equal Cms::Group, groups[0].class, "No difference between this and the previous call."
|
161
|
-
|
162
|
-
group_ids = Cms::Group.all.map(&:id)
|
163
|
-
assert_equal Fixnum, group_ids[0].class
|
164
|
-
end
|
165
|
-
|
166
|
-
def test_new_section_with_groups
|
167
|
-
section = Cms::Section.new(:allow_groups => :all)
|
168
|
-
assert_equal Cms::Group.all, section.groups
|
169
|
-
|
170
|
-
end
|
171
|
-
|
172
|
-
def test_new_section_with_no_groups
|
173
|
-
s = Cms::Section.new(:allow_groups => :none)
|
174
|
-
assert_equal 0, s.groups.size
|
175
|
-
end
|
176
|
-
|
177
|
-
def test_create_section
|
178
|
-
s = Cms::Section.create!(:name => "For All", :path => "/", :allow_groups => :all)
|
179
|
-
|
180
|
-
assert_equal Cms::Group.count, Cms::Section.with_path("/").first.groups.size
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
class TestsWithoutFixtures < ActiveSupport::TestCase
|
185
|
-
def setup
|
186
|
-
remove_all_sitemap_fixtures_to_avoid_bugs
|
187
|
-
end
|
188
|
-
|
189
|
-
def test_find_by_name_path
|
190
|
-
@a = Factory(:section, :parent => root_section, :name => "A")
|
191
|
-
@b = Factory(:section, :parent => @a, :name => "B")
|
192
|
-
@c = Factory(:section, :parent => @b, :name => "C")
|
193
|
-
|
194
|
-
assert_equal root_section, Section.find_by_name_path("/")
|
195
|
-
assert_equal @a, Section.find_by_name_path("/A/")
|
196
|
-
assert_equal @b, Section.find_by_name_path("/A/B/")
|
197
|
-
assert_equal @c, Section.find_by_name_path("/A/B/C/")
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
class TestAncestors < ActiveSupport::TestCase
|
202
|
-
|
203
|
-
def setup
|
204
|
-
given_there_is_a_guest_group
|
205
|
-
@visible_section = Factory(:public_section, :parent => root_section)
|
206
|
-
@hidden_section = Factory(:public_section, :parent => root_section, :hidden => true)
|
207
|
-
@visible_page = Factory(:public_page, :section => root_section)
|
208
|
-
@hidden_page = Factory(:public_page, :hidden => true, :section => root_section)
|
209
|
-
@file_block = Factory(:file_block, :attachment_section => root_section, :attachment_file => mock_file)
|
210
|
-
end
|
211
|
-
|
212
|
-
test "visible_child_nodes should include non-hidden sections and non-hidden pages" do
|
213
|
-
assert_equal [@visible_section.node, @visible_page.node], root_section.visible_child_nodes
|
214
|
-
end
|
215
|
-
|
216
|
-
test "ancestors :include_self" do
|
217
|
-
assert_equal [root_section], @visible_section.ancestors
|
218
|
-
assert_equal [root_section, @visible_section], @visible_section.ancestors(:include_self => true)
|
219
|
-
end
|
220
|
-
|
221
|
-
test "#ancestry_path delegates to SectionNode" do
|
222
|
-
assert_equal @visible_section.node.ancestry_path, @visible_section.ancestry_path
|
223
|
-
end
|
224
|
-
|
225
|
-
test "#build_section creates a new section within this section" do
|
226
|
-
new_section = @visible_section.build_section
|
227
|
-
assert_equal @visible_section, new_section.parent
|
228
|
-
end
|
229
|
-
|
230
|
-
test "#partial_for" do
|
231
|
-
assert_equal "section", @visible_section.partial_for
|
232
|
-
assert_equal "page", @visible_page.partial_for
|
233
|
-
assert_equal "link", Factory(:link, :section => root_section).partial_for
|
234
|
-
end
|
235
|
-
|
236
|
-
test "#status is cached" do
|
237
|
-
assert_equal :unlocked, @visible_section.status
|
238
|
-
assert_equal :unlocked, @visible_section.instance_variable_get(:@status)
|
239
|
-
end
|
240
|
-
|
241
|
-
test "Section#section_node should be the same object " do
|
242
|
-
sn = root_section.section_node
|
243
|
-
assert_equal sn.object_id, sn.node.section_node.object_id, "Should be the same object"
|
244
|
-
end
|
245
|
-
|
246
|
-
test "Page#section_node should be the same object" do
|
247
|
-
sn = @visible_page.section_node
|
248
|
-
assert_equal sn.object_id, sn.node.section_node.object_id
|
249
|
-
end
|
250
|
-
|
251
|
-
test "Link#section_node should be the same object" do
|
252
|
-
link = Factory(:link, :section => root_section)
|
253
|
-
sn = link.section_node
|
254
|
-
assert_equal sn.object_id, sn.node.section_node.object_id
|
255
|
-
end
|
256
|
-
|
257
|
-
test "#public?" do
|
258
|
-
assert @visible_section.public?
|
259
|
-
refute Factory(:section).public?
|
260
|
-
end
|
261
|
-
|
262
|
-
test "#sitemap" do
|
263
|
-
sitemap = Section.sitemap
|
264
|
-
assert_equal root_section.node, sitemap.keys.first
|
265
|
-
assert_equal [@visible_section, @hidden_section, @visible_page, @hidden_page].map { |n| n.section_node }, sitemap[root_section.node].keys
|
266
|
-
end
|
267
|
-
|
268
|
-
test "#master_section_list" do
|
269
|
-
subsection = Factory(:public_section, :parent => @visible_section, :name => "Child 1")
|
270
|
-
sections = root_section.master_section_list
|
271
|
-
assert_equal [@visible_section, subsection, @hidden_section], sections
|
272
|
-
assert_equal "#{@visible_section.name}", sections[0].full_path
|
273
|
-
assert_equal "#{@visible_section.name} / #{subsection.name}", sections[1].full_path
|
274
|
-
assert_equal "#{@hidden_section.name}", sections[2].full_path
|
275
|
-
end
|
276
|
-
|
277
|
-
end
|
278
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class SiteTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_does_not_allow_duplicate_names
|
6
|
-
Factory(:site, :domain => "test.com")
|
7
|
-
@site = Factory.build(:site, :domain => "test.com")
|
8
|
-
assert !@site.valid?
|
9
|
-
assert_has_error_on @site, :domain, "has already been taken"
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_remove_www_from_front_when_saving
|
13
|
-
@site = Factory(:site, :domain => "www.test.com")
|
14
|
-
assert_equal "test.com", @site.domain
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_should_remove_www_from_front_when_saving_preserving_sub_domains
|
18
|
-
@site = Factory(:site, :domain => "www.foo.test.com")
|
19
|
-
assert_equal "foo.test.com", @site.domain
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_should_not_remove_sub_domain_from_domain_when_saving
|
23
|
-
@site = Factory(:site, :domain => "foo.test.com")
|
24
|
-
assert_equal "foo.test.com", @site.domain
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_should_make_the_first_the_default
|
28
|
-
@first = Factory(:site)
|
29
|
-
@second = Factory(:site)
|
30
|
-
assert @first.the_default?
|
31
|
-
assert !@second.the_default?
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_change_the_default
|
35
|
-
@first = Factory(:site, :the_default=>false)
|
36
|
-
@second = Factory(:site, :the_default => true)
|
37
|
-
reset(:first, :second)
|
38
|
-
assert !@first.the_default?
|
39
|
-
assert @second.the_default?
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_find_by_domain
|
43
|
-
@default = @first = Factory(:site, :the_default=>true)
|
44
|
-
@example = Factory(:site, :domain => "test.com")
|
45
|
-
assert_equal @example, Cms::Site.find_by_domain("test.com")
|
46
|
-
assert_equal @example, Cms::Site.find_by_domain("www.test.com")
|
47
|
-
assert_equal @default, Cms::Site.find_by_domain("whatever.com")
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
@@ -1,150 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Cms
|
4
|
-
class TaskTest < ActiveSupport::TestCase
|
5
|
-
def setup
|
6
|
-
super
|
7
|
-
@editor_a = Factory(:cms_admin)
|
8
|
-
@editor_b = Factory(:cms_admin)
|
9
|
-
@non_editor = Factory(:user, :login => "non_editor", :email => "non_editor@example.com")
|
10
|
-
@page = Factory(:page, :name => "Task Test", :path => "/task_test")
|
11
|
-
@page2 = Factory(:page, :name => "Task Test 2", :path => "/task_test_2")
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
class CreateTaskTest < TaskTest
|
16
|
-
|
17
|
-
def test_create_task
|
18
|
-
assert_that_you_can_assign_a_task_to_yourself
|
19
|
-
assert_that_an_assigned_by_user_that_is_an_editor_is_required
|
20
|
-
assert_that_an_assigned_to_user_that_is_an_editor_is_required
|
21
|
-
assert_that_a_page_is_required
|
22
|
-
|
23
|
-
create_the_task!
|
24
|
-
create_the_second_task!
|
25
|
-
|
26
|
-
assert !@task.completed?
|
27
|
-
assert(@task.due_date < Time.now)
|
28
|
-
assert_equal "Howdy!", @task.comment
|
29
|
-
|
30
|
-
assert_that_an_email_is_sent_to_the_user_the_task_was_assigned_to
|
31
|
-
assert_that_the_page_is_assigned_to_the_assigned_to_user
|
32
|
-
assert_that_the_task_is_added_to_the_users_incomplete_tasks
|
33
|
-
end
|
34
|
-
|
35
|
-
test "An email is sent when a task is created" do
|
36
|
-
create_the_task!
|
37
|
-
|
38
|
-
assert_equal 1, ActionMailer::Base.deliveries.size
|
39
|
-
end
|
40
|
-
|
41
|
-
protected
|
42
|
-
|
43
|
-
def assert_that_you_can_assign_a_task_to_yourself
|
44
|
-
assert_valid Factory.build(:task, :assigned_by => @editor_a, :assigned_to => @editor_a)
|
45
|
-
end
|
46
|
-
|
47
|
-
def assert_that_an_assigned_by_user_that_is_an_editor_is_required
|
48
|
-
task = Factory.build(:task, :assigned_by => nil, :assigned_to => @editor_a)
|
49
|
-
assert_not_valid task
|
50
|
-
assert_has_error_on task, :assigned_by_id, "is required"
|
51
|
-
|
52
|
-
task = Factory.build(:task, :assigned_by => @non_editor, :assigned_to => @editor_a)
|
53
|
-
assert_not_valid task
|
54
|
-
assert_has_error_on task, :assigned_by_id, Cms::Task::CANT_ASSIGN_MESSAGE
|
55
|
-
end
|
56
|
-
|
57
|
-
def assert_that_an_assigned_to_user_that_is_an_editor_is_required
|
58
|
-
task = Factory.build(:task, :assigned_by => @editor_a, :assigned_to => nil)
|
59
|
-
assert_not_valid task
|
60
|
-
assert_has_error_on task, :assigned_to_id, "is required"
|
61
|
-
|
62
|
-
task = Factory.build(:task, :assigned_by => @editor_a, :assigned_to => @non_editor)
|
63
|
-
assert_not_valid task
|
64
|
-
assert_has_error_on task, :assigned_to_id, Cms::Task::CANT_BE_ASSIGNED_MESSAGE
|
65
|
-
end
|
66
|
-
|
67
|
-
def assert_that_a_page_is_required
|
68
|
-
task = Factory.build(:task, :page => nil)
|
69
|
-
assert_not_valid task
|
70
|
-
assert_has_error_on task, :page_id, "is required"
|
71
|
-
end
|
72
|
-
|
73
|
-
def create_the_task!
|
74
|
-
@task = Cms::Task.create!(
|
75
|
-
:assigned_by => @editor_a,
|
76
|
-
:assigned_to => @editor_b,
|
77
|
-
:due_date => 5.minutes.ago,
|
78
|
-
:comment => "Howdy!",
|
79
|
-
:page => @page)
|
80
|
-
end
|
81
|
-
|
82
|
-
def create_the_second_task!
|
83
|
-
@task2 = Cms::Task.create!(
|
84
|
-
:assigned_by => @editor_a,
|
85
|
-
:assigned_to => @editor_b,
|
86
|
-
:due_date => 1.minutes.ago,
|
87
|
-
:comment => "Howdy Again!",
|
88
|
-
:page => @page2)
|
89
|
-
end
|
90
|
-
|
91
|
-
def assert_that_an_email_is_sent_to_the_user_the_task_was_assigned_to
|
92
|
-
email = Cms::EmailMessage.first(:order => "id asc")
|
93
|
-
assert_equal @editor_a.email, email.sender
|
94
|
-
assert_equal @editor_b.email, email.recipients
|
95
|
-
assert_equal "Page '#{@page.name}' has been assigned to you", email.subject
|
96
|
-
assert_equal "http://cms.#{SITE_DOMAIN}#{@page.path}\n\n#{@task.comment}", email.body
|
97
|
-
end
|
98
|
-
|
99
|
-
def assert_that_the_page_is_assigned_to_the_assigned_to_user
|
100
|
-
assert @page.assigned_to?(@editor_b), "Expected the page to be assigned to editor b"
|
101
|
-
assert !@page.assigned_to?(@editor_a), "Expected the page not to be assigned to editor a"
|
102
|
-
end
|
103
|
-
|
104
|
-
def assert_that_the_task_is_added_to_the_users_incomplete_tasks
|
105
|
-
assert !@editor_a.tasks.incomplete.all.include?(@task),
|
106
|
-
"Expected Editor A's incomplete tasks not to include the task"
|
107
|
-
assert !@editor_a.tasks.incomplete.all.include?(@task2),
|
108
|
-
"Expected Editor A's incomplete tasks not to include the second task"
|
109
|
-
assert @editor_b.tasks.incomplete.all.include?(@task),
|
110
|
-
"Expected Editor B's incomplete tasks to include the task"
|
111
|
-
assert @editor_b.tasks.incomplete.all.include?(@task2),
|
112
|
-
"Expected Editor B's incomplete tasks to include the second task"
|
113
|
-
end
|
114
|
-
|
115
|
-
end
|
116
|
-
|
117
|
-
class ExistingIncompleteTaskTest < TaskTest
|
118
|
-
def setup
|
119
|
-
super
|
120
|
-
@existing_task = Factory(:task, :assigned_by => @editor_a, :assigned_to => @editor_b, :page => @page)
|
121
|
-
end
|
122
|
-
|
123
|
-
|
124
|
-
test "Existing task is incomplete, and assigned to Editor B's task list" do
|
125
|
-
assert !@existing_task.completed?
|
126
|
-
assert_equal @editor_b, @page.assigned_to
|
127
|
-
assert @editor_b.tasks.incomplete.all.include?(@existing_task)
|
128
|
-
end
|
129
|
-
|
130
|
-
def test_create_task_for_a_page_with_existing_incomplete_tasks
|
131
|
-
@new_task = Factory(:task, :assigned_by => @editor_b, :assigned_to => @editor_a, :page => @page)
|
132
|
-
@existing_task = Cms::Task.find(@existing_task.id)
|
133
|
-
|
134
|
-
assert @existing_task.completed?
|
135
|
-
assert !@new_task.completed?
|
136
|
-
assert @page.assigned_to?(@editor_a)
|
137
|
-
assert !@page.assigned_to?(@editor_b)
|
138
|
-
assert @editor_a.tasks.incomplete.all.include?(@new_task)
|
139
|
-
assert !@editor_b.tasks.incomplete.all.include?(@existing_task)
|
140
|
-
end
|
141
|
-
|
142
|
-
test "Marking a task complete should mark it as unassigned" do
|
143
|
-
@existing_task.mark_as_complete!
|
144
|
-
|
145
|
-
assert @existing_task.completed?
|
146
|
-
assert @page.assigned_to.nil?
|
147
|
-
assert !@editor_b.tasks.incomplete.all.include?(@existing_task)
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|