adva_cms 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/NOTES +132 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/adva_cms.gemspec +22 -0
- data/app/assets/images/adva_cms/admin/header_bg.png +0 -0
- data/app/assets/images/adva_cms/admin/section_menu_bg.png +0 -0
- data/app/assets/images/adva_cms/admin/tab_action_active.png +0 -0
- data/app/assets/images/adva_cms/admin/tab_main_active.png +0 -0
- data/app/assets/images/adva_cms/admin/tab_sidebar_active.png +0 -0
- data/app/assets/images/adva_cms/admin/tab_top_active.png +0 -0
- data/app/assets/images/adva_cms/asset_selected.png +0 -0
- data/app/assets/images/adva_cms/avatar.gif +0 -0
- data/app/assets/images/adva_cms/filter-bg.png +0 -0
- data/app/assets/images/adva_cms/icons/accept.png +0 -0
- data/app/assets/images/adva_cms/icons/add.png +0 -0
- data/app/assets/images/adva_cms/icons/arrow_cross.png +0 -0
- data/app/assets/images/adva_cms/icons/arrow_cross_2.png +0 -0
- data/app/assets/images/adva_cms/icons/arrow_cross_3.png +0 -0
- data/app/assets/images/adva_cms/icons/arrow_up_down.png +0 -0
- data/app/assets/images/adva_cms/icons/assets/audio.png +0 -0
- data/app/assets/images/adva_cms/icons/assets/doc.png +0 -0
- data/app/assets/images/adva_cms/icons/assets/pdf.png +0 -0
- data/app/assets/images/adva_cms/icons/assets/video.png +0 -0
- data/app/assets/images/adva_cms/icons/attach.png +0 -0
- data/app/assets/images/adva_cms/icons/bin.png +0 -0
- data/app/assets/images/adva_cms/icons/bin_closed.png +0 -0
- data/app/assets/images/adva_cms/icons/bin_empty.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_black.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_delete.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_error.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_go.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_red.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_white.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_yellow.png +0 -0
- data/app/assets/images/adva_cms/icons/cancel.png +0 -0
- data/app/assets/images/adva_cms/icons/comment.gif +0 -0
- data/app/assets/images/adva_cms/icons/comment.png +0 -0
- data/app/assets/images/adva_cms/icons/comment_add.png +0 -0
- data/app/assets/images/adva_cms/icons/comment_blue.gif +0 -0
- data/app/assets/images/adva_cms/icons/comment_delete.png +0 -0
- data/app/assets/images/adva_cms/icons/comment_edit.png +0 -0
- data/app/assets/images/adva_cms/icons/comment_yellow.gif +0 -0
- data/app/assets/images/adva_cms/icons/cross.png +0 -0
- data/app/assets/images/adva_cms/icons/delete.png +0 -0
- data/app/assets/images/adva_cms/icons/eye.png +0 -0
- data/app/assets/images/adva_cms/icons/favorites.png +0 -0
- data/app/assets/images/adva_cms/icons/help.png +0 -0
- data/app/assets/images/adva_cms/icons/hourglass.png +0 -0
- data/app/assets/images/adva_cms/icons/icon_attachment.gif +0 -0
- data/app/assets/images/adva_cms/icons/icon_padlock.gif +0 -0
- data/app/assets/images/adva_cms/icons/link.png +0 -0
- data/app/assets/images/adva_cms/icons/lock.png +0 -0
- data/app/assets/images/adva_cms/icons/magnifier.png +0 -0
- data/app/assets/images/adva_cms/icons/minus.gif +0 -0
- data/app/assets/images/adva_cms/icons/page_add.png +0 -0
- data/app/assets/images/adva_cms/icons/page_delete.png +0 -0
- data/app/assets/images/adva_cms/icons/page_edit.png +0 -0
- data/app/assets/images/adva_cms/icons/page_favorites.png +0 -0
- data/app/assets/images/adva_cms/icons/page_go.png +0 -0
- data/app/assets/images/adva_cms/icons/page_green.png +0 -0
- data/app/assets/images/adva_cms/icons/page_red.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_add.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_delete.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_edit.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_go.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_link.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_magnify.png +0 -0
- data/app/assets/images/adva_cms/icons/pencil.png +0 -0
- data/app/assets/images/adva_cms/icons/star.png +0 -0
- data/app/assets/images/adva_cms/icons/stop.png +0 -0
- data/app/assets/images/adva_cms/icons/tag_green.png +0 -0
- data/app/assets/images/adva_cms/icons/tick.png +0 -0
- data/app/assets/images/adva_cms/icons/zoom.png +0 -0
- data/app/assets/images/adva_cms/indicator.gif +0 -0
- data/app/assets/images/adva_cms/preview.png +0 -0
- data/app/assets/images/adva_cms/rails.png +0 -0
- data/app/assets/images/adva_cms/sortable_tree/drag.png +0 -0
- data/app/assets/images/adva_cms/theme_selected.png +0 -0
- data/app/assets/javascripts/admin.js +1 -0
- data/app/assets/javascripts/adva_cms/admin/jquery.admin.js +23 -0
- data/app/assets/javascripts/adva_cms/admin/jquery.article.js +22 -0
- data/app/assets/javascripts/adva_cms/admin/jquery.cached_pages.js +14 -0
- data/app/assets/javascripts/adva_cms/admin/jquery.table_tree.js +7 -0
- data/app/assets/javascripts/adva_cms/application.js +14 -0
- data/app/assets/javascripts/adva_cms/base.js +4 -0
- data/app/assets/javascripts/adva_cms/cookie.js +49 -0
- data/app/assets/javascripts/adva_cms/jquery.common.js +41 -0
- data/app/assets/javascripts/adva_cms/jquery.dates.js +51 -0
- data/app/assets/javascripts/adva_cms/jquery.flash.js +57 -0
- data/app/assets/javascripts/adva_cms/jquery.roles.js +25 -0
- data/app/assets/javascripts/adva_cms/jquery/jquery-lowpro.js +224 -0
- data/app/assets/javascripts/adva_cms/jquery/jquery.qtip.js +2085 -0
- data/app/assets/javascripts/adva_cms/jquery/jquery.table_tree.js +307 -0
- data/app/assets/javascripts/adva_cms/jquery/jquery.tablednd_0_5.js +386 -0
- data/app/assets/javascripts/adva_cms/json.js +139 -0
- data/app/assets/stylesheets/admin.css +1 -0
- data/app/assets/stylesheets/adva_cms/admin.css +16 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/common.css +76 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/forms.css +121 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/header.css +125 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/layout.css +103 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/lists.css +153 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/sidebar.css +65 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/top.css +123 -0
- data/app/assets/stylesheets/adva_cms/admin/common.css +76 -0
- data/app/assets/stylesheets/adva_cms/admin/content.css +11 -0
- data/app/assets/stylesheets/adva_cms/admin/forms.css +116 -0
- data/app/assets/stylesheets/adva_cms/admin/header.css +114 -0
- data/app/assets/stylesheets/adva_cms/admin/helptip.css +35 -0
- data/app/assets/stylesheets/adva_cms/admin/layout.css +56 -0
- data/app/assets/stylesheets/adva_cms/admin/lists.css +152 -0
- data/app/assets/stylesheets/adva_cms/admin/projection.css +118 -0
- data/app/assets/stylesheets/adva_cms/admin/reset.css +25 -0
- data/app/assets/stylesheets/adva_cms/admin/screen/top.css +8 -0
- data/app/assets/stylesheets/adva_cms/admin/sidebar.css +67 -0
- data/app/assets/stylesheets/adva_cms/admin/themes.css +49 -0
- data/app/assets/stylesheets/adva_cms/admin/top.css +83 -0
- data/app/assets/stylesheets/adva_cms/admin/users.css +40 -0
- data/app/assets/stylesheets/adva_cms/common.css +49 -0
- data/app/assets/stylesheets/adva_cms/default.css +201 -0
- data/app/assets/stylesheets/adva_cms/forms.css +60 -0
- data/app/assets/stylesheets/adva_cms/jquery/alternate/jquery.tooltip.css +13 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_888888_256x240.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/jquery-ui.css +406 -0
- data/app/assets/stylesheets/adva_cms/jquery/jquery.tooltip.css +10 -0
- data/app/assets/stylesheets/adva_cms/layout/login.css +8 -0
- data/app/assets/stylesheets/adva_cms/layout/simple.css +8 -0
- data/app/assets/stylesheets/adva_cms/menu.css +129 -0
- data/app/assets/stylesheets/adva_cms/reset.css +25 -0
- data/app/controllers/admin/base_controller.rb +101 -0
- data/app/controllers/admin/categories_controller.rb +3 -0
- data/app/controllers/admin/install_controller.rb +61 -0
- data/app/controllers/admin/page/articles_controller.rb +150 -0
- data/app/controllers/admin/page/categories_controller.rb +62 -0
- data/app/controllers/admin/page/contents_controller.rb +52 -0
- data/app/controllers/admin/page/links_controller.rb +69 -0
- data/app/controllers/admin/pages_controller.rb +2 -0
- data/app/controllers/admin/plugins_controller.rb +40 -0
- data/app/controllers/admin/sections_controller.rb +91 -0
- data/app/controllers/admin/sites_controller.rb +99 -0
- data/app/controllers/articles_controller.rb +81 -0
- data/app/controllers/base_controller.rb +82 -0
- data/app/helpers/admin/base_helper.rb +106 -0
- data/app/helpers/base_helper.rb +56 -0
- data/app/helpers/content_helper.rb +90 -0
- data/app/helpers/resource_helper.rb +127 -0
- data/app/models/article.rb +40 -0
- data/app/models/categorization.rb +4 -0
- data/app/models/category.rb +60 -0
- data/app/models/content.rb +155 -0
- data/app/models/event.rb +34 -0
- data/app/models/link.rb +4 -0
- data/app/models/page.rb +36 -0
- data/app/models/section.rb +126 -0
- data/app/models/site.rb +104 -0
- data/app/views/admin/cached_pages/_filter.html.erb +8 -0
- data/app/views/admin/cached_pages/destroy.js.erb +18 -0
- data/app/views/admin/cached_pages/index.html.erb +26 -0
- data/app/views/admin/install/confirmation.html.erb +10 -0
- data/app/views/admin/install/index.html.erb +38 -0
- data/app/views/admin/page/articles/_form.html.erb +40 -0
- data/app/views/admin/page/articles/_options.html.erb +20 -0
- data/app/views/admin/page/articles/edit.html.erb +15 -0
- data/app/views/admin/page/articles/new.html.erb +12 -0
- data/app/views/admin/page/categories/edit.html.erb +22 -0
- data/app/views/admin/page/categories/index.html.erb +23 -0
- data/app/views/admin/page/categories/new.html.erb +19 -0
- data/app/views/admin/page/contents/index.html.erb +40 -0
- data/app/views/admin/page/links/_form.html.erb +26 -0
- data/app/views/admin/page/links/_options.html.erb +23 -0
- data/app/views/admin/page/links/edit.html.erb +12 -0
- data/app/views/admin/page/links/new.html.erb +12 -0
- data/app/views/admin/plugins/_form.html.erb +11 -0
- data/app/views/admin/plugins/index.html.erb +16 -0
- data/app/views/admin/plugins/show.html.erb +43 -0
- data/app/views/admin/sections/_form.html.haml +20 -0
- data/app/views/admin/sections/edit.html.haml +6 -0
- data/app/views/admin/sections/index.html.erb +27 -0
- data/app/views/admin/sections/new.html.erb +29 -0
- data/app/views/admin/sections/settings/_page.html.haml +10 -0
- data/app/views/admin/shared/_header.html.erb +18 -0
- data/app/views/admin/shared/_language_select.html.erb +6 -0
- data/app/views/admin/shared/_section.html.erb +8 -0
- data/app/views/admin/shared/_section_summary.html.erb +23 -0
- data/app/views/admin/shared/_section_tree.html.erb +23 -0
- data/app/views/admin/sites/_email_notifications.html.erb +9 -0
- data/app/views/admin/sites/_form.html.erb +15 -0
- data/app/views/admin/sites/_recent_users.html.erb +11 -0
- data/app/views/admin/sites/_sections.html.erb +10 -0
- data/app/views/admin/sites/_unapproved_comments.html.erb +10 -0
- data/app/views/admin/sites/edit.html.erb +4 -0
- data/app/views/admin/sites/index.html.erb +21 -0
- data/app/views/admin/sites/multi_sites_disabled.html.erb +11 -0
- data/app/views/admin/sites/new.html.erb +21 -0
- data/app/views/admin/sites/show.html.erb +16 -0
- data/app/views/categories/_checkboxes.html.erb +12 -0
- data/app/views/layouts/admin.html.haml +50 -0
- data/app/views/layouts/default.html.erb +38 -0
- data/app/views/layouts/simple.html.erb +22 -0
- data/app/views/pages/articles/index.html.erb +10 -0
- data/app/views/pages/articles/show.html.erb +17 -0
- data/app/views/shared/_flash.html.erb +3 -0
- data/app/views/shared/_footer.html.erb +4 -0
- data/app/views/shared/_menu.html.erb +10 -0
- data/app/views/shared/_sidebar.html.erb +19 -0
- data/app/views/shared/messages/insufficient_permissions.html.erb +4 -0
- data/config/environment.rb +21 -0
- data/config/initializers/has_options.rb +2 -0
- data/config/initializers/has_permalink.rb +27 -0
- data/config/initializers/mailer.rb +12 -0
- data/config/initializers/menus.rb +184 -0
- data/config/initializers/roles.rb +91 -0
- data/config/initializers/settings.rb +26 -0
- data/config/initializers/site.rb +5 -0
- data/config/initializers/translations_are_a_pain.rb +9 -0
- data/config/locales/en.yml +1295 -0
- data/config/routes.rb +47 -0
- data/db/migrate/20080401000001_create_sites_table.rb +28 -0
- data/db/migrate/20080401000002_create_sections_table.rb +25 -0
- data/db/migrate/20080401000003_create_contents_table.rb +35 -0
- data/db/migrate/20080401000004_create_categories_table.rb +17 -0
- data/db/migrate/20080401000005_create_category_assignments.rb +12 -0
- data/db/migrate/20080401000006_create_taggable_tables.rb +26 -0
- data/db/migrate/20080710000000_create_plugin_configs.rb +13 -0
- data/db/migrate/20080715131051_plugin_owner_column.rb +13 -0
- data/db/migrate/20081208161500_add_content_type_to_join_tables.rb +10 -0
- data/db/migrate/20090216114034_rename_category_assignment_to_categorization.rb +13 -0
- data/db/migrate/20090305123429_move_sections_to_pages.rb +9 -0
- data/db/migrate/20090519132700_add_published_at_to_sections.rb +10 -0
- data/db/migrate/20090702085459_create_section_translations.rb +9 -0
- data/db/migrate/20090702200226_create_category_translations.rb +9 -0
- data/db/migrate/20090707171100_upgrade_paperclip_paths.rb +31 -0
- data/db/migrate/20090709111934_add_email_notification_to_site.rb +12 -0
- data/db/migrate/20091026000906_add_nesting_to_articles.rb +26 -0
- data/db/migrate/20140721000000_add_title_to_contents.rb +7 -0
- data/lib/adva_cms.rb +50 -0
- data/lib/adva_cms/version.rb +3 -0
- data/lib/core_ext.rb +7 -0
- data/lib/extensible_forms.rb +283 -0
- data/lib/has_options.rb +46 -0
- data/lib/html_diff.rb +48 -0
- data/lib/rails_ext.rb +15 -0
- data/lib/rails_ext/action_controller/cacheable_flash.rb +30 -0
- data/lib/rails_ext/action_controller/content_for_assignments.rb +105 -0
- data/lib/rails_ext/action_controller/default_params.rb +19 -0
- data/lib/rails_ext/action_controller/event_helper.rb +18 -0
- data/lib/rails_ext/action_controller/page_caching.rb +23 -0
- data/lib/rails_ext/action_controller/render_with_error_proc.rb +46 -0
- data/lib/rails_ext/action_controller/responds_to_parent.rb +46 -0
- data/lib/rails_ext/action_controller/url_for_returning.rb +12 -0
- data/lib/rails_ext/active_record/exists.rb +5 -0
- data/lib/rails_ext/active_record/sti_instantiation.rb +35 -0
- data/lib/rails_ext/active_record/sticky_changes.rb +30 -0
- data/lib/rails_ext/railties/plugin.rb +58 -0
- data/lib/rails_ext/railties/plugin_configuration.rb +72 -0
- data/lib/rails_ext/railties/plugin_initializers.rb +25 -0
- data/lib/registry.rb +49 -0
- data/lib/tasks/adva_cms.rake +178 -0
- data/lib/tasks/translation.rake +69 -0
- data/lib/time_hacks.rb +57 -0
- data/lib/webrat_patch.rb +11 -0
- data/locale/rails/fr.yml +123 -0
- data/test/NOTES +56 -0
- data/test/contexts.rb +365 -0
- data/test/fixtures.rb +190 -0
- data/test/fixtures/templates/alternative_templates/index.html.erb +1 -0
- data/test/fixtures/templates/context_templates_test/index.html.erb +1 -0
- data/test/fixtures/templates/context_templates_test/show.html.erb +0 -0
- data/test/fixtures/templates/layouts/alternative.html.erb +0 -0
- data/test/fixtures/templates/layouts/default.html.erb +0 -0
- data/test/fixtures/templates/menu/shared/_menu.html.erb +8 -0
- data/test/functional/admin/articles_controller_test.rb +329 -0
- data/test/functional/admin/base_controller_test.rb +68 -0
- data/test/functional/admin/cached_pages_controller_test.rb +66 -0
- data/test/functional/admin/categories_controller_test.rb +164 -0
- data/test/functional/admin/cells_controller_spec.rb +32 -0
- data/test/functional/admin/install_controller_test.rb +89 -0
- data/test/functional/admin/plugins_controller_test.rb +93 -0
- data/test/functional/admin/sections_controller_test.rb +201 -0
- data/test/functional/admin/sites_controller_test.rb +240 -0
- data/test/functional/asset_tag_expansions_test.rb +82 -0
- data/test/functional/base_controller_test.rb +73 -0
- data/test/functional/page_articles_controller_test.rb +168 -0
- data/test/functional/page_articles_routes_test.rb +73 -0
- data/test/integration/admin/cached_pages_test.rb +43 -0
- data/test/integration/admin/categories_test.rb +66 -0
- data/test/integration/admin/custom_templates_test.rb +42 -0
- data/test/integration/admin/filtering_articles_test.rb +32 -0
- data/test/integration/admin/plugins.rb +32 -0
- data/test/integration/admin/section_article_test.rb +150 -0
- data/test/integration/admin/section_test.rb +88 -0
- data/test/integration/admin/sites_test.rb +48 -0
- data/test/integration/installation_test.rb +109 -0
- data/test/integration/page_article_comment_test.rb +51 -0
- data/test/integration/page_article_test.rb +87 -0
- data/test/integration/section_index_test.rb +37 -0
- data/test/javascript/assets/jquery-lowpro.js +224 -0
- data/test/javascript/assets/jquery-ui.js +298 -0
- data/test/javascript/assets/jquery.js +4376 -0
- data/test/javascript/assets/testrunner.js +815 -0
- data/test/javascript/assets/testsuite.css +120 -0
- data/test/javascript/lib/jstest.rb +588 -0
- data/test/javascript/templates/test_case.erb +33 -0
- data/test/plugins/adva_context_templates/context_templates_test.rb +138 -0
- data/test/plugins/adva_post_ping/controller/integration_test.rb +78 -0
- data/test/plugins/adva_post_ping/post_ping_test.rb +94 -0
- data/test/plugins/adva_url_history/article_test.rb +94 -0
- data/test/plugins/adva_url_history/init_url_history.rb +18 -0
- data/test/plugins/adva_url_history/section_test.rb +49 -0
- data/test/test_helper.rb +75 -0
- data/test/test_helper/clear_directories.rb +16 -0
- data/test/test_helper/ensure_single_site_mode.rb +10 -0
- data/test/test_helper/extensions/cacheable_flash.rb +14 -0
- data/test/test_helper/extensions/cronjob.rb +11 -0
- data/test/test_helper/extensions/even_test_log.rb +21 -0
- data/test/test_helper/extensions/integration_test.rb +78 -0
- data/test/test_helper/extensions/matchy.rb +365 -0
- data/test/test_helper/extensions/matchy_adva_cms.rb +441 -0
- data/test/test_helper/extensions/rails_patch.rb +40 -0
- data/test/test_helper/extensions/rr.rb +7 -0
- data/test/test_helper/extensions/test_unit.rb +35 -0
- data/test/test_helper/extensions/with_sugar.rb +166 -0
- data/test/test_helper/parse_options.rb +18 -0
- data/test/test_helper/setup_db_transaction.rb +15 -0
- data/test/test_helper/setup_webrat.rb +9 -0
- data/test/test_helper/test_server/init.rb +15 -0
- data/test/unit/helpers/admin/base_helper_test.rb +139 -0
- data/test/unit/helpers/base_helper_spec.rb +54 -0
- data/test/unit/helpers/base_helper_test.rb +165 -0
- data/test/unit/helpers/content_helper_test.rb +127 -0
- data/test/unit/helpers/resource_helper_test.rb +180 -0
- data/test/unit/i18n_test.rb +22 -0
- data/test/unit/lib/cells_ext_spec.rb +96 -0
- data/test/unit/lib/extensible_forms_test.rb +362 -0
- data/test/unit/lib/menu_test.rb +119 -0
- data/test/unit/lib/rails_ext/content_for_assignments_test.rb +75 -0
- data/test/unit/lib/rails_ext/plugin_configuration_test.rb +40 -0
- data/test/unit/lib/rails_ext/sticky_changes_test.rb +33 -0
- data/test/unit/lib/registry_test.rb +91 -0
- data/test/unit/lib/routing_filter/routing_filter_categories_spec.rb +63 -0
- data/test/unit/lib/routing_filter/routing_filter_categories_test.rb +159 -0
- data/test/unit/lib/routing_filter/routing_filter_locale_spec.rb +73 -0
- data/test/unit/lib/routing_filter/routing_filter_root_blog_archive_spec.rb +40 -0
- data/test/unit/lib/routing_filter/routing_filter_root_section_articles_spec.rb +48 -0
- data/test/unit/lib/routing_filter/routing_filter_root_wikipages_spec.rb +40 -0
- data/test/unit/lib/routing_filter/routing_filter_sections_spec.rb +143 -0
- data/test/unit/lib/routing_filter/routing_filter_sections_test.rb +32 -0
- data/test/unit/lib/routing_filter/routing_filter_sets_test.rb +86 -0
- data/test/unit/models/article_test.rb +191 -0
- data/test/unit/models/category_test.rb +68 -0
- data/test/unit/models/content_test.rb +409 -0
- data/test/unit/models/counter_test.rb +43 -0
- data/test/unit/models/event_test.rb +41 -0
- data/test/unit/models/nested_categories_test.rb +34 -0
- data/test/unit/models/page_test.rb +63 -0
- data/test/unit/models/section_test.rb +315 -0
- data/test/unit/models/site_test.rb +199 -0
- data/test/unit/observers/activities_article_observer_test.rb +42 -0
- data/vendor/gems/belongs_to_cacheable/.gitignore +17 -0
- data/vendor/gems/belongs_to_cacheable/Gemfile +4 -0
- data/vendor/gems/belongs_to_cacheable/LICENSE +22 -0
- data/vendor/gems/belongs_to_cacheable/README.md +29 -0
- data/vendor/gems/belongs_to_cacheable/Rakefile +2 -0
- data/vendor/gems/belongs_to_cacheable/belongs_to_cacheable.gemspec +22 -0
- data/vendor/gems/belongs_to_cacheable/init.rb +1 -0
- data/vendor/gems/belongs_to_cacheable/lib/active_record/belongs_to_cacheable.rb +77 -0
- data/vendor/gems/belongs_to_cacheable/lib/belongs_to_cacheable.rb +3 -0
- data/vendor/gems/belongs_to_cacheable/lib/belongs_to_cacheable/version.rb +3 -0
- data/vendor/gems/belongs_to_cacheable/spec/belongs_to_cacheable_spec.rb +52 -0
- data/vendor/gems/belongs_to_cacheable/spec/spec_helper.rb +50 -0
- data/vendor/gems/filtered_column/.gitignore +17 -0
- data/vendor/gems/filtered_column/Gemfile +4 -0
- data/vendor/gems/filtered_column/LICENSE +22 -0
- data/vendor/gems/filtered_column/README +4 -0
- data/vendor/gems/filtered_column/README.md +29 -0
- data/vendor/gems/filtered_column/Rakefile +23 -0
- data/vendor/gems/filtered_column/filtered_column.gemspec +17 -0
- data/vendor/gems/filtered_column/lib/filtered_column.rb +17 -0
- data/vendor/gems/filtered_column/lib/filtered_column/filters/base.rb +28 -0
- data/vendor/gems/filtered_column/lib/filtered_column/filters/smartypants_filter.rb +14 -0
- data/vendor/gems/filtered_column/lib/filtered_column/filters/textile_filter.rb +13 -0
- data/vendor/gems/filtered_column/lib/filtered_column/macros/base.rb +25 -0
- data/vendor/gems/filtered_column/lib/filtered_column/mixin.rb +46 -0
- data/vendor/gems/filtered_column/lib/filtered_column/processor.rb +52 -0
- data/vendor/gems/filtered_column/lib/filtered_column/version.rb +3 -0
- data/vendor/gems/filtered_column/tasks/filtered_column_tasks.rake +4 -0
- data/vendor/gems/filtered_column/test/abstract_unit.rb +73 -0
- data/vendor/gems/filtered_column/test/filtered_column_test.rb +53 -0
- data/vendor/gems/filtered_column/test/macro_filter_test.rb +23 -0
- data/vendor/gems/has_counter/.gitignore +17 -0
- data/vendor/gems/has_counter/Gemfile +4 -0
- data/vendor/gems/has_counter/LICENSE +22 -0
- data/vendor/gems/has_counter/MIT-LICENSE +20 -0
- data/vendor/gems/has_counter/README.markdown +64 -0
- data/vendor/gems/has_counter/README.md +29 -0
- data/vendor/gems/has_counter/Rakefile +2 -0
- data/vendor/gems/has_counter/db/migrate/20080601194338_create_counters_table.rb.rb +13 -0
- data/vendor/gems/has_counter/has_counter.gemspec +17 -0
- data/vendor/gems/has_counter/lib/active_record/has_counter.rb +64 -0
- data/vendor/gems/has_counter/lib/counter.rb +23 -0
- data/vendor/gems/has_counter/lib/has_counter.rb +4 -0
- data/vendor/gems/has_counter/lib/has_counter/version.rb +3 -0
- data/vendor/gems/has_counter/spec/has_counter.spec.log +0 -0
- data/vendor/gems/has_counter/spec/has_counter.sqlite3.db +0 -0
- data/vendor/gems/has_counter/spec/has_counter_spec.rb +55 -0
- data/vendor/gems/has_counter/spec/spec_helper.rb +117 -0
- data/vendor/gems/has_filter/.gitignore +17 -0
- data/vendor/gems/has_filter/Gemfile +4 -0
- data/vendor/gems/has_filter/LICENSE +22 -0
- data/vendor/gems/has_filter/README.md +29 -0
- data/vendor/gems/has_filter/Rakefile +2 -0
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_add.png +0 -0
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_button_left.png +0 -0
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_button_right.png +0 -0
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_remove.png +0 -0
- data/vendor/gems/has_filter/app/assets/javascripts/has_filter/filter.js +35 -0
- data/vendor/gems/has_filter/app/assets/javascripts/has_filter/jquery.filter.js +23 -0
- data/vendor/gems/has_filter/app/assets/stylesheets/has_filter/alternate/filter.css +102 -0
- data/vendor/gems/has_filter/app/assets/stylesheets/has_filter/filter.css +100 -0
- data/vendor/gems/has_filter/app/helpers/filter_helper.rb +3 -0
- data/vendor/gems/has_filter/has_filter.gemspec +17 -0
- data/vendor/gems/has_filter/init.rb +3 -0
- data/vendor/gems/has_filter/lib/has_filter.rb +22 -0
- data/vendor/gems/has_filter/lib/has_filter/active_record/act_macro.rb +102 -0
- data/vendor/gems/has_filter/lib/has_filter/filter.rb +17 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/base.rb +67 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/categorized.rb +24 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/chain.rb +45 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/set.rb +80 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/state.rb +25 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/tagged.rb +22 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/text.rb +55 -0
- data/vendor/gems/has_filter/lib/has_filter/version.rb +3 -0
- data/vendor/gems/has_filter/test/db/setup.rb +45 -0
- data/vendor/gems/has_filter/test/db/test.sqlite3.db +0 -0
- data/vendor/gems/has_filter/test/fixtures.rb +15 -0
- data/vendor/gems/has_filter/test/has_filter/filter_chain_test.rb +41 -0
- data/vendor/gems/has_filter/test/has_filter/filter_scopes_test.rb +102 -0
- data/vendor/gems/has_filter/test/has_filter/filter_tags_test.rb +113 -0
- data/vendor/gems/has_filter/test/has_filter/integration.rb +15 -0
- data/vendor/gems/has_filter/test/has_filter/scopes_test.rb +48 -0
- data/vendor/gems/has_filter/test/log/test.log +34346 -0
- data/vendor/gems/has_filter/test/models.rb +23 -0
- data/vendor/gems/has_filter/test/templates/has_filter/test/index.html.erb +5 -0
- data/vendor/gems/has_filter/test/test_helper.rb +66 -0
- data/vendor/gems/simple_taggable/.gitignore +17 -0
- data/vendor/gems/simple_taggable/Gemfile +4 -0
- data/vendor/gems/simple_taggable/LICENSE +22 -0
- data/vendor/gems/simple_taggable/README +24 -0
- data/vendor/gems/simple_taggable/README.md +29 -0
- data/vendor/gems/simple_taggable/Rakefile +2 -0
- data/vendor/gems/simple_taggable/lib/simple_taggable.rb +153 -0
- data/vendor/gems/simple_taggable/lib/simple_taggable/version.rb +3 -0
- data/vendor/gems/simple_taggable/lib/tag.rb +31 -0
- data/vendor/gems/simple_taggable/lib/tag_list.rb +90 -0
- data/vendor/gems/simple_taggable/lib/tagging.rb +8 -0
- data/vendor/gems/simple_taggable/simple_taggable.gemspec +17 -0
- data/vendor/gems/simple_taggable/test/db/schema.rb +41 -0
- data/vendor/gems/simple_taggable/test/db/simple_taggable.sqlite3.db +0 -0
- data/vendor/gems/simple_taggable/test/fixtures/magazine.rb +3 -0
- data/vendor/gems/simple_taggable/test/fixtures/magazines.yml +2 -0
- data/vendor/gems/simple_taggable/test/fixtures/photo.rb +8 -0
- data/vendor/gems/simple_taggable/test/fixtures/photos.yml +19 -0
- data/vendor/gems/simple_taggable/test/fixtures/post.rb +5 -0
- data/vendor/gems/simple_taggable/test/fixtures/posts.yml +27 -0
- data/vendor/gems/simple_taggable/test/fixtures/subscription.rb +4 -0
- data/vendor/gems/simple_taggable/test/fixtures/subscriptions.yml +3 -0
- data/vendor/gems/simple_taggable/test/fixtures/taggings.yml +112 -0
- data/vendor/gems/simple_taggable/test/fixtures/tags.yml +14 -0
- data/vendor/gems/simple_taggable/test/fixtures/user.rb +6 -0
- data/vendor/gems/simple_taggable/test/fixtures/users.yml +5 -0
- data/vendor/gems/simple_taggable/test/log/simple_taggable.log +1614 -0
- data/vendor/gems/simple_taggable/test/simple_taggable_test.rb +226 -0
- data/vendor/gems/simple_taggable/test/tag_list_test.rb +105 -0
- data/vendor/gems/simple_taggable/test/test_helper.rb +80 -0
- data/vendor/gems/table_builder/.gitignore +17 -0
- data/vendor/gems/table_builder/Gemfile +4 -0
- data/vendor/gems/table_builder/LICENSE +22 -0
- data/vendor/gems/table_builder/README.md +29 -0
- data/vendor/gems/table_builder/Rakefile +2 -0
- data/vendor/gems/table_builder/lib/table_builder.rb +27 -0
- data/vendor/gems/table_builder/lib/table_builder/body.rb +28 -0
- data/vendor/gems/table_builder/lib/table_builder/cell.rb +21 -0
- data/vendor/gems/table_builder/lib/table_builder/column.rb +26 -0
- data/vendor/gems/table_builder/lib/table_builder/foot.rb +6 -0
- data/vendor/gems/table_builder/lib/table_builder/head.rb +16 -0
- data/vendor/gems/table_builder/lib/table_builder/row.rb +40 -0
- data/vendor/gems/table_builder/lib/table_builder/rows.rb +26 -0
- data/vendor/gems/table_builder/lib/table_builder/table.rb +75 -0
- data/vendor/gems/table_builder/lib/table_builder/tag.rb +58 -0
- data/vendor/gems/table_builder/lib/table_builder/version.rb +3 -0
- data/vendor/gems/table_builder/table_builder.gemspec +17 -0
- data/vendor/gems/table_builder/test/fixtures/templates/table_all.html.erb +20 -0
- data/vendor/gems/table_builder/test/fixtures/templates/table_auto_body.html.erb +3 -0
- data/vendor/gems/table_builder/test/fixtures/templates/table_auto_columns.html.erb +1 -0
- data/vendor/gems/table_builder/test/fixtures/templates/table_simple.html.erb +7 -0
- data/vendor/gems/table_builder/test/table_builder/table_test.rb +230 -0
- data/vendor/gems/table_builder/test/test_helper.rb +49 -0
- data/vendor/gems/tags/.gitignore +17 -0
- data/vendor/gems/tags/Gemfile +4 -0
- data/vendor/gems/tags/LICENSE +22 -0
- data/vendor/gems/tags/README.md +29 -0
- data/vendor/gems/tags/Rakefile +2 -0
- data/vendor/gems/tags/lib/breadcrumbs.rb +13 -0
- data/vendor/gems/tags/lib/menu.rb +179 -0
- data/vendor/gems/tags/lib/menu/builder.rb +74 -0
- data/vendor/gems/tags/lib/tags.rb +7 -0
- data/vendor/gems/tags/lib/tags/tag.rb +125 -0
- data/vendor/gems/tags/lib/tags/version.rb +3 -0
- data/vendor/gems/tags/tags.gemspec +17 -0
- data/vendor/gems/tags/test/tags/menu_test.rb +173 -0
- data/vendor/gems/tags/test/tags/tag_test.rb +13 -0
- data/vendor/gems/tags/test/test_helper.rb +18 -0
- data/vendor/gems/xss_terminate/.gitignore +17 -0
- data/vendor/gems/xss_terminate/Gemfile +4 -0
- data/vendor/gems/xss_terminate/LICENSE +22 -0
- data/vendor/gems/xss_terminate/MIT-LICENSE +20 -0
- data/vendor/gems/xss_terminate/README +94 -0
- data/vendor/gems/xss_terminate/README.md +29 -0
- data/vendor/gems/xss_terminate/Rakefile +23 -0
- data/vendor/gems/xss_terminate/lib/html5lib_sanitize.rb +2453 -0
- data/vendor/gems/xss_terminate/lib/rails_sanitize.rb +8 -0
- data/vendor/gems/xss_terminate/lib/xss_terminate.rb +141 -0
- data/vendor/gems/xss_terminate/lib/xss_terminate/version.rb +3 -0
- data/vendor/gems/xss_terminate/tasks/xss_terminate_tasks.rake +7 -0
- data/vendor/gems/xss_terminate/test/models/comment.rb +5 -0
- data/vendor/gems/xss_terminate/test/models/entry.rb +7 -0
- data/vendor/gems/xss_terminate/test/models/message.rb +3 -0
- data/vendor/gems/xss_terminate/test/models/person.rb +5 -0
- data/vendor/gems/xss_terminate/test/models/review.rb +5 -0
- data/vendor/gems/xss_terminate/test/schema.rb +34 -0
- data/vendor/gems/xss_terminate/test/setup_test.rb +16 -0
- data/vendor/gems/xss_terminate/test/xss_terminate_test.rb +50 -0
- data/vendor/gems/xss_terminate/xss_terminate.gemspec +17 -0
- metadata +744 -0
data/test/contexts.rb
ADDED
@@ -0,0 +1,365 @@
|
|
1
|
+
class Test::Unit::TestCase
|
2
|
+
def publish(article)
|
3
|
+
article.update_attributes!(:published_at => Time.parse('2008-01-01 12:00:00')) unless article.published?
|
4
|
+
end
|
5
|
+
|
6
|
+
def unpublish(article)
|
7
|
+
article.update_attributes!(:published_at => nil) if article.published?
|
8
|
+
end
|
9
|
+
|
10
|
+
def set_request_host!
|
11
|
+
@request.host = @site.host if @request && @site
|
12
|
+
end
|
13
|
+
|
14
|
+
def default_routing_filters
|
15
|
+
%w(locale categories sets section_root section_paths pagination).inject(RoutingFilter::Chain.new) do |filters, name|
|
16
|
+
klass = RoutingFilter.const_get(name.camelize)
|
17
|
+
filters << klass.new({})
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
share :default_routing_filters do
|
22
|
+
before do
|
23
|
+
names = RoutingFilter.constants - %w(Chain Base)
|
24
|
+
klasses = names.map { |name| RoutingFilter.const_get(name) }
|
25
|
+
@current_states = klasses.inject({}) { |states, klass| states[klass] = klass.active; states }
|
26
|
+
|
27
|
+
default_filters = %w(Locale Categories Sets SectionRoot SectionPaths Pagination)
|
28
|
+
klasses.each { |klass| klass.active = default_filters.include?(klass.name.gsub('RoutingFilter::', '')) }
|
29
|
+
end
|
30
|
+
|
31
|
+
after do
|
32
|
+
@current_states.each { |klass, state| klass.active = state }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
share :is_default_locale do
|
37
|
+
before { I18n.default_locale = I18n.locale }
|
38
|
+
end
|
39
|
+
|
40
|
+
share :rescue_action_in_public do
|
41
|
+
before { rescue_action_in_public! }
|
42
|
+
end
|
43
|
+
|
44
|
+
share_condition :default_theme do
|
45
|
+
assigns(:site).themes.active.empty?
|
46
|
+
end
|
47
|
+
|
48
|
+
# FIXME abstract these
|
49
|
+
share :multi_sites_enabled do
|
50
|
+
before do
|
51
|
+
@old_multi_sites_enabled = Site.multi_sites_enabled
|
52
|
+
Site.multi_sites_enabled = true
|
53
|
+
end
|
54
|
+
after do
|
55
|
+
Site.multi_sites_enabled = @old_multi_sites_enabled
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
share :single_site_enabled do
|
60
|
+
before do
|
61
|
+
@old_multi_sites_enabled = Site.multi_sites_enabled
|
62
|
+
Site.multi_sites_enabled = false
|
63
|
+
end
|
64
|
+
after do
|
65
|
+
Site.multi_sites_enabled = @old_multi_sites_enabled
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
share :perform_caching_enabled do
|
70
|
+
before do
|
71
|
+
@old_perform_caching_enabled = ActionController::Base.perform_caching
|
72
|
+
ActionController::Base.perform_caching = true
|
73
|
+
end
|
74
|
+
after do
|
75
|
+
ActionController::Base.perform_caching = @old_perform_caching_enabled
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
share :perform_caching_disabled do
|
80
|
+
before do
|
81
|
+
@old_perform_caching_enabled = ActionController::Base.perform_caching
|
82
|
+
ActionController::Base.perform_caching = false
|
83
|
+
end
|
84
|
+
after do
|
85
|
+
ActionController::Base.perform_caching = @old_perform_caching_enabled
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
share :access_granted do
|
90
|
+
before do
|
91
|
+
stub(@controller).require_authentication
|
92
|
+
stub(@controller).guard_permission
|
93
|
+
stub(@controller).has_permission? { true }
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
[:superuser, :admin, :moderator, :user, :anonymous].each do |role|
|
98
|
+
share :"is_#{role}" do
|
99
|
+
before("log in as #{role}") do
|
100
|
+
article = role.to_s[0, 1].downcase == 'a' ? 'an' : 'a'
|
101
|
+
name = "#{article} #{role}"
|
102
|
+
@user = User.find_by_first_name(name) or raise "could not find user named \"#{name}\""
|
103
|
+
login @user
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
share :no_user do
|
109
|
+
before do
|
110
|
+
User.delete_all
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
share :no_site do
|
115
|
+
before do
|
116
|
+
Site.delete_all
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
share :a_site do
|
121
|
+
before do
|
122
|
+
@site = Site.find_by_host 'site-with-pages.com'
|
123
|
+
set_request_host!
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
share :a_page do
|
128
|
+
before do
|
129
|
+
@section = Section.find_by_permalink 'a-page'
|
130
|
+
@site = @section.site
|
131
|
+
set_request_host!
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
share :an_unpublished_section do
|
136
|
+
before do
|
137
|
+
@section = Section.find_by_permalink('an-unpublished-section')
|
138
|
+
@site = @section.site
|
139
|
+
set_request_host!
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
share :is_root_section do
|
144
|
+
before do
|
145
|
+
@section.reload.move_to_left_of(@section.site.sections.root) unless @section.root_section?
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
share :comments_or_commenting_allowed do
|
150
|
+
before do
|
151
|
+
# no comments present but commenting is still allowed
|
152
|
+
@site.comments.clear
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
share :comments_or_commenting_allowed do
|
157
|
+
before do
|
158
|
+
# commenting disallowed, but comments still present
|
159
|
+
target = @articles || @article || @section
|
160
|
+
Array(target).each { |t| t.update_attributes! :comment_age => -1 unless @article.comment_age == -1 }
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
share :no_comments_and_commenting_not_allowed do
|
165
|
+
before do
|
166
|
+
@site.comments.clear
|
167
|
+
target = @articles || @article || @section
|
168
|
+
Array(target).each { |t| t.update_attributes! :comment_age => -1 unless @article.comment_age == -1 }
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
share :a_category do
|
173
|
+
before do
|
174
|
+
@category = @section.categories.first
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# share :a_content do
|
179
|
+
# before do
|
180
|
+
# @content = @section.articles.first
|
181
|
+
# end
|
182
|
+
# end
|
183
|
+
|
184
|
+
share :an_article do
|
185
|
+
before do
|
186
|
+
@article = @section.articles.first
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
share :a_published_article do
|
191
|
+
before do
|
192
|
+
@article = @section.articles.first # .find_by_title 'a page article'
|
193
|
+
publish @article
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
share :a_published_photo do
|
198
|
+
before do
|
199
|
+
@photo = @album.photos.first
|
200
|
+
publish @photo
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
share :an_unpublished_article do
|
205
|
+
before do
|
206
|
+
@article = @section.articles.first
|
207
|
+
unpublish @article
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
share :an_unpublished_photo do
|
212
|
+
before do
|
213
|
+
@photo = @album.photos.first
|
214
|
+
unpublish @photo
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
share :the_article_is_published do
|
219
|
+
before do
|
220
|
+
publish @article
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
share :the_article_is_not_published do
|
225
|
+
before do
|
226
|
+
unpublish @article
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
share :the_article_belongs_to_the_category do
|
231
|
+
# nothing to do
|
232
|
+
end
|
233
|
+
|
234
|
+
share :the_article_does_not_belong_to_the_category do
|
235
|
+
before do
|
236
|
+
@article.categories.clear if @article.categories.present?
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
share :article_has_an_excerpt do
|
241
|
+
before { @article.update_attributes! :excerpt => 'the article excerpt' }
|
242
|
+
end
|
243
|
+
|
244
|
+
share :article_has_no_excerpt do
|
245
|
+
# nothing to do
|
246
|
+
end
|
247
|
+
|
248
|
+
share :a_cached_page do
|
249
|
+
before do
|
250
|
+
@cached_page = CachedPage.first
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
share :a_plugin do
|
255
|
+
before do
|
256
|
+
@plugin = @site.plugins[:test_plugin].clone
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
|
261
|
+
def valid_site_params
|
262
|
+
{ :site => { :name => 'site name', :host => 'valid-host.com' },
|
263
|
+
:section => { :type => 'Page', :title => 'page title' } }
|
264
|
+
end
|
265
|
+
|
266
|
+
def valid_install_params
|
267
|
+
valid_site_params.merge :user => { :email => 'admin@admin.org', :password => 'password' }
|
268
|
+
end
|
269
|
+
|
270
|
+
def valid_page_params
|
271
|
+
{ :title => 'the page title',
|
272
|
+
:type => 'Page' }
|
273
|
+
end
|
274
|
+
|
275
|
+
def valid_article_params(user = nil)
|
276
|
+
user ||= @user
|
277
|
+
{ :title => 'an article',
|
278
|
+
:body => 'an article body',
|
279
|
+
:author_id => user.id }
|
280
|
+
end
|
281
|
+
|
282
|
+
def valid_category_params
|
283
|
+
{ :title => 'the category title',
|
284
|
+
:permalink => 'the-category-title' }
|
285
|
+
end
|
286
|
+
|
287
|
+
share :valid_site_params do
|
288
|
+
before do
|
289
|
+
@params = valid_site_params
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
share :invalid_site_params do
|
294
|
+
before do
|
295
|
+
@params = valid_site_params
|
296
|
+
@params[:site][:name] = ''
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
share :valid_page_params do
|
301
|
+
before do
|
302
|
+
@params = { :section => valid_page_params }
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
share :invalid_page_params do
|
307
|
+
before do
|
308
|
+
@params = { :section => valid_page_params.update(:title => '') }
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
share :valid_install_params do
|
313
|
+
before do
|
314
|
+
@params = valid_install_params
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
share :invalid_install_params do
|
319
|
+
before do
|
320
|
+
@params = valid_install_params
|
321
|
+
@params[:site][:name] = ''
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
share :valid_article_params do
|
326
|
+
before do
|
327
|
+
@params = { :article => valid_article_params }
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
[:title, :body].each do |attribute|
|
332
|
+
share :invalid_article_params do
|
333
|
+
before do
|
334
|
+
@params = { :article => valid_article_params.update(attribute => '') }
|
335
|
+
end
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
share :valid_category_params do
|
340
|
+
before do
|
341
|
+
@params = { :category => valid_category_params }
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
share :invalid_category_params do
|
346
|
+
before do
|
347
|
+
@params = { :category => valid_category_params.update(:title => '') }
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
share :save_revision_param do
|
352
|
+
before { @params.merge! :save_revision => '1' }
|
353
|
+
end
|
354
|
+
|
355
|
+
share :no_save_revision_param do
|
356
|
+
before { @params = @params.except(:save_revision) }
|
357
|
+
end
|
358
|
+
|
359
|
+
share :fixed_time do
|
360
|
+
before do
|
361
|
+
Time.stubs(:now).returns Time.utc(2009,2,3, 15,00,00)
|
362
|
+
Date.stubs(:today).returns Date.civil(2009,2,3)
|
363
|
+
end
|
364
|
+
end
|
365
|
+
end
|
data/test/fixtures.rb
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
# empty the database
|
2
|
+
ActiveRecord::Base.connection.tables.each do |table_name|
|
3
|
+
ActiveRecord::Base.connection.execute "DELETE FROM #{table_name}" unless table_name == 'schema_migrations'
|
4
|
+
end
|
5
|
+
|
6
|
+
# USERS
|
7
|
+
|
8
|
+
anonymous = User.create! :first_name => 'an anonymous',
|
9
|
+
:email => 'an-anonymous@example.com',
|
10
|
+
:password => 'a password',
|
11
|
+
:verified_at => Time.now,
|
12
|
+
:anonymous => true
|
13
|
+
|
14
|
+
user = User.create! :first_name => 'a user',
|
15
|
+
:email => 'a-user@example.com',
|
16
|
+
:password => 'a password',
|
17
|
+
:verified_at => Time.now
|
18
|
+
|
19
|
+
superuser = User.create! :first_name => 'a superuser',
|
20
|
+
:email => 'a-superuser@example.com',
|
21
|
+
:password => 'a password',
|
22
|
+
:verified_at => Time.now
|
23
|
+
|
24
|
+
admin = User.create! :first_name => 'an admin',
|
25
|
+
:email => 'an-admin@example.com',
|
26
|
+
:password => 'a password',
|
27
|
+
:verified_at => Time.now
|
28
|
+
|
29
|
+
moderator = User.create! :first_name => 'a moderator',
|
30
|
+
:email => 'a-moderator@example.com',
|
31
|
+
:password => 'a password',
|
32
|
+
:verified_at => Time.now
|
33
|
+
|
34
|
+
User.create! :first_name => 'an unverified user',
|
35
|
+
:email => 'a-unverified-user@example.com',
|
36
|
+
:password => 'a password'
|
37
|
+
|
38
|
+
designer = User.create! :first_name => 'a designer',
|
39
|
+
:email => 'a-designer@example.com',
|
40
|
+
:password => 'a password'
|
41
|
+
|
42
|
+
another_author = User.create! :first_name => 'a author',
|
43
|
+
:email => 'a-author@example.com',
|
44
|
+
:password => 'a password',
|
45
|
+
:verified_at => Time.now
|
46
|
+
|
47
|
+
another_moderator = User.create! :first_name => 'another moderator',
|
48
|
+
:email => 'another_moderator@example.com',
|
49
|
+
:password => 'a password',
|
50
|
+
:verified_at => Time.now
|
51
|
+
|
52
|
+
# SITES
|
53
|
+
|
54
|
+
site = Site.create! :name => 'site with pages',
|
55
|
+
:title => 'site with pages title',
|
56
|
+
:host => 'site-with-pages.com'
|
57
|
+
|
58
|
+
another_site = Site.create! :name => 'another site',
|
59
|
+
:title => 'another site title',
|
60
|
+
:host => 'another-site.com'
|
61
|
+
|
62
|
+
# SECTIONS
|
63
|
+
|
64
|
+
page = Page.create! :site => site,
|
65
|
+
:title => 'a page',
|
66
|
+
:permalink => 'a-page',
|
67
|
+
:comment_age => 0,
|
68
|
+
:published_at => Time.parse('2008-01-01 12:00:00')
|
69
|
+
|
70
|
+
page.single_article_mode = false # FIXME make has_options monkeypatch upate_attributes
|
71
|
+
page.save!
|
72
|
+
|
73
|
+
another_page = Page.create! :site => site,
|
74
|
+
:title => 'another page',
|
75
|
+
:permalink => 'another-page',
|
76
|
+
:comment_age => 0,
|
77
|
+
:published_at => Time.parse('2008-01-01 12:00:00')
|
78
|
+
|
79
|
+
Page.create! :site => another_site,
|
80
|
+
:title => "another site's page",
|
81
|
+
:permalink => 'another-sites-page',
|
82
|
+
:comment_age => 0,
|
83
|
+
:published_at => Time.parse('2008-01-01 12:00:00')
|
84
|
+
|
85
|
+
non_ascii_page = Page.create! :site => site,
|
86
|
+
:title => 'page with non-ascii permalink',
|
87
|
+
:permalink => 'öäü',
|
88
|
+
:comment_age => 0,
|
89
|
+
:single_article_mode => false,
|
90
|
+
:published_at => Time.parse('2008-01-01 12:00:00')
|
91
|
+
|
92
|
+
special_character_page = Page.create! :site => site,
|
93
|
+
:title => 'page with special character permalink',
|
94
|
+
:permalink => '$%&',
|
95
|
+
:comment_age => 0,
|
96
|
+
:single_article_mode => false,
|
97
|
+
:published_at => Time.parse('2008-01-01 12:00:00')
|
98
|
+
|
99
|
+
page_for_special_and_non_ascii = Page.create! :site => site,
|
100
|
+
:title => 'letter test',
|
101
|
+
:permalink => 'letter-test',
|
102
|
+
:comment_age => 0,
|
103
|
+
:published_at => Time.parse('2008-01-01 12:00:00')
|
104
|
+
|
105
|
+
category = Category.create! :section => page,
|
106
|
+
:title => 'a category'
|
107
|
+
|
108
|
+
unpublished_section = Page.create! :site => site,
|
109
|
+
:title => 'an unpublished section',
|
110
|
+
:permalink => 'an-unpublished-section',
|
111
|
+
:single_article_mode => false
|
112
|
+
|
113
|
+
unpublished_section.update_attributes!(:published_at => 0)
|
114
|
+
# ARTICLES
|
115
|
+
|
116
|
+
article = Article.create! :site => site,
|
117
|
+
:section => page,
|
118
|
+
:title => 'a page article',
|
119
|
+
:excerpt => 'a page article excerpt',
|
120
|
+
:body => 'a page article body',
|
121
|
+
:categories => [category],
|
122
|
+
:tag_list => 'foo bar',
|
123
|
+
:author => user,
|
124
|
+
:published_at => Time.parse('2008-01-01 12:00:00')
|
125
|
+
|
126
|
+
Article.create! :site => site,
|
127
|
+
:section => another_page,
|
128
|
+
:title => 'another page article',
|
129
|
+
:excerpt => 'another page article excerpt',
|
130
|
+
:body => 'another page article body',
|
131
|
+
:author => user,
|
132
|
+
:published_at => Time.parse('2008-01-01 12:00:00')
|
133
|
+
|
134
|
+
Article.create! :site => site,
|
135
|
+
:section => page_for_special_and_non_ascii,
|
136
|
+
:title => 'a page with non ascii permalink',
|
137
|
+
:permalink => 'öäü',
|
138
|
+
:excerpt => 'a page with non ascii permalink excerpt',
|
139
|
+
:body => 'a page with non ascii permalink body',
|
140
|
+
:author => user,
|
141
|
+
:published_at => Time.parse('2008-01-01 12:00:00')
|
142
|
+
|
143
|
+
Article.create! :site => site,
|
144
|
+
:section => page_for_special_and_non_ascii,
|
145
|
+
:title => 'a page with special character permalink',
|
146
|
+
:permalink => '$%&',
|
147
|
+
:excerpt => 'a page with special character excerpt',
|
148
|
+
:body => 'a page with special character body',
|
149
|
+
:author => user,
|
150
|
+
:published_at => Time.parse('2008-01-01 12:00:00')
|
151
|
+
|
152
|
+
Article.create! :site => site,
|
153
|
+
:section => page,
|
154
|
+
:title => 'an unpublished page article',
|
155
|
+
:body => 'an unpublished page article body',
|
156
|
+
:categories => [category],
|
157
|
+
:tag_list => 'foo bar',
|
158
|
+
:author => user
|
159
|
+
|
160
|
+
Article.create! :site => site,
|
161
|
+
:section => unpublished_section,
|
162
|
+
:title => 'an article in an unpublished section',
|
163
|
+
:body => 'an article in an unpublished section',
|
164
|
+
:author => user
|
165
|
+
|
166
|
+
attributes = { :site => site, :section => page, :commentable => article, :author => user }
|
167
|
+
Comment.create! attributes.merge(:body => 'the approved comment body', :approved => 1)
|
168
|
+
Comment.create! attributes.merge(:body => 'the unapproved comment body',:approved => 0)
|
169
|
+
|
170
|
+
# ROLES and MEMBERSHIPS
|
171
|
+
|
172
|
+
superuser.roles.create!(:name => 'superuser')
|
173
|
+
admin.roles.create!(:name => 'admin', :context => site)
|
174
|
+
another_author.roles.create!(:name => 'author', :context => site)
|
175
|
+
another_moderator.roles.create!(:name => 'moderator', :context => site)
|
176
|
+
moderator.roles.create!(:name => 'moderator', :context => page)
|
177
|
+
designer.roles.create!(:name => 'designer', :context => site)
|
178
|
+
|
179
|
+
site.users << user
|
180
|
+
site.users << superuser
|
181
|
+
site.users << admin
|
182
|
+
site.users << moderator
|
183
|
+
site.users << another_moderator
|
184
|
+
site.users << designer
|
185
|
+
|
186
|
+
# OTHERS
|
187
|
+
|
188
|
+
CachedPage.create! :site_id => site.id,
|
189
|
+
:section_id => page.id,
|
190
|
+
:url => "http://#{site.host}"
|