browsercms 3.1.5 → 3.3.0.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/controllers/cms/base_controller.rb +3 -3
- data/app/controllers/cms/content_block_controller.rb +2 -2
- data/app/controllers/cms/content_controller.rb +5 -4
- data/app/controllers/cms/error_handling.rb +1 -1
- data/app/controllers/cms/routes_controller.rb +4 -5
- data/app/controllers/cms/section_nodes_controller.rb +1 -6
- data/app/controllers/cms/sections_controller.rb +2 -3
- data/app/controllers/cms/tasks_controller.rb +3 -0
- data/app/controllers/cms/users_controller.rb +1 -1
- data/app/helpers/cms/application_helper.rb +137 -34
- data/app/helpers/cms/form_builder.rb +33 -21
- data/app/helpers/cms/page_helper.rb +43 -10
- data/app/helpers/cms/path_helper.rb +1 -1
- data/app/helpers/cms/rendering_helper.rb +3 -4
- data/app/helpers/cms/section_nodes_helper.rb +5 -43
- data/app/models/abstract_file_block.rb +1 -16
- data/app/models/attachment.rb +57 -22
- data/app/models/category.rb +4 -4
- data/app/models/category_type.rb +2 -2
- data/app/models/cms/view_context.rb +46 -0
- data/app/models/connector.rb +7 -6
- data/app/models/content_type.rb +3 -3
- data/app/models/dynamic_view.rb +1 -1
- data/app/models/email_message.rb +2 -2
- data/app/models/file_block.rb +12 -0
- data/app/models/group.rb +4 -4
- data/app/models/group_type.rb +4 -4
- data/app/models/html_block.rb +1 -1
- data/app/models/image_block.rb +12 -0
- data/app/models/link.rb +22 -5
- data/app/models/page.rb +87 -46
- data/app/models/page_route.rb +61 -6
- data/app/models/permission.rb +1 -1
- data/app/models/portlet.rb +14 -4
- data/app/models/section.rb +48 -86
- data/app/models/section_node.rb +25 -40
- data/app/models/site.rb +1 -1
- data/app/models/tag.rb +1 -1
- data/app/models/task.rb +8 -7
- data/app/models/user.rb +2 -7
- data/app/portlets/forgot_password_portlet.rb +6 -2
- data/app/portlets/reset_password_portlet.rb +1 -1
- data/app/views/cms/blocks/_toolbar.html.erb +1 -1
- data/app/views/cms/blocks/_toolbar_for_collection.html.erb +3 -6
- data/app/views/cms/blocks/_toolbar_for_member.html.erb +3 -5
- data/app/views/cms/blocks/edit.html.erb +4 -4
- data/app/views/cms/blocks/index.html.erb +7 -7
- data/app/views/cms/blocks/new.html.erb +4 -4
- data/app/views/cms/blocks/show.html.erb +2 -2
- data/app/views/cms/blocks/usages.html.erb +2 -2
- data/app/views/cms/blocks/versions.html.erb +4 -4
- data/app/views/cms/cache/show.html.erb +2 -2
- data/app/views/cms/categories/_form.html.erb +2 -2
- data/app/views/cms/connectors/new.html.erb +6 -8
- data/app/views/cms/content/no_page.html.erb +1 -1
- data/app/views/cms/content/show.html.erb +2 -7
- data/app/views/cms/dashboard/_page_drafts.html.erb +1 -1
- data/app/views/cms/dashboard/_tasks.html.erb +1 -1
- data/app/views/cms/dashboard/index.html.erb +1 -1
- data/app/views/cms/dynamic_views/_form.html.erb +2 -2
- data/app/views/cms/dynamic_views/index.html.erb +7 -10
- data/app/views/cms/email_messages/show.html.erb +2 -2
- data/app/views/cms/file_blocks/_form.html.erb +4 -4
- data/app/views/cms/form_builder/_cms_fancy_drop_down.html.erb +2 -2
- data/app/views/cms/form_builder/_cms_file_field.html.erb +2 -2
- data/app/views/cms/form_builder/_cms_tag_list.html.erb +2 -2
- data/app/views/cms/form_builder/_cms_text_editor.html.erb +2 -2
- data/app/views/cms/groups/_form.html.erb +5 -5
- data/app/views/cms/groups/_permissions.html.erb +4 -4
- data/app/views/cms/groups/_sections.html.erb +1 -2
- data/app/views/cms/groups/index.html.erb +1 -1
- data/app/views/cms/html_blocks/render.html.erb +1 -1
- data/app/views/cms/image_blocks/_form.html.erb +4 -5
- data/app/views/cms/links/_form.html.erb +1 -1
- data/app/views/cms/links/edit.html.erb +2 -2
- data/app/views/cms/links/new.html.erb +2 -2
- data/app/views/cms/page_routes/_form.html.erb +2 -2
- data/app/views/cms/page_routes/index.html.erb +6 -9
- data/app/views/cms/page_routes/show.html.erb +5 -8
- data/app/views/cms/pages/_edit_connector.html.erb +1 -1
- data/app/views/cms/pages/_form.html.erb +3 -3
- data/app/views/cms/pages/edit.html.erb +2 -2
- data/app/views/cms/pages/new.html.erb +7 -7
- data/app/views/cms/pages/versions.html.erb +4 -4
- data/app/views/cms/redirects/_form.html.erb +2 -2
- data/app/views/cms/redirects/index.html.erb +8 -7
- data/app/views/cms/routes/index.html.erb +2 -2
- data/app/views/cms/section_nodes/_link.html.erb +3 -6
- data/app/views/cms/section_nodes/_node.html.erb +4 -13
- data/app/views/cms/section_nodes/_page.html.erb +7 -13
- data/app/views/cms/section_nodes/_section.html.erb +8 -24
- data/app/views/cms/section_nodes/_section_node.html.erb +10 -0
- data/app/views/cms/section_nodes/index.html.erb +18 -30
- data/app/views/cms/sections/_form.html.erb +4 -6
- data/app/views/cms/sections/edit.html.erb +2 -2
- data/app/views/cms/sections/index.html.erb +3 -3
- data/app/views/cms/sections/new.html.erb +3 -3
- data/app/views/cms/sessions/new.html.erb +3 -3
- data/app/views/cms/shared/_pagination.html.erb +1 -1
- data/app/views/cms/shared/error.html.erb +1 -1
- data/app/views/cms/tags/render.html.erb +2 -2
- data/app/views/cms/tasks/new.html.erb +4 -4
- data/app/views/cms/users/_form.html.erb +3 -3
- data/app/views/cms/users/_toolbar.html.erb +3 -3
- data/app/views/cms/users/change_password.html.erb +5 -5
- data/app/views/cms/users/edit.html.erb +2 -2
- data/app/views/cms/users/index.html.erb +4 -4
- data/app/views/cms/users/new.html.erb +2 -2
- data/app/views/cms/users/show.html.erb +16 -16
- data/app/views/layouts/_cms_toolbar.html.erb +5 -5
- data/app/views/layouts/_page_toolbar.html.erb +11 -11
- data/app/views/layouts/cms/_footer.erb +1 -1
- data/app/views/layouts/cms/_head.html.erb +2 -6
- data/app/views/layouts/cms/administration.html.erb +32 -32
- data/app/views/layouts/cms/content_library.html.erb +5 -5
- data/app/views/layouts/cms/toolbar.html.erb +1 -1
- data/app/views/portlets/email_page/render.html.erb +2 -2
- data/app/views/portlets/forgot_password/render.html.erb +1 -1
- data/app/views/portlets/login/render.html.erb +4 -2
- data/app/views/portlets/reset_password/render.html.erb +1 -1
- data/app/views/tests/pretend/open_with_layout.html.erb +1 -1
- data/bin/bcms +0 -0
- data/bin/bcms-upgrade +232 -0
- data/bin/browsercms +2 -2
- data/browsercms.gemspec +16 -14
- data/db/migrate/20100705083859_browsercms_3_3_0.rb +56 -0
- data/db/seeds.rb +58 -0
- data/doc/guides/html/authentication.html +448 -192
- data/doc/guides/html/build_it_yourself.html +454 -175
- data/doc/guides/html/building_modules.html +451 -220
- data/doc/guides/html/building_templates.html +448 -498
- data/doc/guides/html/content_blocks.html +450 -470
- data/doc/guides/html/customizing_browsercms.html +453 -169
- data/doc/guides/html/deployment_guide.html +443 -82
- data/doc/guides/html/files/bcmsorg.js +28 -0
- data/doc/guides/html/files/clearfix.css +8 -0
- data/doc/guides/html/files/cufon.js +7 -0
- data/doc/guides/html/files/global.css +190 -0
- data/doc/guides/html/files/helvetica.js +91 -0
- data/doc/guides/html/files/jquery.js +11 -0
- data/doc/guides/html/getting_started.html +454 -213
- data/doc/guides/html/index.html +454 -174
- data/doc/guides/html/installing_modules.html +454 -186
- data/doc/guides/html/portlets.html +451 -232
- data/doc/guides/html/user_guide.html +452 -270
- data/doc/guides/html/writing_guides.html +454 -161
- data/lib/acts_as_list.rb +1 -1
- data/lib/browsercms.rb +10 -6
- data/lib/cms/acts.rb +7 -0
- data/lib/cms/authentication.rb +4 -0
- data/lib/cms/authentication/controller.rb +1 -1
- data/lib/cms/behaviors.rb +1 -1
- data/lib/cms/behaviors/archiving.rb +2 -2
- data/lib/cms/behaviors/attaching.rb +28 -43
- data/lib/cms/behaviors/categorizing.rb +1 -1
- data/lib/cms/behaviors/connecting.rb +27 -12
- data/lib/cms/behaviors/dynamic_attributes.rb +8 -5
- data/lib/cms/behaviors/hiding.rb +2 -2
- data/lib/cms/behaviors/publishing.rb +32 -22
- data/lib/cms/behaviors/rendering.rb +41 -18
- data/lib/cms/behaviors/searching.rb +1 -1
- data/lib/cms/behaviors/soft_deleting.rb +58 -29
- data/lib/cms/behaviors/taggable.rb +1 -1
- data/lib/cms/behaviors/userstamping.rb +5 -4
- data/lib/cms/behaviors/versioning.rb +192 -111
- data/lib/cms/content_rendering_support.rb +3 -3
- data/lib/cms/date_picker.rb +23 -0
- data/lib/cms/engine.rb +46 -0
- data/lib/cms/extensions.rb +1 -1
- data/lib/cms/extensions/active_record/errors.rb +2 -2
- data/lib/cms/extensions/hash.rb +4 -2
- data/lib/cms/extensions/string.rb +7 -2
- data/lib/cms/init.rb +32 -21
- data/lib/cms/module.rb +22 -0
- data/lib/cms/module_installation.rb +38 -0
- data/lib/cms/routes.rb +127 -115
- data/lib/cms/version.rb +2 -2
- data/lib/generators/browser_cms.rb +12 -0
- data/lib/generators/browser_cms/cms/USAGE +2 -0
- data/lib/generators/browser_cms/cms/cms_generator.rb +36 -0
- data/{rails_generators/browser_cms → lib/generators/browser_cms/cms}/templates/README +0 -0
- data/{rails_generators/browser_cms_demo_site → lib/generators/browser_cms/demo_site}/USAGE +0 -0
- data/lib/generators/browser_cms/demo_site/demo_site_generator.rb +138 -0
- data/lib/generators/browser_cms/demo_site/templates/demo_site.rake +11 -0
- data/{rails_generators/browser_cms_demo_site/templates/migration.rb → lib/generators/browser_cms/demo_site/templates/migration.erb} +2 -8
- data/lib/generators/cms/content_block/USAGE +22 -0
- data/lib/generators/cms/content_block/content_block_generator.rb +55 -0
- data/{rails_generators → lib/generators/cms}/content_block/templates/_form.html.erb +0 -0
- data/{rails_generators → lib/generators/cms}/content_block/templates/content_block.rb +0 -0
- data/{rails_generators → lib/generators/cms}/content_block/templates/controller.rb +0 -0
- data/{rails_generators → lib/generators/cms}/content_block/templates/functional_test.erb +0 -0
- data/{rails_generators/content_block/templates/migration.rb → lib/generators/cms/content_block/templates/migration.erb} +1 -1
- data/{rails_generators → lib/generators/cms}/content_block/templates/render.html.erb +0 -0
- data/{rails_generators → lib/generators/cms}/content_block/templates/unit_test.erb +0 -0
- data/lib/generators/cms/install/USAGE +8 -0
- data/lib/generators/cms/install/install_generator.rb +20 -0
- data/{rails_generators → lib/generators/cms}/portlet/USAGE +3 -16
- data/lib/generators/cms/portlet/portlet_generator.rb +38 -0
- data/{rails_generators → lib/generators/cms}/portlet/templates/_form.html.erb +0 -0
- data/{rails_generators → lib/generators/cms}/portlet/templates/portlet.rb +0 -0
- data/{rails_generators → lib/generators/cms}/portlet/templates/portlet_helper.rb +0 -0
- data/{rails_generators → lib/generators/cms}/portlet/templates/render.html.erb +0 -0
- data/{rails_generators → lib/generators/cms}/portlet/templates/unit_test.erb +0 -0
- data/{rails_generators → lib/generators/cms}/template/USAGE +1 -1
- data/lib/generators/cms/template/template_generator.rb +18 -0
- data/lib/generators/cms/template/templates/template.erb +2 -0
- data/lib/generators/cms/upgrade_module/README.txt +3 -0
- data/lib/generators/cms/upgrade_module/templates/20100705083859_browsercms_3_3_0.rb +56 -0
- data/lib/generators/cms/upgrade_module/templates/README +1 -0
- data/lib/generators/cms/upgrade_module/templates/USAGE.erb +10 -0
- data/lib/generators/cms/upgrade_module/templates/build_gem.rake +5 -0
- data/lib/generators/cms/upgrade_module/templates/engine.erb +7 -0
- data/lib/generators/cms/upgrade_module/templates/gemspec.erb +25 -0
- data/lib/generators/cms/upgrade_module/templates/gitignore.erb +11 -0
- data/lib/generators/cms/upgrade_module/templates/install.erb +9 -0
- data/lib/generators/cms/upgrade_module/templates/module_file.erb +3 -0
- data/lib/generators/cms/upgrade_module/templates/routes.erb +7 -0
- data/lib/generators/cms/upgrade_module/upgrade_module_generator.rb +61 -0
- data/lib/tasks/build_gem.rake +1 -0
- data/lib/tasks/cms.rake +34 -6
- data/lib/tasks/cucumber.rake +53 -0
- data/lib/tasks/db.rake +2 -2
- data/public/javascripts/cms/application.js +144 -135
- data/public/javascripts/cms/sitemap.js +383 -357
- data/public/javascripts/jquery-ui.js +782 -591
- data/public/javascripts/jquery.cookie.js +38 -43
- data/public/javascripts/jquery.js +13 -8
- data/public/javascripts/jquery.taglist.js +7 -0
- data/public/stylesheets/cms/date_picker.css +49 -40
- data/rails/init.rb +2 -3
- data/templates/blank.rb +13 -7
- data/templates/demo.rb +15 -7
- data/templates/module.rb +12 -75
- metadata +87 -407
- data/app/helpers/cms/content_block_helper.rb +0 -27
- data/app/views/layouts/cms/thickbox.html.erb +0 -24
- data/db/migrate/20120117144039_browsercms315.rb +0 -94
- data/db/migrate/20121114172307_load_seeds.rb +0 -70
- data/lib/cms/addressable.rb +0 -83
- data/lib/cms/error_pages.rb +0 -8
- data/public/images/cms/thickbox/loadingAnimation.gif +0 -0
- data/public/images/cms/thickbox/macFFBgHack.png +0 -0
- data/public/javascripts/jquery.contextMenu.js +0 -211
- data/public/javascripts/jquery.dimensions.js +0 -119
- data/public/javascripts/jquery.thickbox.js +0 -10
- data/public/stylesheets/cms/jquery.contextMenu.css +0 -61
- data/public/stylesheets/cms/thickbox.css +0 -163
- data/rails_generators/browser_cms/USAGE +0 -2
- data/rails_generators/browser_cms/browser_cms_generator.rb +0 -35
- data/rails_generators/browser_cms_demo_site/browser_cms_demo_site_generator.rb +0 -63
- data/rails_generators/content_block/USAGE +0 -32
- data/rails_generators/content_block/content_block_generator.rb +0 -69
- data/rails_generators/portlet/portlet_generator.rb +0 -35
- data/rails_generators/template/template_generator.rb +0 -18
- data/rails_generators/template/templates/template.erb +0 -3
- data/test/custom_assertions.rb +0 -74
- data/test/factories.rb +0 -111
- data/test/factories/sitemap_factories.rb +0 -28
- data/test/fixtures/connectors.yml +0 -97
- data/test/fixtures/content_type_groups.yml +0 -13
- data/test/fixtures/content_types.yml +0 -50
- data/test/fixtures/dynamic_view_versions.yml +0 -26
- data/test/fixtures/dynamic_views.yml +0 -26
- data/test/fixtures/group_permissions.yml +0 -16
- data/test/fixtures/group_sections.yml +0 -31
- data/test/fixtures/group_type_permissions.yml +0 -11
- data/test/fixtures/group_types.yml +0 -25
- data/test/fixtures/groups.yml +0 -25
- data/test/fixtures/html_block_versions.yml +0 -67
- data/test/fixtures/html_blocks.yml +0 -63
- data/test/fixtures/page_versions.yml +0 -265
- data/test/fixtures/pages.yml +0 -85
- data/test/fixtures/permissions.yml +0 -28
- data/test/fixtures/section_nodes.yml +0 -46
- data/test/fixtures/sections.yml +0 -19
- data/test/fixtures/sites.yml +0 -9
- data/test/fixtures/user_group_memberships.yml +0 -11
- data/test/fixtures/users.yml +0 -15
- data/test/functional/cms/cache_controller_test.rb +0 -14
- data/test/functional/cms/categories_controller_test.rb +0 -25
- data/test/functional/cms/connectors_controller_test.rb +0 -60
- data/test/functional/cms/content_block_controller_test.rb +0 -120
- data/test/functional/cms/content_controller_test.rb +0 -439
- data/test/functional/cms/content_types_controller_test.rb +0 -18
- data/test/functional/cms/dashboard_controller_test.rb +0 -16
- data/test/functional/cms/dynamic_views_controller_test.rb +0 -52
- data/test/functional/cms/file_blocks_controller_test.rb +0 -52
- data/test/functional/cms/groups_controller_test.rb +0 -50
- data/test/functional/cms/home_controller_test.rb +0 -156
- data/test/functional/cms/html_blocks_controller_test.rb +0 -164
- data/test/functional/cms/image_blocks_controller_test.rb +0 -82
- data/test/functional/cms/links_controller_test.rb +0 -148
- data/test/functional/cms/pages_controller_test.rb +0 -227
- data/test/functional/cms/portlets_controller_test.rb +0 -67
- data/test/functional/cms/section_nodes_controller_test.rb +0 -112
- data/test/functional/cms/sections_controller_test.rb +0 -227
- data/test/functional/cms/sessions_controller_test.rb +0 -76
- data/test/functional/cms/toolbar_controller_test.rb +0 -64
- data/test/functional/cms/users_controller_test.rb +0 -231
- data/test/functional/tests/pretend_controller_test.rb +0 -57
- data/test/integration/cms/ckeditor_test.rb +0 -30
- data/test/integration/cms/password_management_test.rb +0 -56
- data/test/integration/login_test.rb +0 -14
- data/test/integration/sitemap_performance_test.rb +0 -26
- data/test/selenium-core/Blank.html +0 -7
- data/test/selenium-core/InjectedRemoteRunner.html +0 -8
- data/test/selenium-core/RemoteRunner.html +0 -110
- data/test/selenium-core/SeleniumLog.html +0 -109
- data/test/selenium-core/TestPrompt.html +0 -145
- data/test/selenium-core/TestRunner-splash.html +0 -55
- data/test/selenium-core/TestRunner.hta +0 -176
- data/test/selenium-core/TestRunner.html +0 -176
- data/test/selenium-core/domviewer/butmin.gif +0 -0
- data/test/selenium-core/domviewer/butplus.gif +0 -0
- data/test/selenium-core/domviewer/domviewer.css +0 -298
- data/test/selenium-core/domviewer/domviewer.html +0 -16
- data/test/selenium-core/domviewer/selenium-domviewer.js +0 -205
- data/test/selenium-core/icons/all.png +0 -0
- data/test/selenium-core/icons/continue.png +0 -0
- data/test/selenium-core/icons/continue_disabled.png +0 -0
- data/test/selenium-core/icons/pause.png +0 -0
- data/test/selenium-core/icons/pause_disabled.png +0 -0
- data/test/selenium-core/icons/selected.png +0 -0
- data/test/selenium-core/icons/step.png +0 -0
- data/test/selenium-core/icons/step_disabled.png +0 -0
- data/test/selenium-core/iedoc-core.xml +0 -1515
- data/test/selenium-core/iedoc.xml +0 -1469
- data/test/selenium-core/lib/cssQuery/cssQuery-p.js +0 -6
- data/test/selenium-core/lib/cssQuery/src/cssQuery-level2.js +0 -142
- data/test/selenium-core/lib/cssQuery/src/cssQuery-level3.js +0 -150
- data/test/selenium-core/lib/cssQuery/src/cssQuery-standard.js +0 -53
- data/test/selenium-core/lib/cssQuery/src/cssQuery.js +0 -356
- data/test/selenium-core/lib/prototype.js +0 -2006
- data/test/selenium-core/lib/scriptaculous/builder.js +0 -101
- data/test/selenium-core/lib/scriptaculous/controls.js +0 -815
- data/test/selenium-core/lib/scriptaculous/dragdrop.js +0 -915
- data/test/selenium-core/lib/scriptaculous/effects.js +0 -958
- data/test/selenium-core/lib/scriptaculous/scriptaculous.js +0 -47
- data/test/selenium-core/lib/scriptaculous/slider.js +0 -283
- data/test/selenium-core/lib/scriptaculous/unittest.js +0 -383
- data/test/selenium-core/scripts/find_matching_child.js +0 -69
- data/test/selenium-core/scripts/htmlutils.js +0 -894
- data/test/selenium-core/scripts/injection.html +0 -72
- data/test/selenium-core/scripts/js2html.js +0 -70
- data/test/selenium-core/scripts/narcissus-defs.js +0 -175
- data/test/selenium-core/scripts/narcissus-exec.js +0 -1054
- data/test/selenium-core/scripts/narcissus-parse.js +0 -1003
- data/test/selenium-core/scripts/se2html.js +0 -63
- data/test/selenium-core/scripts/selenium-api.js +0 -2409
- data/test/selenium-core/scripts/selenium-browserbot.js +0 -2203
- data/test/selenium-core/scripts/selenium-browserdetect.js +0 -150
- data/test/selenium-core/scripts/selenium-commandhandlers.js +0 -377
- data/test/selenium-core/scripts/selenium-executionloop.js +0 -175
- data/test/selenium-core/scripts/selenium-logging.js +0 -147
- data/test/selenium-core/scripts/selenium-remoterunner.js +0 -571
- data/test/selenium-core/scripts/selenium-testrunner.js +0 -1333
- data/test/selenium-core/scripts/selenium-version.js +0 -5
- data/test/selenium-core/scripts/user-extensions.js +0 -3
- data/test/selenium-core/scripts/user-extensions.js.sample +0 -75
- data/test/selenium-core/scripts/xmlextras.js +0 -153
- data/test/selenium-core/selenium-logo.png +0 -0
- data/test/selenium-core/selenium-test.css +0 -43
- data/test/selenium-core/selenium.css +0 -299
- data/test/selenium-core/xpath/dom.js +0 -428
- data/test/selenium-core/xpath/misc.js +0 -252
- data/test/selenium-core/xpath/xpath.js +0 -2223
- data/test/selenium/_login_as_cmsadmin.rsel +0 -4
- data/test/selenium/dashboard.rsel +0 -5
- data/test/selenium/html_blocks.rsel +0 -4
- data/test/selenium/login/failed_login.rsel +0 -8
- data/test/selenium/login/successful_login.rsel +0 -9
- data/test/selenium/page_templates.rsel +0 -12
- data/test/selenium/pages/edit_properties.rsel +0 -5
- data/test/selenium/site/view_home_page.rsel +0 -4
- data/test/selenium/sitemap/move_page.rsel +0 -9
- data/test/selenium/sitemap/open_section.rsel +0 -6
- data/test/selenium/sitemap/select_page.rsel +0 -12
- data/test/selenium/sitemap/select_section.rsel +0 -17
- data/test/test_helper.rb +0 -193
- data/test/test_logging.rb +0 -67
- data/test/unit/behaviors/attaching_test.rb +0 -357
- data/test/unit/behaviors/connectable_test.rb +0 -29
- data/test/unit/behaviors/dynamic_attributes_test.rb +0 -38
- data/test/unit/behaviors/publishable_test.rb +0 -84
- data/test/unit/behaviors/searching_test.rb +0 -102
- data/test/unit/behaviors/taggable_test.rb +0 -109
- data/test/unit/behaviors/versioning_test.rb +0 -36
- data/test/unit/extensions/active_record/base_test.rb +0 -10
- data/test/unit/extensions/hash_test.rb +0 -17
- data/test/unit/extensions/integer_test.rb +0 -10
- data/test/unit/helpers/application_helper_test.rb +0 -77
- data/test/unit/helpers/form_builder_test.rb +0 -36
- data/test/unit/helpers/menu_helper_test.rb +0 -242
- data/test/unit/helpers/page_helper_test.rb +0 -67
- data/test/unit/helpers/path_helper_test.rb +0 -57
- 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/sitemap_test.rb +0 -206
- data/test/unit/lib/cms_domain_support_test.rb +0 -43
- data/test/unit/lib/command_line_test.rb +0 -70
- data/test/unit/lib/content_block_test.rb +0 -203
- 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 -57
- data/test/unit/models/attachment_test.rb +0 -116
- 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_test.rb +0 -56
- data/test/unit/models/email_page_portlet_test.rb +0 -14
- data/test/unit/models/file_block_test.rb +0 -230
- data/test/unit/models/group_test.rb +0 -13
- data/test/unit/models/html_block_test.rb +0 -102
- data/test/unit/models/link_test.rb +0 -52
- data/test/unit/models/page_partial_test.rb +0 -29
- data/test/unit/models/page_route_test.rb +0 -29
- data/test/unit/models/page_template_test.rb +0 -40
- data/test/unit/models/page_test.rb +0 -792
- data/test/unit/models/permission_test.rb +0 -10
- data/test/unit/models/portlet_test.rb +0 -69
- data/test/unit/models/sections_test.rb +0 -264
- data/test/unit/models/site_test.rb +0 -50
- data/test/unit/models/task_test.rb +0 -141
- data/test/unit/models/user_test.rb +0 -352
- data/test/unit/schema_statements_test.rb +0 -41
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
require File.join(File.dirname(__FILE__), '/../../test_helper')
|
|
2
|
-
|
|
3
|
-
class PagePartialTest < ActiveSupport::TestCase
|
|
4
|
-
def setup
|
|
5
|
-
@page_partial = Factory.build(:page_partial, :name => "_test")
|
|
6
|
-
File.delete(@page_partial.file_path) if File.exists?(@page_partial.file_path)
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def teardown
|
|
10
|
-
File.delete(@page_partial.file_path) if File.exists?(@page_partial.file_path)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def test_create
|
|
14
|
-
assert !File.exists?(@page_partial.file_path), "partial file already exists"
|
|
15
|
-
assert_valid @page_partial
|
|
16
|
-
assert @page_partial.save
|
|
17
|
-
assert File.exists?(@page_partial.file_path), "partial file was not written to disk"
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def test_for_valid_name
|
|
21
|
-
assert_not_valid Factory.build(:page_partial, :name => "Fancy")
|
|
22
|
-
assert_not_valid Factory.build(:page_partial, :name => "foo bar")
|
|
23
|
-
partial = Factory.build(:page_partial, :name => "subpage_1_column")
|
|
24
|
-
assert_valid partial
|
|
25
|
-
assert_equal "_subpage_1_column", partial.name
|
|
26
|
-
assert_valid Factory.build(:page_partial, :name => "_sidebar")
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
require File.join(File.dirname(__FILE__), '/../../test_helper')
|
|
2
|
-
|
|
3
|
-
class PageRouteTest < ActiveSupport::TestCase
|
|
4
|
-
|
|
5
|
-
def test_create
|
|
6
|
-
page = Factory(:page, :path => "/things/overview")
|
|
7
|
-
route = page.page_routes.build(:pattern => "/things/:year/:month/:day")
|
|
8
|
-
route.add_requirement(:year, "\\d{4,}")
|
|
9
|
-
route.add_requirement(:month, "\\d{2,}")
|
|
10
|
-
route.add_requirement(:day, "\\d{2,}")
|
|
11
|
-
route.add_condition(:method, "get")
|
|
12
|
-
|
|
13
|
-
assert route.save
|
|
14
|
-
assert_equal "/things/:year/:month/:day", route.pattern
|
|
15
|
-
assert_equal({
|
|
16
|
-
:controller => "cms/content",
|
|
17
|
-
:action => "show_page_route",
|
|
18
|
-
:_page_route_id => route.id.to_s,
|
|
19
|
-
:requirements => {
|
|
20
|
-
:year => /\d{4,}/,
|
|
21
|
-
:month => /\d{2,}/,
|
|
22
|
-
:day => /\d{2,}/
|
|
23
|
-
}, :conditions => {
|
|
24
|
-
:method => :get
|
|
25
|
-
}
|
|
26
|
-
}, route.options_map)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
require File.join(File.dirname(__FILE__), '/../../test_helper')
|
|
2
|
-
|
|
3
|
-
class PageTemplateTest < ActiveSupport::TestCase
|
|
4
|
-
def setup
|
|
5
|
-
@page_template = Factory.build(:page_template, :name => "test")
|
|
6
|
-
File.delete(@page_template.file_path) if File.exists?(@page_template.file_path)
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def teardown
|
|
10
|
-
File.delete(@page_template.file_path) if File.exists?(@page_template.file_path)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def test_create_and_destroy
|
|
14
|
-
assert !File.exists?(@page_template.file_path), "template file already exists"
|
|
15
|
-
assert_valid @page_template
|
|
16
|
-
assert @page_template.save
|
|
17
|
-
assert File.exists?(@page_template.file_path), "template file was not written to disk"
|
|
18
|
-
@page_template.destroy
|
|
19
|
-
assert !File.exists?(@page_template.file_path), "template file was not removed on destroy"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def test_for_valid_name
|
|
23
|
-
assert_not_valid Factory.build(:page_template, :name => "Fancy")
|
|
24
|
-
assert_not_valid Factory.build(:page_template, :name => "foo bar")
|
|
25
|
-
assert_valid Factory.build(:page_template, :name => "subpage_1_column")
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def test_find_by_file_name
|
|
29
|
-
assert @page_template.save, "Could not save page template"
|
|
30
|
-
assert_equal @page_template, PageTemplate.find_by_file_name("test.html.erb")
|
|
31
|
-
assert_nil PageTemplate.find_by_file_name("fail.html.erb")
|
|
32
|
-
assert_nil PageTemplate.find_by_file_name("fail.erb")
|
|
33
|
-
assert_nil PageTemplate.find_by_file_name("fail")
|
|
34
|
-
assert_nil PageTemplate.find_by_file_name(nil)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def test_default_body
|
|
38
|
-
assert_not_nil PageTemplate.default_body
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1,792 +0,0 @@
|
|
|
1
|
-
require File.join(File.dirname(__FILE__), '/../../test_helper')
|
|
2
|
-
|
|
3
|
-
class CreatingPageTest < ActiveRecord::TestCase
|
|
4
|
-
|
|
5
|
-
def test_it
|
|
6
|
-
|
|
7
|
-
@page = Page.new(
|
|
8
|
-
:name => "Test",
|
|
9
|
-
:path => "test",
|
|
10
|
-
:section => root_section,
|
|
11
|
-
:publish_on_save => true)
|
|
12
|
-
|
|
13
|
-
assert @page.save
|
|
14
|
-
assert_path_is_unique
|
|
15
|
-
|
|
16
|
-
@page.update_attributes(:name => "Test v2")
|
|
17
|
-
|
|
18
|
-
page = Page.find_live_by_path("/test")
|
|
19
|
-
assert_equal page.name, "Test"
|
|
20
|
-
assert_equal 1, page.version
|
|
21
|
-
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
test "Creating a page builds a section node" do
|
|
25
|
-
@page = Page.create!(:name=>"Hello", :path=>"/hello", :section => Factory(:root_section))
|
|
26
|
-
assert_not_nil @page.section_node
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
test "page with no parent" do
|
|
30
|
-
@page = Page.new
|
|
31
|
-
assert_nil @page.parent
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
test "#section is alias for #parent" do
|
|
35
|
-
@page = Page.new
|
|
36
|
-
assert_nil @page.section
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
protected
|
|
41
|
-
def assert_path_is_unique
|
|
42
|
-
page = Factory.build(:page, :path => @page.path)
|
|
43
|
-
assert_not_valid page
|
|
44
|
-
assert_has_error_on page, :path
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
class VersionTest < ActiveSupport::TestCase
|
|
50
|
-
|
|
51
|
-
def setup
|
|
52
|
-
@page = Factory(:public_page)
|
|
53
|
-
@another_page = Factory(:public_page)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
test "draft_version is stored on pages" do
|
|
57
|
-
assert_equal 1, @page.version
|
|
58
|
-
assert_equal 1, @page.latest_version
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
test "#update increments the latest_version" do
|
|
62
|
-
@page.name = "New"
|
|
63
|
-
@page.save!
|
|
64
|
-
@page.reload
|
|
65
|
-
|
|
66
|
-
assert_equal 1, @page.version
|
|
67
|
-
assert_equal 2, @page.latest_version
|
|
68
|
-
|
|
69
|
-
assert_equal 1, @another_page.reload.latest_version, "Should only update its own version, not other tables"
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
test "live? using latest version" do
|
|
73
|
-
assert @page.live?
|
|
74
|
-
|
|
75
|
-
@page.update_attributes(:name => "New")
|
|
76
|
-
@page.reload
|
|
77
|
-
refute @page.live?
|
|
78
|
-
|
|
79
|
-
@page.publish!
|
|
80
|
-
@page.reload
|
|
81
|
-
assert @page.live?
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
test "live? as_of_version" do
|
|
85
|
-
@page.update_attributes(:name => "New")
|
|
86
|
-
@page.publish!
|
|
87
|
-
|
|
88
|
-
v1 = @page.as_of_version(1)
|
|
89
|
-
assert v1.live?
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
class PageTest < ActiveRecord::TestCase
|
|
93
|
-
|
|
94
|
-
def test_creating_page_with_reserved_path
|
|
95
|
-
@page = Page.new(:name => "FAIL", :path => "/cms")
|
|
96
|
-
assert_not_valid @page
|
|
97
|
-
assert_has_error_on(@page, :path, "is invalid, '/cms' a reserved path")
|
|
98
|
-
|
|
99
|
-
@page = Page.new(:name => "FAIL", :path => "/cache")
|
|
100
|
-
assert_not_valid @page
|
|
101
|
-
assert_has_error_on(@page, :path, "is invalid, '/cache' a reserved path")
|
|
102
|
-
|
|
103
|
-
@page = Page.new(:name => "FTW", :path => "/whatever")
|
|
104
|
-
assert_valid @page
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
def test_find_live_by_path
|
|
108
|
-
@page = Factory.build(:page, :path => '/foo')
|
|
109
|
-
assert_nil Page.find_live_by_path('/foo')
|
|
110
|
-
|
|
111
|
-
@page.publish!
|
|
112
|
-
reset(:page)
|
|
113
|
-
assert_equal @page, Page.find_live_by_path('/foo')
|
|
114
|
-
|
|
115
|
-
@page.update_attributes(:path => '/bar')
|
|
116
|
-
assert_equal @page, Page.find_live_by_path('/foo')
|
|
117
|
-
assert_nil Page.find_live_by_path('/bar')
|
|
118
|
-
|
|
119
|
-
@page.publish!
|
|
120
|
-
reset(:page)
|
|
121
|
-
assert_nil Page.find_live_by_path('/foo')
|
|
122
|
-
assert_equal @page, Page.find_live_by_path('/bar')
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
def test_find_live_by_path_after_delete
|
|
126
|
-
@page = Factory.build(:page, :path => '/foo')
|
|
127
|
-
@page.publish!
|
|
128
|
-
reset(:page)
|
|
129
|
-
|
|
130
|
-
@page.mark_as_deleted!
|
|
131
|
-
assert_nil Page.find_live_by_path('/foo')
|
|
132
|
-
|
|
133
|
-
@new_page = Factory.build(:page, :path => '/foo')
|
|
134
|
-
assert_nil Page.find_live_by_path('/foo')
|
|
135
|
-
|
|
136
|
-
@new_page.publish!
|
|
137
|
-
reset(:new_page)
|
|
138
|
-
assert_equal @new_page, Page.find_live_by_path('/foo')
|
|
139
|
-
assert_not_equal @page, @new_page
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
def test_path_normalization
|
|
143
|
-
page = Factory.build(:page, :path => 'foo/bar')
|
|
144
|
-
assert_valid page
|
|
145
|
-
assert_equal "/foo/bar", page.path
|
|
146
|
-
|
|
147
|
-
page = Factory.build(:page, :path => '/foo/bar')
|
|
148
|
-
assert_valid page
|
|
149
|
-
assert_equal "/foo/bar", page.path
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
def test_template
|
|
153
|
-
page_template = Factory(:page_template, :name => 'test')
|
|
154
|
-
page = Factory.build(:page, :template_file_name => 'test.html.erb')
|
|
155
|
-
assert_equal 'test.html.erb', page.template_file_name
|
|
156
|
-
assert_equal 'Test (html/erb)', page.template_name
|
|
157
|
-
assert_equal page_template, page.template
|
|
158
|
-
assert_equal 'templates/test', page.layout
|
|
159
|
-
|
|
160
|
-
page = Factory.build(:page, :template_file_name => 'foo.html.erb')
|
|
161
|
-
assert_equal 'foo.html.erb', page.template_file_name
|
|
162
|
-
assert_equal 'Foo (html/erb)', page.template_name
|
|
163
|
-
assert_nil page.template
|
|
164
|
-
assert_equal 'templates/foo', page.layout
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
def test_revision_comments
|
|
168
|
-
page = Factory(:page, :section => root_section, :name => "V1")
|
|
169
|
-
|
|
170
|
-
assert_equal 'Created', page.live_version.version_comment
|
|
171
|
-
|
|
172
|
-
assert page.reload.save
|
|
173
|
-
assert_equal 'Created', page.reload.live_version.version_comment
|
|
174
|
-
assert_equal page.live_version.version_comment,
|
|
175
|
-
page.as_of_version(page.version).live_version.version_comment
|
|
176
|
-
|
|
177
|
-
page.update_attributes(:name => "V2")
|
|
178
|
-
assert_equal 'Changed name', page.draft.version_comment
|
|
179
|
-
assert_equal 'Created', page.live_version.version_comment
|
|
180
|
-
|
|
181
|
-
block = Factory(:html_block, :name => "Hello, World!")
|
|
182
|
-
page.create_connector(block, "main")
|
|
183
|
-
assert_equal "Html Block 'Hello, World!' was added to the 'main' container",
|
|
184
|
-
page.draft.version_comment
|
|
185
|
-
assert_equal 'Created', page.live_version.version_comment
|
|
186
|
-
assert_equal 3, page.reload.draft.version
|
|
187
|
-
|
|
188
|
-
page.create_connector(Factory(:html_block, :name => "Whatever"), "main")
|
|
189
|
-
assert_equal 4, page.reload.draft.version
|
|
190
|
-
|
|
191
|
-
page.move_connector_down(page.connectors.for_page_version(page.reload.draft.version).for_connectable(block).first)
|
|
192
|
-
assert_equal "Html Block 'Hello, World!' was moved down within the 'main' container",
|
|
193
|
-
page.draft.version_comment
|
|
194
|
-
assert_equal 'Created', page.live_version.version_comment
|
|
195
|
-
|
|
196
|
-
page.move_connector_up(page.connectors.for_page_version(page.reload.draft.version).for_connectable(block).first)
|
|
197
|
-
assert_equal "Html Block 'Hello, World!' was moved up within the 'main' container",
|
|
198
|
-
page.draft.version_comment
|
|
199
|
-
assert_equal 'Created', page.live_version.version_comment
|
|
200
|
-
|
|
201
|
-
page.remove_connector(page.connectors.for_page_version(page.reload.draft.version).for_connectable(block).first)
|
|
202
|
-
assert_equal "Html Block 'Hello, World!' was removed from the 'main' container",
|
|
203
|
-
page.draft.version_comment
|
|
204
|
-
assert_equal 'Created', page.live_version.version_comment
|
|
205
|
-
|
|
206
|
-
page.revert_to(1)
|
|
207
|
-
assert_equal "Reverted to version 1",
|
|
208
|
-
page.reload.draft.version_comment
|
|
209
|
-
assert_equal 'Created', page.live_version.version_comment
|
|
210
|
-
|
|
211
|
-
assert_equal "Created", page.as_of_version(1).current_version.version_comment
|
|
212
|
-
assert_equal "Changed name", page.as_of_version(2).current_version.version_comment
|
|
213
|
-
assert_equal "Reverted to version 1", page.draft.version_comment
|
|
214
|
-
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
def test_container_live
|
|
218
|
-
page = Factory(:page)
|
|
219
|
-
published = Factory(:html_block, :publish_on_save => true)
|
|
220
|
-
unpublished = Factory(:html_block)
|
|
221
|
-
page.create_connector(published, "main")
|
|
222
|
-
page.create_connector(unpublished, "main")
|
|
223
|
-
assert !page.container_published?("main")
|
|
224
|
-
assert unpublished.publish
|
|
225
|
-
assert page.container_published?("main")
|
|
226
|
-
end
|
|
227
|
-
|
|
228
|
-
def test_move_page_to_another_section
|
|
229
|
-
page = Factory(:public_page)
|
|
230
|
-
new_section = Factory(:public_section)
|
|
231
|
-
|
|
232
|
-
assert_not_equal new_section, page.section
|
|
233
|
-
page.section = new_section
|
|
234
|
-
assert page.save
|
|
235
|
-
assert_equal new_section, page.section
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
def test_deleting_page
|
|
239
|
-
page = Factory(:page)
|
|
240
|
-
|
|
241
|
-
page_count = Page.count_with_deleted
|
|
242
|
-
page_version_count = page.versions.count
|
|
243
|
-
assert !page.deleted?
|
|
244
|
-
|
|
245
|
-
page.destroy
|
|
246
|
-
|
|
247
|
-
assert_equal page_count, Page.count_with_deleted
|
|
248
|
-
assert_incremented page_version_count, page.versions.count
|
|
249
|
-
assert page.deleted?
|
|
250
|
-
assert_raise ActiveRecord::RecordNotFound do
|
|
251
|
-
Page.find(page.id)
|
|
252
|
-
end
|
|
253
|
-
end
|
|
254
|
-
|
|
255
|
-
def test_adding_a_block_to_a_page_puts_page_in_draft_mode
|
|
256
|
-
@page = Factory(:page, :section => root_section, :publish_on_save => true)
|
|
257
|
-
@block = Factory(:html_block, :publish_on_save => true)
|
|
258
|
-
reset(:page, :block)
|
|
259
|
-
assert @page.published?
|
|
260
|
-
assert @block.published?
|
|
261
|
-
@page.create_connector(@block, "main")
|
|
262
|
-
reset(:page, :block)
|
|
263
|
-
assert !@page.live?
|
|
264
|
-
end
|
|
265
|
-
|
|
266
|
-
def test_reverting_and_then_publishing_a_page
|
|
267
|
-
@page = Factory(:page, :section => root_section, :publish_on_save => true)
|
|
268
|
-
|
|
269
|
-
@block = Factory(:html_block,
|
|
270
|
-
:connect_to_page_id => @page.id,
|
|
271
|
-
:connect_to_container => "main")
|
|
272
|
-
@page.publish
|
|
273
|
-
|
|
274
|
-
reset(:page, :block)
|
|
275
|
-
|
|
276
|
-
assert_equal 2, @page.version
|
|
277
|
-
assert_equal 1, @page.connectors.for_page_version(@page.version).count
|
|
278
|
-
|
|
279
|
-
@block.update_attributes(:content => "Something else")
|
|
280
|
-
@page.publish!
|
|
281
|
-
reset(:page, :block)
|
|
282
|
-
|
|
283
|
-
assert_equal 1, @page.connectors.for_page_version(@page.version).count
|
|
284
|
-
assert_equal 2, @block.version
|
|
285
|
-
assert_equal 3, @page.version
|
|
286
|
-
assert @block.live?
|
|
287
|
-
assert @page.live?
|
|
288
|
-
|
|
289
|
-
@page.revert_to(2)
|
|
290
|
-
reset(:page, :block)
|
|
291
|
-
|
|
292
|
-
assert_equal 3, @page.version
|
|
293
|
-
assert_equal 4, @page.draft.version
|
|
294
|
-
assert_equal 2, @block.version
|
|
295
|
-
assert_equal 3, @block.draft.version
|
|
296
|
-
assert_equal 1, @page.connectors.for_page_version(@page.version).count
|
|
297
|
-
assert_equal 1, @page.connectors.for_page_version(@page.draft.version).count
|
|
298
|
-
assert !@page.live?
|
|
299
|
-
assert !@block.live?
|
|
300
|
-
|
|
301
|
-
end
|
|
302
|
-
|
|
303
|
-
end
|
|
304
|
-
|
|
305
|
-
class UserStampingTest < ActiveRecord::TestCase
|
|
306
|
-
|
|
307
|
-
def setup
|
|
308
|
-
@first_guy = Factory(:user, :login => "first_guy")
|
|
309
|
-
@next_guy = Factory(:user, :login => "next_guy")
|
|
310
|
-
User.current = @first_guy
|
|
311
|
-
end
|
|
312
|
-
|
|
313
|
-
def teardown
|
|
314
|
-
User.current = nil
|
|
315
|
-
end
|
|
316
|
-
|
|
317
|
-
def test_user_stamps_are_applied_to_versions
|
|
318
|
-
page = Factory(:page, :name => "Original Value")
|
|
319
|
-
|
|
320
|
-
assert_equal page, page.draft.page
|
|
321
|
-
assert_equal @first_guy, page.updated_by
|
|
322
|
-
|
|
323
|
-
User.current = @new_guy
|
|
324
|
-
page.update_attributes(:name => "Something Different")
|
|
325
|
-
|
|
326
|
-
assert_equal "Something Different", page.draft.name
|
|
327
|
-
assert_equal "Original Value", page.reload.name
|
|
328
|
-
assert_equal "Original Value", page.versions.first.name
|
|
329
|
-
assert_equal @first_guy, page.versions.first.updated_by
|
|
330
|
-
assert_equal @new_guy, page.versions.last.updated_by
|
|
331
|
-
assert_equal 2, page.versions.count
|
|
332
|
-
end
|
|
333
|
-
|
|
334
|
-
end
|
|
335
|
-
|
|
336
|
-
class PageInSectionTest < ActiveRecord::TestCase
|
|
337
|
-
|
|
338
|
-
def setup
|
|
339
|
-
@root = Factory(:root_section, :name=>"First Section")
|
|
340
|
-
@football_section = Factory :public_section, :name=>"Football", :parent=>@root
|
|
341
|
-
@baseball_section = Factory :public_section, :name=>"Baseball", :parent=>@root
|
|
342
|
-
|
|
343
|
-
@football_page = Factory :public_page, :section=>@football_section
|
|
344
|
-
@baseball_page = Factory :public_page, :section=>@baseball_section
|
|
345
|
-
end
|
|
346
|
-
|
|
347
|
-
test "in_section if immediate parent section is included" do
|
|
348
|
-
assert @football_page.in_section?("Football")
|
|
349
|
-
assert !@baseball_page.in_section?("Football")
|
|
350
|
-
end
|
|
351
|
-
|
|
352
|
-
test "in_section if immediate parent's name is included" do
|
|
353
|
-
assert @football_page.in_section?("Football")
|
|
354
|
-
assert !@baseball_page.in_section?("Football")
|
|
355
|
-
end
|
|
356
|
-
|
|
357
|
-
test "in_section if any ancestor is included" do
|
|
358
|
-
assert @football_page.in_section?(@root)
|
|
359
|
-
assert @baseball_page.in_section?(@root)
|
|
360
|
-
assert @football_page.in_section?("First Section")
|
|
361
|
-
assert @baseball_page.in_section?("First Section")
|
|
362
|
-
end
|
|
363
|
-
|
|
364
|
-
test "#top_level_section" do
|
|
365
|
-
assert_equal @football_section, @football_page.top_level_section
|
|
366
|
-
assert_equal @baseball_section, @baseball_page.top_level_section
|
|
367
|
-
|
|
368
|
-
second_level_section = Factory(:public_section, :parent=>@football_section)
|
|
369
|
-
second_level_page = Factory(:public_page, :section=>second_level_section)
|
|
370
|
-
assert_equal @football_section, second_level_page.top_level_section
|
|
371
|
-
end
|
|
372
|
-
|
|
373
|
-
test "#top_level_section caches result to avoid repeated requests" do
|
|
374
|
-
top = @football_page.top_level_section
|
|
375
|
-
assert_equal top.object_id, @football_page.top_level_section.object_id
|
|
376
|
-
end
|
|
377
|
-
end
|
|
378
|
-
|
|
379
|
-
class PageWithAssociatedBlocksTest < ActiveRecord::TestCase
|
|
380
|
-
def setup
|
|
381
|
-
super
|
|
382
|
-
@page = Factory(:page, :section => root_section, :name => "Bar")
|
|
383
|
-
@block = Factory(:html_block)
|
|
384
|
-
@other_connector = Factory(:connector, :connectable => @block, :connectable_version => @block.version)
|
|
385
|
-
@page_connector = Factory(:connector, :page => @page, :page_version => @page.version, :connectable => @block, :connectable_version => @block.version)
|
|
386
|
-
end
|
|
387
|
-
|
|
388
|
-
# It should create a new page version and a new connector
|
|
389
|
-
def test_updating_the_page_with_changes
|
|
390
|
-
connector_count = Connector.count
|
|
391
|
-
page_version = @page.version
|
|
392
|
-
|
|
393
|
-
@page.update_attributes(:name => "Foo")
|
|
394
|
-
|
|
395
|
-
assert_incremented connector_count, Connector.count
|
|
396
|
-
assert_equal page_version, @page.version
|
|
397
|
-
assert_incremented page_version, @page.draft.version
|
|
398
|
-
end
|
|
399
|
-
|
|
400
|
-
# It should not create a new page version or a new connector
|
|
401
|
-
def test_updating_the_page_without_changes
|
|
402
|
-
connector_count = Connector.count
|
|
403
|
-
page_version = @page.version
|
|
404
|
-
|
|
405
|
-
@page.update_attributes(:name => @page.name)
|
|
406
|
-
|
|
407
|
-
assert_equal connector_count, Connector.count
|
|
408
|
-
assert_equal page_version, @page.version
|
|
409
|
-
end
|
|
410
|
-
|
|
411
|
-
def test_deleting_a_page
|
|
412
|
-
connector_count = Connector.count
|
|
413
|
-
assert Connector.exists?(@page_connector.id)
|
|
414
|
-
assert Connector.exists?(@other_connector.id)
|
|
415
|
-
|
|
416
|
-
@page.destroy
|
|
417
|
-
|
|
418
|
-
assert_decremented connector_count, Connector.count
|
|
419
|
-
assert !Connector.exists?(@page_connector.id)
|
|
420
|
-
assert Connector.exists?(@other_connector.id)
|
|
421
|
-
assert HtmlBlock.exists?(@block.id)
|
|
422
|
-
assert !@block.deleted?
|
|
423
|
-
end
|
|
424
|
-
end
|
|
425
|
-
|
|
426
|
-
class AddingBlocksToPageTest < ActiveRecord::TestCase
|
|
427
|
-
def test_that_it_works
|
|
428
|
-
@page = Factory(:page, :section => root_section)
|
|
429
|
-
@block = Factory(:html_block)
|
|
430
|
-
@block2 = Factory(:html_block)
|
|
431
|
-
@first_conn = @page.create_connector(@block, "testing")
|
|
432
|
-
@second_conn = @page.create_connector(@block2, "testing")
|
|
433
|
-
|
|
434
|
-
page_version_count = @page.versions.count
|
|
435
|
-
connector_count = Connector.count
|
|
436
|
-
|
|
437
|
-
@conn = @page.create_connector(@block2, "testing")
|
|
438
|
-
|
|
439
|
-
assert_equal 1, @page.reload.version
|
|
440
|
-
assert_equal 4, @conn.page_version
|
|
441
|
-
assert_equal 1, @conn.connectable_version
|
|
442
|
-
assert_incremented page_version_count, @page.versions.count
|
|
443
|
-
assert_equal 3, @page.connectors.for_page_version(@page.draft.version).count
|
|
444
|
-
assert_equal connector_count + 3, Connector.count
|
|
445
|
-
|
|
446
|
-
# should leave the previous connectors untouched
|
|
447
|
-
@conns = @page.connectors.all(:conditions => ["page_version < 4"], :order => "id")
|
|
448
|
-
|
|
449
|
-
assert_equal 3, @conns.size
|
|
450
|
-
|
|
451
|
-
assert_properties @conns[0], {
|
|
452
|
-
:connectable => @block,
|
|
453
|
-
:page => @page,
|
|
454
|
-
:page_version => 2,
|
|
455
|
-
:connectable_version => 1
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
assert_properties @conns[1], {
|
|
459
|
-
:connectable => @block,
|
|
460
|
-
:page => @page,
|
|
461
|
-
:page_version => 3,
|
|
462
|
-
:connectable_version => 1
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
assert_properties @conns[2], {
|
|
466
|
-
:connectable => @block2,
|
|
467
|
-
:page => @page,
|
|
468
|
-
:page_version => 3,
|
|
469
|
-
:connectable_version => 1
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
@conns = @page.connectors.for_page_version(4).all(:order => "id")
|
|
473
|
-
assert_equal 3, @conns.size
|
|
474
|
-
|
|
475
|
-
assert_properties @conns[0], {
|
|
476
|
-
:connectable => @block,
|
|
477
|
-
:page => @page,
|
|
478
|
-
:page_version => 4,
|
|
479
|
-
:connectable_version => 1
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
assert_properties @conns[1], {
|
|
483
|
-
:connectable => @block2,
|
|
484
|
-
:page => @page,
|
|
485
|
-
:page_version => 4,
|
|
486
|
-
:connectable_version => 1
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
assert_properties @conns[2], {
|
|
490
|
-
:connectable => @block2,
|
|
491
|
-
:page => @page,
|
|
492
|
-
:page_version => 4,
|
|
493
|
-
:connectable_version => 1
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
end
|
|
497
|
-
end
|
|
498
|
-
|
|
499
|
-
class PageWithTwoBlocksTest < ActiveRecord::TestCase
|
|
500
|
-
def setup
|
|
501
|
-
super
|
|
502
|
-
@page = Factory(:page, :section => root_section)
|
|
503
|
-
@foo_block = Factory(:html_block, :name => "Foo Block")
|
|
504
|
-
@bar_block = Factory(:html_block, :name => "Bar Block")
|
|
505
|
-
@page.create_connector(@foo_block, "whatever")
|
|
506
|
-
@page.reload
|
|
507
|
-
@page.create_connector(@bar_block, "whatever")
|
|
508
|
-
@page.reload
|
|
509
|
-
end
|
|
510
|
-
|
|
511
|
-
def test_editing_one_of_the_blocks_creates_a_new_version_of_the_page
|
|
512
|
-
page_version = @page.draft.version
|
|
513
|
-
@foo_block.update_attributes(:name => "Something Else")
|
|
514
|
-
assert_incremented page_version, @page.draft.version
|
|
515
|
-
end
|
|
516
|
-
|
|
517
|
-
# A page that had 2 blocks added to it and then had them removed,
|
|
518
|
-
# when reverting to the previous version,
|
|
519
|
-
# should restore the connectors from the version being reverted to
|
|
520
|
-
def test_removing_and_reverting_to_previous_version
|
|
521
|
-
remove_both_connectors!
|
|
522
|
-
|
|
523
|
-
connector_count = Connector.count
|
|
524
|
-
|
|
525
|
-
@page.revert
|
|
526
|
-
|
|
527
|
-
assert_incremented connector_count, Connector.count
|
|
528
|
-
|
|
529
|
-
assert_properties @page.reload.connectors.for_page_version(@page.draft.version).first, {
|
|
530
|
-
:page => @page,
|
|
531
|
-
:page_version => 6,
|
|
532
|
-
:connectable => @bar_block,
|
|
533
|
-
:connectable_version => 1,
|
|
534
|
-
:container => "whatever"}
|
|
535
|
-
end
|
|
536
|
-
|
|
537
|
-
# A page that had 2 blocks added to it and then had then removed,
|
|
538
|
-
# when reverting to the version that had both connectors,
|
|
539
|
-
# should restore the connectors that version
|
|
540
|
-
def test_removing_and_reverting_to_version_with_both_connectors
|
|
541
|
-
remove_both_connectors!
|
|
542
|
-
|
|
543
|
-
connector_count = Connector.count
|
|
544
|
-
|
|
545
|
-
@page.revert_to(3)
|
|
546
|
-
|
|
547
|
-
assert_equal connector_count + 2, Connector.count
|
|
548
|
-
|
|
549
|
-
foo, bar = @page.reload.connectors.for_page_version(@page.draft.version).find(:all, :order => "connectors.position")
|
|
550
|
-
assert_properties foo, {
|
|
551
|
-
:page => @page,
|
|
552
|
-
:page_version => 6,
|
|
553
|
-
:connectable => @foo_block,
|
|
554
|
-
:connectable_version => 1,
|
|
555
|
-
:container => "whatever"}
|
|
556
|
-
assert_properties bar, {
|
|
557
|
-
:page => @page,
|
|
558
|
-
:page_version => 6,
|
|
559
|
-
:connectable => @bar_block,
|
|
560
|
-
:connectable_version => 1,
|
|
561
|
-
:container => "whatever"}
|
|
562
|
-
|
|
563
|
-
end
|
|
564
|
-
|
|
565
|
-
def test_updating_one_of_the_blocks_and_reverting_to_version_before_the_update
|
|
566
|
-
target_version = @page.draft.version
|
|
567
|
-
@foo_block.update_attributes!(:name => "Foo V2")
|
|
568
|
-
@page.reload
|
|
569
|
-
|
|
570
|
-
page_version = @page.draft.version
|
|
571
|
-
foo_block_version = @foo_block.draft.version
|
|
572
|
-
|
|
573
|
-
@page.revert_to(target_version)
|
|
574
|
-
|
|
575
|
-
assert_incremented page_version, @page.draft.version
|
|
576
|
-
assert_incremented foo_block_version, @foo_block.draft.version
|
|
577
|
-
assert_equal "Foo Block", @page.connectors.for_page_version(@page.draft.version).reload.first.connectable.name
|
|
578
|
-
end
|
|
579
|
-
|
|
580
|
-
protected
|
|
581
|
-
def remove_both_connectors!
|
|
582
|
-
@page.remove_connector(@page.connectors.for_page_version(@page.draft.version).first(:order => "connectors.position"))
|
|
583
|
-
@page.remove_connector(@page.connectors.for_page_version(@page.draft.version).first(:order => "connectors.position"))
|
|
584
|
-
end
|
|
585
|
-
|
|
586
|
-
end
|
|
587
|
-
|
|
588
|
-
class PageWithBlockTest < ActiveRecord::TestCase
|
|
589
|
-
def setup
|
|
590
|
-
@page = Factory(:page, :section => root_section)
|
|
591
|
-
@block = Factory(:html_block)
|
|
592
|
-
@conn = @page.create_connector(@block, "bar")
|
|
593
|
-
@page.publish!
|
|
594
|
-
@conn = @page.connectors.for_page_version(@page.version).for_connectable(@block).first
|
|
595
|
-
end
|
|
596
|
-
|
|
597
|
-
def test_removing_connector
|
|
598
|
-
page_version = @page.draft.version
|
|
599
|
-
page_version_count = Page::Version.count
|
|
600
|
-
assert @page.published?
|
|
601
|
-
|
|
602
|
-
@page.remove_connector(@conn)
|
|
603
|
-
|
|
604
|
-
assert_incremented page_version_count, Page::Version.count
|
|
605
|
-
assert_incremented page_version, @page.draft.version
|
|
606
|
-
|
|
607
|
-
conns = @page.connectors.for_page_version(@page.draft.version-1).all
|
|
608
|
-
assert_equal 1, conns.size
|
|
609
|
-
|
|
610
|
-
assert_properties conns.first, {
|
|
611
|
-
:page => @page,
|
|
612
|
-
:page_version => page_version,
|
|
613
|
-
:connectable => @block,
|
|
614
|
-
:connectable_version => @block.version
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
assert @page.reload.connectors.for_page_version(@page.draft.version).empty?
|
|
618
|
-
assert !@page.live?
|
|
619
|
-
end
|
|
620
|
-
|
|
621
|
-
def test_removing_multiple_connectors
|
|
622
|
-
@block2 = Factory(:html_block)
|
|
623
|
-
@conn2 = @page.create_connector(@block2, "bar")
|
|
624
|
-
@conn3 = @page.create_connector(@block2, "foo")
|
|
625
|
-
#Need to get the new connector that matches @conn2, otherwise you will delete an older version, not the latest connector
|
|
626
|
-
@conn2 = Connector.first(:conditions => {:page_id => @page.reload.id, :page_version => @page.draft.version, :connectable_id => @block2.id, :connectable_version => @block2.version, :container => "bar"})
|
|
627
|
-
@page.remove_connector(@conn2)
|
|
628
|
-
|
|
629
|
-
page_version_count = Page::Version.count
|
|
630
|
-
page_version = @page.draft.version
|
|
631
|
-
page_connector_count = @page.connectors.for_page_version(@page.draft.version).count
|
|
632
|
-
|
|
633
|
-
@conn = Connector.first(:conditions => {:page_id => @page.reload.id, :page_version => @page.draft.version, :connectable_id => @block2.id, :connectable_version => @block2.version, :container => "foo"})
|
|
634
|
-
@page.remove_connector(@conn)
|
|
635
|
-
@page.reload
|
|
636
|
-
|
|
637
|
-
assert_incremented page_version_count, Page::Version.count
|
|
638
|
-
assert_incremented page_version, @page.draft.version
|
|
639
|
-
assert_decremented page_connector_count,
|
|
640
|
-
@page.connectors.for_page_version(@page.draft.version).count
|
|
641
|
-
|
|
642
|
-
conns = @page.connectors.all(:order => "id")
|
|
643
|
-
|
|
644
|
-
#log_array conns, :id, :page_id, :page_version, :connectable_id, :connectable_type, :connectable_version, :container, :position
|
|
645
|
-
|
|
646
|
-
assert_equal 9, conns.size
|
|
647
|
-
|
|
648
|
-
assert_properties conns[0], {:page => @page, :page_version => 2, :connectable => @block, :connectable_version => 1, :container => "bar", :position => 1}
|
|
649
|
-
assert_properties conns[1], {:page => @page, :page_version => 3, :connectable => @block, :connectable_version => 1, :container => "bar", :position => 1}
|
|
650
|
-
assert_properties conns[2], {:page => @page, :page_version => 3, :connectable => @block2, :connectable_version => 1, :container => "bar", :position => 2}
|
|
651
|
-
assert_properties conns[3], {:page => @page, :page_version => 4, :connectable => @block, :connectable_version => 1, :container => "bar", :position => 1}
|
|
652
|
-
assert_properties conns[4], {:page => @page, :page_version => 4, :connectable => @block2, :connectable_version => 1, :container => "bar", :position => 2}
|
|
653
|
-
assert_properties conns[5], {:page => @page, :page_version => 4, :connectable => @block2, :connectable_version => 1, :container => "foo", :position => 1}
|
|
654
|
-
assert_properties conns[6], {:page => @page, :page_version => 5, :connectable => @block, :connectable_version => 1, :container => "bar", :position => 1}
|
|
655
|
-
assert_properties conns[7], {:page => @page, :page_version => 5, :connectable => @block2, :connectable_version => 1, :container => "foo", :position => 1}
|
|
656
|
-
assert_properties conns[8], {:page => @page, :page_version => 6, :connectable => @block, :connectable_version => 1, :container => "bar", :position => 1}
|
|
657
|
-
end
|
|
658
|
-
|
|
659
|
-
end
|
|
660
|
-
|
|
661
|
-
class UnpublishedPageWithOnePublishedAndOneUnpublishedBlockTest < ActiveRecord::TestCase
|
|
662
|
-
def setup
|
|
663
|
-
@page = Factory(:page, :section => root_section)
|
|
664
|
-
@published_block = Factory(:html_block, :name => "Published")
|
|
665
|
-
@unpublished_block = Factory(:html_block, :name => "Unpublished")
|
|
666
|
-
@page.create_connector(@published_block, "main")
|
|
667
|
-
@page.create_connector(@unpublished_block, "main")
|
|
668
|
-
@published_block.publish!
|
|
669
|
-
@page.reload
|
|
670
|
-
end
|
|
671
|
-
|
|
672
|
-
def test_publishing_the_block
|
|
673
|
-
@unpublished_block.publish!
|
|
674
|
-
assert @unpublished_block.reload.published?
|
|
675
|
-
@page.reload
|
|
676
|
-
assert !@page.live?
|
|
677
|
-
end
|
|
678
|
-
|
|
679
|
-
def test_publishing_the_page
|
|
680
|
-
page_version_count = Page::Version.count
|
|
681
|
-
unpublished_block_version_count = @unpublished_block.versions.count
|
|
682
|
-
published_block_version_count = @published_block.versions.count
|
|
683
|
-
|
|
684
|
-
@page.publish!
|
|
685
|
-
|
|
686
|
-
assert_equal page_version_count, Page::Version.count
|
|
687
|
-
assert_equal unpublished_block_version_count, @unpublished_block.versions.count
|
|
688
|
-
assert_equal published_block_version_count, @published_block.versions.count
|
|
689
|
-
assert @page.live?
|
|
690
|
-
assert @unpublished_block.reload.live?
|
|
691
|
-
assert @published_block.reload.live?
|
|
692
|
-
end
|
|
693
|
-
|
|
694
|
-
end
|
|
695
|
-
|
|
696
|
-
class RevertingABlockThatIsOnMultiplePagesTest < ActiveRecord::TestCase
|
|
697
|
-
def test_that_it_reverts_both_pages
|
|
698
|
-
|
|
699
|
-
# 1. Create a new page (Page 1, v1)
|
|
700
|
-
@page1 = Factory(:page, :name => "Page 1")
|
|
701
|
-
assert_equal 1, @page1.version
|
|
702
|
-
|
|
703
|
-
# 2. Create a new page (Page 2, v1)
|
|
704
|
-
@page2 = Factory(:page, :name => "Page 2")
|
|
705
|
-
|
|
706
|
-
# 3. Add a new html block to Page 1. Save, don't publish. (Page 1, v2)
|
|
707
|
-
@block = Factory(:html_block, :name => "Block v1",
|
|
708
|
-
:connect_to_page_id => @page1.id, :connect_to_container => "main")
|
|
709
|
-
reset(:page1, :page2, :block)
|
|
710
|
-
assert_equal 2, @page1.draft.version
|
|
711
|
-
assert_equal 1, @page2.draft.version
|
|
712
|
-
|
|
713
|
-
# 4. Goto page 2, and select that block. (Page 2, v2)
|
|
714
|
-
@page2.create_connector(@block, "main")
|
|
715
|
-
reset(:page1, :page2, :block)
|
|
716
|
-
assert_equal 2, @page1.draft.version
|
|
717
|
-
assert_equal 2, @page2.draft.version
|
|
718
|
-
|
|
719
|
-
# 5. Edit the block (Page 1, v3, Page 2, v3, Block v2)
|
|
720
|
-
@block.update_attributes!(:name => "Block v2")
|
|
721
|
-
reset(:page1, :page2, :block)
|
|
722
|
-
assert_equal 3, @page1.draft.version
|
|
723
|
-
assert_equal 3, @page2.draft.version
|
|
724
|
-
assert_equal 2, @block.draft.version
|
|
725
|
-
|
|
726
|
-
# 6. Revert page 1 to version 2. (Page 1, v4, Page 2, v4, Block v3)
|
|
727
|
-
@page1.revert_to(2)
|
|
728
|
-
reset(:page1, :page2, :block)
|
|
729
|
-
assert_equal 4, @page1.draft.version
|
|
730
|
-
assert_equal 3, @block.draft.version
|
|
731
|
-
assert_equal 4, @page2.draft.version
|
|
732
|
-
|
|
733
|
-
# Expected: Both page 1 and 2 will display the same version of the block (v1).
|
|
734
|
-
assert_equal "Block v1", @page1.connectors.first.connectable.name
|
|
735
|
-
assert_equal "Block v1", @page2.connectors.first.connectable.name
|
|
736
|
-
|
|
737
|
-
end
|
|
738
|
-
|
|
739
|
-
end
|
|
740
|
-
|
|
741
|
-
class ViewingAPreviousVersionOfAPageTest < ActiveRecord::TestCase
|
|
742
|
-
|
|
743
|
-
def test_that_it_shows_the_correct_version_of_the_blocks_it_is_connected_to
|
|
744
|
-
# 1. Create Page A (v1)
|
|
745
|
-
@page = Factory(:page, :section => root_section)
|
|
746
|
-
|
|
747
|
-
# 2. Add new Html Block A to Page A (Page A v2, Block A v1)
|
|
748
|
-
@block = Factory(:html_block, :name => "Block 1", :connect_to_page_id => @page.id, :connect_to_container => "main")
|
|
749
|
-
reset(:page, :block)
|
|
750
|
-
assert_equal 2, @page.draft.version
|
|
751
|
-
assert_equal 1, @block.draft.version
|
|
752
|
-
|
|
753
|
-
# 3. Publish Page A (Page A v3, Block A v2)
|
|
754
|
-
@page.publish!
|
|
755
|
-
reset(:page, :block)
|
|
756
|
-
assert_equal 2, @page.draft.version
|
|
757
|
-
assert_equal 1, @block.draft.version
|
|
758
|
-
|
|
759
|
-
# 4. Edit Block A (Page A v4, Block A v3)
|
|
760
|
-
@block.update_attributes!(:name => "Block 2")
|
|
761
|
-
reset(:page, :block)
|
|
762
|
-
assert_equal 2, @page.version
|
|
763
|
-
assert_equal 3, @page.draft.version
|
|
764
|
-
assert_equal 2, @block.draft.version
|
|
765
|
-
|
|
766
|
-
# Open Page A in a different browser (as guest)
|
|
767
|
-
@live_page = Page.find_live_by_path(@page.path)
|
|
768
|
-
assert_equal 2, @live_page.version
|
|
769
|
-
assert_equal "Block 1", @live_page.connectors.for_page_version(@live_page.version).first.connectable.live_version.name
|
|
770
|
-
|
|
771
|
-
end
|
|
772
|
-
end
|
|
773
|
-
|
|
774
|
-
class PortletsDontHaveDraftsTest < ActiveRecord::TestCase
|
|
775
|
-
|
|
776
|
-
def test_connectors_with_portlets_should_correctly_be_copied
|
|
777
|
-
@page = Factory(:page, :section=> root_section)
|
|
778
|
-
@portlet = TagCloudPortlet.create(:name=>"Portlet", :connect_to_page_id => @page.id, :connect_to_container => "main")
|
|
779
|
-
|
|
780
|
-
# Check some assumptions.
|
|
781
|
-
assert_equal 2, @page.draft.version, "Verifying that adding a portlet correctly increments page version."
|
|
782
|
-
connectors = Connector.for_connectable(@portlet)
|
|
783
|
-
assert_equal 1, connectors.size, "This portlet should have only 1 connector."
|
|
784
|
-
|
|
785
|
-
# Verifies that an exception is not thrown while removing connectors
|
|
786
|
-
@page.remove_connector(connectors[0])
|
|
787
|
-
|
|
788
|
-
assert_equal 3, @page.draft.version
|
|
789
|
-
assert @page.reload.connectors.for_page_version(@page.draft.version).empty?, "Verify that all connectors for the latest page are removed."
|
|
790
|
-
end
|
|
791
|
-
end
|
|
792
|
-
|