adva 0.3.3 → 0.4.0
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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +60 -0
- data/.gitignore +3 -0
- data/.rspec +3 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/AGENTS.md +41 -0
- data/Appraisals +4 -0
- data/CHANGELOG +1 -1
- data/CLAUDE.md +79 -0
- data/Gemfile +1 -2
- data/README.md +203 -0
- data/Rakefile +30 -0
- data/adva.gemspec +22 -5
- data/app/assets/javascripts/adva_cms.js +1 -0
- data/app/assets/stylesheets/adva_cms/layout/login.scss +1 -1
- data/app/controllers/admin/articles_controller.rb +3 -0
- data/app/controllers/admin/base_controller.rb +1 -9
- data/app/controllers/admin/ckeditor_controller.rb +11 -0
- data/app/controllers/admin/page/articles_controller.rb +26 -53
- data/app/controllers/admin/page/categories_controller.rb +28 -11
- data/app/controllers/admin/page/contents_controller.rb +5 -14
- data/app/controllers/admin/page/links_controller.rb +13 -16
- data/app/controllers/admin/sections_controller.rb +15 -10
- data/app/controllers/admin/sites_controller.rb +38 -15
- data/app/controllers/admin/users_controller.rb +14 -8
- data/app/controllers/articles_controller.rb +3 -3
- data/app/controllers/base_controller.rb +2 -5
- data/app/controllers/password_controller.rb +24 -8
- data/app/controllers/session_controller.rb +18 -8
- data/app/helpers/activities_helper.rb +4 -20
- data/app/helpers/admin/base_helper.rb +3 -3
- data/app/helpers/base_helper.rb +16 -16
- data/app/helpers/content_helper.rb +16 -16
- data/app/helpers/resource_helper.rb +9 -9
- data/app/helpers/users_helper.rb +3 -3
- data/app/models/activity.rb +4 -4
- data/app/models/article.rb +3 -1
- data/app/models/categorization.rb +1 -1
- data/app/models/category.rb +6 -6
- data/app/models/content.rb +66 -23
- data/app/models/page.rb +3 -3
- data/app/models/password_mailer.rb +8 -8
- data/app/models/section.rb +17 -16
- data/app/models/site.rb +15 -26
- data/app/models/tag.rb +5 -0
- data/app/models/user.rb +43 -18
- data/app/models/user_session.rb +19 -0
- data/app/views/admin/activities/_activities.html.slim +15 -0
- data/app/views/admin/activities/_comment.html.slim +25 -0
- data/app/views/admin/activities/_content.html.slim +17 -0
- data/app/views/admin/activities/_topic.html.slim +17 -0
- data/app/views/admin/page/articles/_form.html.slim +40 -0
- data/app/views/admin/page/articles/_options.html.slim +9 -0
- data/app/views/admin/page/articles/edit.html.slim +11 -0
- data/app/views/admin/page/articles/new.html.slim +9 -0
- data/app/views/admin/page/categories/edit.html.slim +15 -0
- data/app/views/admin/page/categories/index.html.slim +14 -0
- data/app/views/admin/page/categories/new.html.slim +14 -0
- data/app/views/admin/page/contents/index.html.slim +18 -0
- data/app/views/admin/page/links/_form.html.slim +18 -0
- data/app/views/admin/page/links/_options.html.slim +8 -0
- data/app/views/admin/page/links/edit.html.slim +9 -0
- data/app/views/admin/page/links/new.html.slim +9 -0
- data/app/views/admin/sections/_form.html.slim +22 -0
- data/app/views/admin/sections/edit.html.slim +6 -0
- data/app/views/admin/sections/index.html.slim +17 -0
- data/app/views/admin/sections/new.html.slim +22 -0
- data/app/views/admin/sections/settings/_page.html.slim +9 -0
- data/app/views/admin/shared/_header.html.slim +16 -0
- data/app/views/admin/shared/_section.html.slim +5 -0
- data/app/views/admin/shared/_section_tree.html.slim +15 -0
- data/app/views/admin/sites/_email_notifications.html.slim +7 -0
- data/app/views/admin/sites/_form.html.slim +12 -0
- data/app/views/admin/sites/_recent_users.html.slim +11 -0
- data/app/views/admin/sites/_sections.html.slim +6 -0
- data/app/views/admin/sites/_unapproved_comments.html.slim +7 -0
- data/app/views/admin/sites/edit.html.slim +3 -0
- data/app/views/admin/sites/index.html.slim +13 -0
- data/app/views/admin/sites/multi_sites_disabled.html.slim +11 -0
- data/app/views/admin/sites/new.html.slim +18 -0
- data/app/views/admin/sites/show.html.slim +11 -0
- data/app/views/admin/users/_form.html.slim +12 -0
- data/app/views/admin/users/_sidebar.html.slim +4 -0
- data/app/views/admin/users/edit.html.slim +6 -0
- data/app/views/admin/users/index.html.slim +13 -0
- data/app/views/admin/users/new.html.slim +4 -0
- data/app/views/admin/users/show.html.slim +23 -0
- data/app/views/categories/_checkboxes.html.slim +9 -0
- data/app/views/comments/_form.html.slim +3 -0
- data/app/views/comments/_list.html.slim +3 -0
- data/app/views/layouts/admin.html.slim +50 -0
- data/app/views/layouts/application.html.slim +7 -0
- data/app/views/layouts/login.html.slim +23 -0
- data/app/views/pages/articles/index.html.slim +8 -0
- data/app/views/pages/articles/show.html.slim +14 -0
- data/app/views/password/edit.html.slim +19 -0
- data/app/views/password/new.html.slim +10 -0
- data/app/views/password_mailer/reset_password_email.html.slim +21 -0
- data/app/views/password_mailer/updated_password_email.html.slim +3 -0
- data/app/views/session/new.html.slim +14 -0
- data/app/views/shared/_flash.html.slim +2 -0
- data/app/views/shared/_menu.html.slim +6 -0
- data/app/views/shared/_sidebar.html.slim +14 -0
- data/bin/setup +7 -0
- data/config/environment.rb +8 -8
- data/config/initializers/ckeditor.rb +12 -5
- data/config/initializers/menus.rb +58 -66
- data/config/initializers/time_format.rb +1 -1
- data/config/routes.rb +16 -21
- data/db/migrate/20080401000000_create_activities_table.rb +7 -7
- data/db/migrate/20080401000001_create_sites_table.rb +2 -2
- data/db/migrate/20080401000002_create_sections_table.rb +3 -3
- data/db/migrate/20080401000003_create_contents_table.rb +12 -11
- data/db/migrate/20080401000004_create_categories_table.rb +3 -3
- data/db/migrate/20080401000005_create_category_assignments.rb +1 -1
- data/db/migrate/20080401000006_create_taggable_tables.rb +29 -26
- data/db/migrate/20080402000001_create_users_table.rb +11 -11
- data/db/migrate/20080402000005_create_memberships_table.rb +3 -3
- data/db/migrate/20080710000000_create_plugin_configs.rb +3 -3
- data/db/migrate/20080715131051_plugin_owner_column.rb +3 -3
- data/db/migrate/20081208161500_add_content_type_to_join_tables.rb +4 -4
- data/db/migrate/20090216114034_rename_category_assignment_to_categorization.rb +1 -1
- data/db/migrate/20090218083515_add_metatags_to_contents.rb +1 -1
- data/db/migrate/20090305123429_move_sections_to_pages.rb +3 -3
- data/db/migrate/20090519132700_add_published_at_to_sections.rb +3 -3
- data/db/migrate/20090522082000_add_metatags_to_sites.rb +2 -2
- data/db/migrate/20090625124502_create_accounts.rb +2 -2
- data/db/migrate/20090625133231_add_account_to_user.rb +1 -1
- data/db/migrate/20090702085459_create_section_translations.rb +3 -3
- data/db/migrate/20090702200226_create_category_translations.rb +3 -3
- data/db/migrate/20090707171100_upgrade_paperclip_paths.rb +3 -26
- data/db/migrate/20090709111934_add_email_notification_to_site.rb +5 -5
- data/db/migrate/20091026000906_add_nesting_to_articles.rb +4 -12
- data/db/migrate/20140721000000_add_title_to_contents.rb +1 -1
- data/db/migrate/20161227203152_add_timestamps_to_categories.rb +1 -1
- data/db/migrate/20241224000001_add_admin_to_users.rb +5 -0
- data/db/migrate/20241224000002_add_timestamps_to_sites.rb +5 -0
- data/db/migrate/20241224000003_add_timestamps_to_sections.rb +5 -0
- data/db/migrate/20241224000004_add_hidden_on_global_nav_to_sections.rb +5 -0
- data/db/migrate/20241224000005_widen_activities_author_columns.rb +6 -0
- data/db/migrate/20260408000001_upgrade_taggable_tables_for_acts_as_taggable_on.rb +55 -0
- data/db/migrate/20260720000001_widen_users_password_hash.rb +11 -0
- data/db/migrate/20260729000001_add_authlogic_tokens_to_users.rb +36 -0
- data/doc/NOTES +8 -8
- data/doc/testing.txt +66 -50
- data/gemfiles/rails_8_1.gemfile +8 -0
- data/lib/adva/authenticate_user.rb +52 -90
- data/lib/adva/belongs_to_author.rb +1 -1
- data/lib/adva/crypto_providers/bcrypt.rb +42 -0
- data/lib/adva/crypto_providers/legacy_salted_sha1.rb +31 -0
- data/lib/adva/extensible_forms.rb +17 -17
- data/lib/adva/has_options.rb +3 -4
- data/lib/adva/override.rb +55 -0
- data/lib/adva/version.rb +1 -1
- data/lib/adva.rb +10 -6
- data/lib/rails_ext/action_controller/default_params.rb +1 -1
- data/lib/rails_ext/action_controller/event_helper.rb +1 -1
- data/lib/rails_ext/action_controller/render_with_error_proc.rb +3 -3
- data/lib/rails_ext/action_controller/url_for_returning.rb +1 -1
- data/lib/rails_ext.rb +4 -5
- data/{test → spec}/fixtures/templates/menu/shared/_menu.html.erb +1 -1
- data/spec/helpers/activities_helper_more_spec.rb +41 -0
- data/spec/helpers/activities_helper_spec.rb +44 -0
- data/spec/helpers/admin/base_helper_spec.rb +14 -0
- data/spec/helpers/admin_base_helper_more_spec.rb +37 -0
- data/spec/helpers/base_helper_spec.rb +120 -0
- data/spec/helpers/content_helper_checkbox_spec.rb +21 -0
- data/spec/helpers/content_helper_more_spec.rb +104 -0
- data/spec/helpers/content_helper_spec.rb +14 -0
- data/spec/helpers/resource_helper_links_to_actions_spec.rb +13 -0
- data/spec/helpers/resource_helper_paths_spec.rb +21 -0
- data/spec/helpers/resource_helper_spec.rb +101 -0
- data/spec/helpers/users_helper_gravatar_spec.rb +18 -0
- data/spec/helpers/users_helper_spec.rb +55 -0
- data/spec/internal/.gitignore +3 -0
- data/spec/internal/app/assets/config/manifest.js +3 -0
- data/spec/internal/app/assets/images/.keep +0 -0
- data/spec/internal/app/assets/javascripts/.keep +0 -0
- data/spec/internal/app/assets/stylesheets/.keep +0 -0
- data/spec/internal/app/controllers/application_controller.rb +8 -0
- data/spec/internal/config/application.rb +26 -0
- data/spec/internal/config/database.yml +5 -0
- data/spec/internal/config/environment.rb +75 -0
- data/spec/internal/db/seed_for_tests.rb +12 -0
- data/{test → spec}/javascript/lib/jstest.rb +81 -81
- data/{test → spec}/javascript/templates/test_case.erb +1 -1
- data/spec/lib/adva_event_spec.rb +61 -0
- data/spec/lib/adva_override_spec.rb +197 -0
- data/spec/lib/authenticate_user_comprehensive_spec.rb +133 -0
- data/spec/lib/authenticate_user_cookies_spec.rb +40 -0
- data/spec/lib/base_controller_cache_spec.rb +20 -0
- data/spec/lib/base_controller_pagination_spec.rb +24 -0
- data/spec/lib/crypto_providers_spec.rb +104 -0
- data/spec/lib/extensible_forms_spec.rb +133 -0
- data/spec/lib/has_options_spec.rb +18 -0
- data/spec/lib/rails_ext_event_helper_spec.rb +24 -0
- data/spec/lib/rails_ext_render_with_error_proc_spec.rb +68 -0
- data/spec/lib/rails_ext_url_for_returning_spec.rb +20 -0
- data/spec/models/activity_spec.rb +171 -0
- data/spec/models/article_spec.rb +75 -0
- data/spec/models/belongs_to_author_spec.rb +24 -0
- data/spec/models/categorization_spec.rb +71 -0
- data/spec/models/category_spec.rb +273 -0
- data/spec/models/content_activity_logging_spec.rb +64 -0
- data/spec/models/content_additional_coverage_spec.rb +152 -0
- data/spec/models/content_permalink_spec.rb +24 -0
- data/spec/models/content_spec.rb +334 -0
- data/spec/models/link_spec.rb +53 -0
- data/spec/models/membership_spec.rb +53 -0
- data/spec/models/page_spec.rb +196 -0
- data/spec/models/password_mailer_spec.rb +162 -0
- data/spec/models/section_published_spec.rb +31 -0
- data/spec/models/section_spec.rb +77 -0
- data/spec/models/site_find_by_host_spec.rb +32 -0
- data/spec/models/site_spec.rb +53 -0
- data/spec/models/tag_spec.rb +16 -0
- data/spec/models/user_additional_coverage_spec.rb +264 -0
- data/spec/models/user_spec.rb +250 -0
- data/spec/rails_helper.rb +42 -0
- data/spec/requests/admin_articles_crud_spec.rb +63 -0
- data/spec/requests/admin_articles_spec.rb +12 -0
- data/spec/requests/admin_base_controller_additional_coverage_spec.rb +69 -0
- data/spec/requests/admin_base_controller_spec.rb +84 -0
- data/spec/requests/admin_categories_crud_spec.rb +32 -0
- data/spec/requests/admin_categories_spec.rb +13 -0
- data/spec/requests/admin_install_spec.rb +25 -0
- data/spec/requests/admin_page_articles_more_spec.rb +53 -0
- data/spec/requests/admin_page_categories_controller_spec.rb +21 -0
- data/spec/requests/admin_page_categories_update_all_spec.rb +94 -0
- data/spec/requests/admin_page_contents_controller_spec.rb +85 -0
- data/spec/requests/admin_page_contents_spec.rb +13 -0
- data/spec/requests/admin_page_contents_update_all_spec.rb +28 -0
- data/spec/requests/admin_page_links_spec.rb +84 -0
- data/spec/requests/admin_pages_spec.rb +13 -0
- data/spec/requests/admin_sections_authorized_spec.rb +13 -0
- data/spec/requests/admin_sections_controller_spec.rb +111 -0
- data/spec/requests/admin_sections_crud_paths_spec.rb +48 -0
- data/spec/requests/admin_sections_crud_spec.rb +20 -0
- data/spec/requests/admin_sections_spec.rb +12 -0
- data/spec/requests/admin_sections_update_all_spec.rb +29 -0
- data/spec/requests/admin_sites_authorized_spec.rb +13 -0
- data/spec/requests/admin_sites_controller_spec.rb +202 -0
- data/spec/requests/admin_sites_crud_spec.rb +37 -0
- data/spec/requests/admin_sites_failures_spec.rb +45 -0
- data/spec/requests/admin_sites_spec.rb +18 -0
- data/spec/requests/admin_users_crud_spec.rb +33 -0
- data/spec/requests/admin_users_failures_spec.rb +27 -0
- data/spec/requests/admin_users_spec.rb +35 -0
- data/spec/requests/articles_spec.rb +344 -0
- data/spec/requests/articles_tags_categories_spec.rb +40 -0
- data/spec/requests/base_controller_additional_coverage_spec.rb +295 -0
- data/spec/requests/base_controller_spec.rb +344 -0
- data/spec/requests/base_controller_unpublished_spec.rb +17 -0
- data/spec/requests/forgery_protection_spec.rb +85 -0
- data/spec/requests/page_articles_spec.rb +22 -0
- data/spec/requests/password_spec.rb +133 -0
- data/spec/requests/perishable_token_login_spec.rb +49 -0
- data/spec/requests/session_spec.rb +170 -0
- data/spec/requests/token_login_spec.rb +54 -0
- data/spec/spec_helper.rb +38 -0
- data/{test/plugins → spec/support}/adva_url_history/init_url_history.rb +2 -2
- data/spec/support/auth.rb +14 -0
- data/spec/support/failure_dump.rb +20 -0
- data/vendor/gems/belongs_to_cacheable/README.md +115 -4
- data/vendor/gems/belongs_to_cacheable/Rakefile +4 -0
- data/vendor/gems/belongs_to_cacheable/belongs_to_cacheable.gemspec +4 -2
- data/vendor/gems/belongs_to_cacheable/lib/active_record/belongs_to_cacheable.rb +2 -2
- data/vendor/gems/belongs_to_cacheable/spec/belongs_to_cacheable_spec.rb +29 -7
- data/vendor/gems/belongs_to_cacheable/spec/spec_helper.rb +15 -10
- data/vendor/gems/cacheable_flash/.rspec +3 -0
- data/vendor/gems/cacheable_flash/README.md +54 -4
- data/vendor/gems/cacheable_flash/Rakefile +4 -3
- data/vendor/gems/cacheable_flash/cacheable_flash.gemspec +7 -10
- data/vendor/gems/cacheable_flash/lib/cacheable_flash/middleware.rb +1 -1
- data/vendor/gems/cacheable_flash/spec/cacheable_flash/middleware_spec.rb +45 -0
- data/vendor/gems/cacheable_flash/spec/cacheable_flash/version_spec.rb +10 -0
- data/vendor/gems/cacheable_flash/spec/spec_helper.rb +26 -0
- data/vendor/gems/table_builder/README.md +212 -16
- data/vendor/gems/table_builder/Rakefile +4 -0
- data/vendor/gems/table_builder/lib/table_builder/body.rb +17 -4
- data/vendor/gems/table_builder/lib/table_builder/cell.rb +1 -1
- data/vendor/gems/table_builder/lib/table_builder/column.rb +3 -3
- data/vendor/gems/table_builder/lib/table_builder/head.rb +3 -3
- data/vendor/gems/table_builder/lib/table_builder/row.rb +5 -5
- data/vendor/gems/table_builder/lib/table_builder/rows.rb +5 -5
- data/vendor/gems/table_builder/lib/table_builder/table.rb +8 -8
- data/vendor/gems/table_builder/lib/table_builder/tag.rb +17 -9
- data/vendor/gems/table_builder/lib/table_builder.rb +14 -5
- data/vendor/gems/table_builder/spec/spec_helper.rb +111 -0
- data/vendor/gems/table_builder/{test → spec/support}/fixtures/templates/table_all.html.erb +6 -6
- data/vendor/gems/table_builder/{test → spec/support}/fixtures/templates/table_simple.html.erb +1 -1
- data/vendor/gems/table_builder/spec/table_builder_spec.rb +294 -0
- data/vendor/gems/table_builder/table_builder.gemspec +10 -2
- data/vendor/gems/tags/README.md +205 -15
- data/vendor/gems/tags/Rakefile +4 -0
- data/vendor/gems/tags/lib/breadcrumbs.rb +4 -4
- data/vendor/gems/tags/lib/menu/builder.rb +10 -10
- data/vendor/gems/tags/lib/menu.rb +10 -10
- data/vendor/gems/tags/spec/breadcrumbs_spec.rb +19 -0
- data/vendor/gems/tags/spec/menu_base_spec.rb +42 -0
- data/vendor/gems/tags/spec/menu_builder_spec.rb +77 -0
- data/vendor/gems/tags/spec/menu_spec.rb +173 -0
- data/vendor/gems/tags/spec/node_spec.rb +53 -0
- data/vendor/gems/tags/spec/sections_menu_spec.rb +125 -0
- data/vendor/gems/tags/spec/spec_helper.rb +53 -0
- data/vendor/gems/tags/spec/tag_spec.rb +31 -0
- data/vendor/gems/tags/tags.gemspec +10 -2
- metadata +550 -1171
- data/README +0 -245
- data/app/models/activity_notifier.rb +0 -11
- data/app/observers/activities/activity_observer.rb +0 -25
- data/app/observers/activities/article_observer.rb +0 -20
- data/app/observers/activities/comment_observer.rb +0 -33
- data/app/observers/activities/logger.rb +0 -94
- data/app/observers/activities/section_observer.rb +0 -9
- data/app/views/activity_notifier/new_content_notification.html.erb +0 -5
- data/app/views/admin/activities/_activities.html.erb +0 -10
- data/app/views/admin/activities/_comment.html.erb +0 -35
- data/app/views/admin/activities/_content.html.erb +0 -16
- data/app/views/admin/activities/_topic.html.erb +0 -16
- data/app/views/admin/install/confirmation.html.erb +0 -10
- data/app/views/admin/install/index.html.erb +0 -38
- data/app/views/admin/page/articles/_form.html.erb +0 -43
- data/app/views/admin/page/articles/_options.html.erb +0 -19
- data/app/views/admin/page/articles/edit.html.erb +0 -15
- data/app/views/admin/page/articles/new.html.erb +0 -12
- data/app/views/admin/page/categories/edit.html.erb +0 -22
- data/app/views/admin/page/categories/index.html.erb +0 -23
- data/app/views/admin/page/categories/new.html.erb +0 -21
- data/app/views/admin/page/contents/index.html.erb +0 -25
- data/app/views/admin/page/links/_form.html.erb +0 -26
- data/app/views/admin/page/links/_options.html.erb +0 -20
- data/app/views/admin/page/links/edit.html.erb +0 -12
- data/app/views/admin/page/links/new.html.erb +0 -12
- data/app/views/admin/sections/_form.html.haml +0 -19
- data/app/views/admin/sections/edit.html.haml +0 -6
- data/app/views/admin/sections/index.html.erb +0 -27
- data/app/views/admin/sections/new.html.erb +0 -31
- data/app/views/admin/sections/settings/_page.html.haml +0 -8
- data/app/views/admin/shared/_header.html.erb +0 -20
- data/app/views/admin/shared/_section.html.erb +0 -8
- data/app/views/admin/shared/_section_tree.html.erb +0 -23
- data/app/views/admin/sites/_email_notifications.html.erb +0 -8
- data/app/views/admin/sites/_form.html.erb +0 -15
- data/app/views/admin/sites/_recent_users.html.erb +0 -13
- data/app/views/admin/sites/_sections.html.erb +0 -10
- data/app/views/admin/sites/_unapproved_comments.html.erb +0 -10
- data/app/views/admin/sites/edit.html.erb +0 -4
- data/app/views/admin/sites/index.html.erb +0 -21
- data/app/views/admin/sites/multi_sites_disabled.html.erb +0 -11
- data/app/views/admin/sites/new.html.erb +0 -21
- data/app/views/admin/sites/show.html.erb +0 -13
- data/app/views/admin/users/_form.html.erb +0 -15
- data/app/views/admin/users/_sidebar.html.erb +0 -8
- data/app/views/admin/users/edit.html.erb +0 -7
- data/app/views/admin/users/index.html.erb +0 -13
- data/app/views/admin/users/new.html.erb +0 -5
- data/app/views/admin/users/show.html.erb +0 -27
- data/app/views/categories/_checkboxes.html.erb +0 -12
- data/app/views/layouts/admin.html.haml +0 -48
- data/app/views/layouts/login.html.erb +0 -26
- data/app/views/pages/articles/index.html.erb +0 -10
- data/app/views/pages/articles/show.html.erb +0 -17
- data/app/views/password/edit.html.erb +0 -24
- data/app/views/password/new.html.erb +0 -13
- data/app/views/password_mailer/reset_password_email.html.erb +0 -23
- data/app/views/password_mailer/updated_password_email.html.erb +0 -3
- data/app/views/session/new.html.erb +0 -17
- data/app/views/shared/_flash.html.erb +0 -3
- data/app/views/shared/_menu.html.erb +0 -10
- data/app/views/shared/_sidebar.html.erb +0 -19
- data/config/initializers/settings.rb +0 -26
- data/lib/tasks/adva.rake +0 -183
- data/test/NOTES +0 -56
- data/test/adva_user_contexts.rb +0 -42
- data/test/adva_user_fixtures.rb +0 -18
- data/test/contexts.rb +0 -365
- data/test/fixtures.rb +0 -190
- data/test/functional/admin/articles_controller_test.rb +0 -329
- data/test/functional/admin/base_controller_test.rb +0 -68
- data/test/functional/admin/cached_pages_controller_test.rb +0 -66
- data/test/functional/admin/categories_controller_test.rb +0 -164
- data/test/functional/admin/cells_controller_spec.rb +0 -32
- data/test/functional/admin/install_controller_test.rb +0 -85
- data/test/functional/admin/plugins_controller_test.rb +0 -93
- data/test/functional/admin/sections_controller_test.rb +0 -201
- data/test/functional/admin/sites_controller_test.rb +0 -240
- data/test/functional/admin/users_controller_test.rb +0 -176
- data/test/functional/asset_tag_expansions_test.rb +0 -82
- data/test/functional/base_controller_test.rb +0 -73
- data/test/functional/page_articles_controller_test.rb +0 -168
- data/test/functional/page_articles_routes_test.rb +0 -73
- data/test/functional/password_controller_test.rb +0 -96
- data/test/functional/session_controller_test.rb +0 -1
- data/test/functional/user_controller_test.rb +0 -95
- data/test/integration/admin/cached_pages_test.rb +0 -43
- data/test/integration/admin/categories_test.rb +0 -66
- data/test/integration/admin/custom_templates_test.rb +0 -42
- data/test/integration/admin/filtering_articles_test.rb +0 -32
- data/test/integration/admin/plugins.rb +0 -32
- data/test/integration/admin/section_article_test.rb +0 -150
- data/test/integration/admin/section_test.rb +0 -88
- data/test/integration/admin/sites_test.rb +0 -48
- data/test/integration/anonymous_login_test.rb +0 -39
- data/test/integration/edit_user_test.rb +0 -44
- data/test/integration/installation_test.rb +0 -109
- data/test/integration/memberships_test.rb +0 -52
- data/test/integration/page_article_comment_test.rb +0 -51
- data/test/integration/page_article_test.rb +0 -87
- data/test/integration/section_index_test.rb +0 -37
- data/test/integration/user_deletion_test.rb +0 -27
- data/test/integration/user_login_test.rb +0 -53
- data/test/integration/user_login_with_remember_me_test.rb +0 -20
- data/test/integration/user_registration_test.rb +0 -64
- data/test/matchy/History.txt +0 -4
- data/test/matchy/License.txt +0 -20
- data/test/matchy/Manifest.txt +0 -22
- data/test/matchy/PostInstall.txt +0 -7
- data/test/matchy/README.rdoc +0 -68
- data/test/matchy/Rakefile +0 -4
- data/test/matchy/config/hoe.rb +0 -73
- data/test/matchy/config/requirements.rb +0 -15
- data/test/matchy/lib/matchy/built_in/enumerable_expectations.rb +0 -69
- data/test/matchy/lib/matchy/built_in/error_expectations.rb +0 -90
- data/test/matchy/lib/matchy/built_in/operator_expectations.rb +0 -97
- data/test/matchy/lib/matchy/built_in/truth_expectations.rb +0 -231
- data/test/matchy/lib/matchy/expectation.rb +0 -47
- data/test/matchy/lib/matchy/modals.rb +0 -51
- data/test/matchy/lib/matchy/version.rb +0 -9
- data/test/matchy/lib/matchy.rb +0 -16
- data/test/matchy/matchy.gemspec +0 -47
- data/test/matchy/setup.rb +0 -1585
- data/test/matchy/tasks/deployment.rake +0 -34
- data/test/matchy/tasks/environment.rake +0 -7
- data/test/matchy/test/test_enumerable_expectations.rb +0 -91
- data/test/matchy/test/test_error_expectations.rb +0 -109
- data/test/matchy/test/test_expectation_base.rb +0 -35
- data/test/matchy/test/test_helper.rb +0 -2
- data/test/matchy/test/test_modals.rb +0 -39
- data/test/matchy/test/test_operator_expectations.rb +0 -157
- data/test/matchy/test/test_truth_expectations.rb +0 -258
- data/test/no_peeping_toms/README +0 -40
- data/test/no_peeping_toms/init.rb +0 -12
- data/test/no_peeping_toms/install.rb +0 -1
- data/test/no_peeping_toms/lib/no_peeping_toms.rb +0 -10
- data/test/no_peeping_toms/spec/db/database.yml +0 -3
- data/test/no_peeping_toms/spec/db/schema.rb +0 -5
- data/test/no_peeping_toms/spec/no_peeping_toms_spec.rb +0 -56
- data/test/no_peeping_toms/spec/spec_helper.rb +0 -8
- data/test/no_peeping_toms/tasks/no_peeping_toms_tasks.rake +0 -4
- data/test/no_peeping_toms/uninstall.rb +0 -1
- data/test/plugins/adva_context_templates/context_templates_test.rb +0 -138
- data/test/plugins/adva_post_ping/controller/integration_test.rb +0 -78
- data/test/plugins/adva_post_ping/post_ping_test.rb +0 -94
- data/test/plugins/adva_url_history/article_test.rb +0 -94
- data/test/plugins/adva_url_history/section_test.rb +0 -49
- data/test/rr/.gitignore +0 -6
- data/test/rr/CHANGES +0 -192
- data/test/rr/README.rdoc +0 -309
- data/test/rr/Rakefile +0 -70
- data/test/rr/doc/0.6.0.release.markdown +0 -81
- data/test/rr/introducting_rr.txt +0 -206
- data/test/rr/lib/rr/adapters/rr_methods.rb +0 -131
- data/test/rr/lib/rr/adapters/rspec.rb +0 -23
- data/test/rr/lib/rr/adapters/test_unit.rb +0 -25
- data/test/rr/lib/rr/double.rb +0 -212
- data/test/rr/lib/rr/double_definitions/child_double_definition_creator.rb +0 -27
- data/test/rr/lib/rr/double_definitions/double_definition.rb +0 -346
- data/test/rr/lib/rr/double_definitions/double_definition_creator.rb +0 -167
- data/test/rr/lib/rr/double_definitions/double_definition_creator_proxy.rb +0 -57
- data/test/rr/lib/rr/double_definitions/strategies/implementation/implementation_strategy.rb +0 -15
- data/test/rr/lib/rr/double_definitions/strategies/implementation/proxy.rb +0 -62
- data/test/rr/lib/rr/double_definitions/strategies/implementation/reimplementation.rb +0 -14
- data/test/rr/lib/rr/double_definitions/strategies/implementation/strongly_typed_reimplementation.rb +0 -17
- data/test/rr/lib/rr/double_definitions/strategies/scope/instance.rb +0 -15
- data/test/rr/lib/rr/double_definitions/strategies/scope/instance_of_class.rb +0 -46
- data/test/rr/lib/rr/double_definitions/strategies/scope/scope_strategy.rb +0 -15
- data/test/rr/lib/rr/double_definitions/strategies/strategy.rb +0 -70
- data/test/rr/lib/rr/double_definitions/strategies/verification/dont_allow.rb +0 -34
- data/test/rr/lib/rr/double_definitions/strategies/verification/mock.rb +0 -44
- data/test/rr/lib/rr/double_definitions/strategies/verification/stub.rb +0 -45
- data/test/rr/lib/rr/double_definitions/strategies/verification/verification_strategy.rb +0 -15
- data/test/rr/lib/rr/double_injection.rb +0 -141
- data/test/rr/lib/rr/double_matches.rb +0 -51
- data/test/rr/lib/rr/errors/argument_equality_error.rb +0 -6
- data/test/rr/lib/rr/errors/double_definition_error.rb +0 -6
- data/test/rr/lib/rr/errors/double_not_found_error.rb +0 -6
- data/test/rr/lib/rr/errors/double_order_error.rb +0 -6
- data/test/rr/lib/rr/errors/rr_error.rb +0 -20
- data/test/rr/lib/rr/errors/spy_verification_error.rb +0 -6
- data/test/rr/lib/rr/errors/subject_does_not_implement_method_error.rb +0 -6
- data/test/rr/lib/rr/errors/subject_has_different_arity_error.rb +0 -6
- data/test/rr/lib/rr/errors/times_called_error.rb +0 -6
- data/test/rr/lib/rr/expectations/any_argument_expectation.rb +0 -21
- data/test/rr/lib/rr/expectations/argument_equality_expectation.rb +0 -41
- data/test/rr/lib/rr/expectations/times_called_expectation.rb +0 -57
- data/test/rr/lib/rr/hash_with_object_id_key.rb +0 -41
- data/test/rr/lib/rr/invocation_matcher.rb +0 -27
- data/test/rr/lib/rr/recorded_calls.rb +0 -72
- data/test/rr/lib/rr/space.rb +0 -123
- data/test/rr/lib/rr/spy_verification.rb +0 -38
- data/test/rr/lib/rr/spy_verification_proxy.rb +0 -18
- data/test/rr/lib/rr/times_called_matchers/any_times_matcher.rb +0 -19
- data/test/rr/lib/rr/times_called_matchers/at_least_matcher.rb +0 -16
- data/test/rr/lib/rr/times_called_matchers/at_most_matcher.rb +0 -24
- data/test/rr/lib/rr/times_called_matchers/integer_matcher.rb +0 -19
- data/test/rr/lib/rr/times_called_matchers/non_terminal.rb +0 -27
- data/test/rr/lib/rr/times_called_matchers/proc_matcher.rb +0 -11
- data/test/rr/lib/rr/times_called_matchers/range_matcher.rb +0 -21
- data/test/rr/lib/rr/times_called_matchers/terminal.rb +0 -20
- data/test/rr/lib/rr/times_called_matchers/times_called_matcher.rb +0 -44
- data/test/rr/lib/rr/wildcard_matchers/anything.rb +0 -18
- data/test/rr/lib/rr/wildcard_matchers/boolean.rb +0 -23
- data/test/rr/lib/rr/wildcard_matchers/duck_type.rb +0 -32
- data/test/rr/lib/rr/wildcard_matchers/hash_including.rb +0 -29
- data/test/rr/lib/rr/wildcard_matchers/is_a.rb +0 -25
- data/test/rr/lib/rr/wildcard_matchers/numeric.rb +0 -13
- data/test/rr/lib/rr/wildcard_matchers/range.rb +0 -7
- data/test/rr/lib/rr/wildcard_matchers/regexp.rb +0 -7
- data/test/rr/lib/rr/wildcard_matchers/satisfy.rb +0 -26
- data/test/rr/lib/rr.rb +0 -83
- data/test/rr/spec/core_spec_suite.rb +0 -19
- data/test/rr/spec/environment_fixture_setup.rb +0 -6
- data/test/rr/spec/high_level_spec.rb +0 -350
- data/test/rr/spec/recorded_calls_spec.rb +0 -119
- data/test/rr/spec/rr/adapters/rr_methods_argument_matcher_spec.rb +0 -67
- data/test/rr/spec/rr/adapters/rr_methods_creator_spec.rb +0 -149
- data/test/rr/spec/rr/adapters/rr_methods_space_spec.rb +0 -115
- data/test/rr/spec/rr/adapters/rr_methods_spec_helper.rb +0 -11
- data/test/rr/spec/rr/adapters/rr_methods_times_matcher_spec.rb +0 -17
- data/test/rr/spec/rr/double_definitions/child_double_definition_creator_spec.rb +0 -112
- data/test/rr/spec/rr/double_definitions/double_definition_creator_proxy_spec.rb +0 -155
- data/test/rr/spec/rr/double_definitions/double_definition_creator_spec.rb +0 -502
- data/test/rr/spec/rr/double_definitions/double_definition_spec.rb +0 -1159
- data/test/rr/spec/rr/double_injection/double_injection_bind_spec.rb +0 -111
- data/test/rr/spec/rr/double_injection/double_injection_dispatching_spec.rb +0 -244
- data/test/rr/spec/rr/double_injection/double_injection_has_original_method_spec.rb +0 -55
- data/test/rr/spec/rr/double_injection/double_injection_reset_spec.rb +0 -90
- data/test/rr/spec/rr/double_injection/double_injection_spec.rb +0 -77
- data/test/rr/spec/rr/double_injection/double_injection_verify_spec.rb +0 -29
- data/test/rr/spec/rr/double_spec.rb +0 -352
- data/test/rr/spec/rr/errors/rr_error_spec.rb +0 -67
- data/test/rr/spec/rr/expectations/any_argument_expectation_spec.rb +0 -47
- data/test/rr/spec/rr/expectations/anything_argument_equality_expectation_spec.rb +0 -14
- data/test/rr/spec/rr/expectations/argument_equality_expectation_spec.rb +0 -135
- data/test/rr/spec/rr/expectations/boolean_argument_equality_expectation_spec.rb +0 -34
- data/test/rr/spec/rr/expectations/hash_including_argument_equality_expectation_spec.rb +0 -82
- data/test/rr/spec/rr/expectations/hash_including_spec.rb +0 -17
- data/test/rr/spec/rr/expectations/satisfy_argument_equality_expectation_spec.rb +0 -59
- data/test/rr/spec/rr/expectations/satisfy_spec.rb +0 -14
- data/test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_any_times_spec.rb +0 -46
- data/test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_at_least_spec.rb +0 -69
- data/test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_at_most_spec.rb +0 -71
- data/test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_helper.rb +0 -23
- data/test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_integer_spec.rb +0 -104
- data/test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_proc_spec.rb +0 -81
- data/test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb +0 -83
- data/test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb +0 -38
- data/test/rr/spec/rr/invocation_matcher_spec.rb +0 -255
- data/test/rr/spec/rr/rspec/rspec_adapter_spec.rb +0 -66
- data/test/rr/spec/rr/rspec/rspec_backtrace_tweaking_spec.rb +0 -54
- data/test/rr/spec/rr/rspec/rspec_usage_spec.rb +0 -86
- data/test/rr/spec/rr/space/hash_with_object_id_key_spec.rb +0 -88
- data/test/rr/spec/rr/space/space_spec.rb +0 -542
- data/test/rr/spec/rr/test_unit/test_helper.rb +0 -7
- data/test/rr/spec/rr/test_unit/test_unit_backtrace_test.rb +0 -35
- data/test/rr/spec/rr/test_unit/test_unit_integration_test.rb +0 -47
- data/test/rr/spec/rr/times_called_matchers/any_times_matcher_spec.rb +0 -47
- data/test/rr/spec/rr/times_called_matchers/at_least_matcher_spec.rb +0 -55
- data/test/rr/spec/rr/times_called_matchers/at_most_matcher_spec.rb +0 -70
- data/test/rr/spec/rr/times_called_matchers/integer_matcher_spec.rb +0 -70
- data/test/rr/spec/rr/times_called_matchers/proc_matcher_spec.rb +0 -55
- data/test/rr/spec/rr/times_called_matchers/range_matcher_spec.rb +0 -76
- data/test/rr/spec/rr/times_called_matchers/times_called_matcher_spec.rb +0 -118
- data/test/rr/spec/rr/wildcard_matchers/anything_spec.rb +0 -24
- data/test/rr/spec/rr/wildcard_matchers/boolean_spec.rb +0 -36
- data/test/rr/spec/rr/wildcard_matchers/duck_type_spec.rb +0 -52
- data/test/rr/spec/rr/wildcard_matchers/is_a_spec.rb +0 -32
- data/test/rr/spec/rr/wildcard_matchers/numeric_spec.rb +0 -32
- data/test/rr/spec/rr/wildcard_matchers/range_spec.rb +0 -35
- data/test/rr/spec/rr/wildcard_matchers/regexp_spec.rb +0 -43
- data/test/rr/spec/rr_spec.rb +0 -28
- data/test/rr/spec/rspec_spec_suite.rb +0 -16
- data/test/rr/spec/spec.opts +0 -14
- data/test/rr/spec/spec_helper.rb +0 -107
- data/test/rr/spec/spec_suite.rb +0 -27
- data/test/rr/spec/test_unit_spec_suite.rb +0 -21
- data/test/test_helper/clear_directories.rb +0 -16
- data/test/test_helper/ensure_single_site_mode.rb +0 -10
- data/test/test_helper/extensions/cacheable_flash.rb +0 -14
- data/test/test_helper/extensions/cronjob.rb +0 -11
- data/test/test_helper/extensions/even_test_log.rb +0 -21
- data/test/test_helper/extensions/integration_test.rb +0 -78
- data/test/test_helper/extensions/matchy.rb +0 -365
- data/test/test_helper/extensions/matchy_adva_cms.rb +0 -441
- data/test/test_helper/extensions/rails_patch.rb +0 -40
- data/test/test_helper/extensions/rr.rb +0 -7
- data/test/test_helper/extensions/test_unit.rb +0 -35
- data/test/test_helper/extensions/with_sugar.rb +0 -166
- data/test/test_helper/parse_options.rb +0 -18
- data/test/test_helper/setup_db_transaction.rb +0 -15
- data/test/test_helper/setup_webrat.rb +0 -9
- data/test/test_helper/test_server/init.rb +0 -15
- data/test/test_helper.rb +0 -75
- data/test/test_plugin/about.yml +0 -7
- data/test/test_plugin/init.rb +0 -5
- data/test/test_server/README.textile +0 -19
- data/test/test_server/bin/server +0 -14
- data/test/test_server/bin/spec +0 -11
- data/test/test_server/bin/test +0 -11
- data/test/test_server/lib/test_server/client.rb +0 -24
- data/test/test_server/lib/test_server/rails.rb +0 -59
- data/test/test_server/lib/test_server/runner/redgreen.rb +0 -72
- data/test/test_server/lib/test_server/runner/specs.rb +0 -20
- data/test/test_server/lib/test_server/runner/test_unit.rb +0 -35
- data/test/test_server/lib/test_server/server.rb +0 -112
- data/test/test_server/lib/test_server.rb +0 -5
- data/test/test_server/test/resources/test/foo_test.rb +0 -1
- data/test/test_server/test/server_test.rb +0 -27
- data/test/test_server/test/test_helper.rb +0 -7
- data/test/unit/activities_notifier_test.rb +0 -75
- data/test/unit/activity_observer_test.rb +0 -65
- data/test/unit/activity_test.rb +0 -84
- data/test/unit/cells/user_cell_test.rb +0 -13
- data/test/unit/helpers/admin/base_helper_test.rb +0 -139
- data/test/unit/helpers/base_helper_spec.rb +0 -54
- data/test/unit/helpers/base_helper_test.rb +0 -165
- data/test/unit/helpers/content_helper_test.rb +0 -127
- data/test/unit/helpers/resource_helper_test.rb +0 -180
- data/test/unit/helpers/users_helper_test.rb +0 -52
- data/test/unit/i18n_test.rb +0 -22
- data/test/unit/lib/cells_ext_spec.rb +0 -96
- data/test/unit/lib/extensible_forms_test.rb +0 -362
- data/test/unit/lib/menu_test.rb +0 -119
- data/test/unit/lib/rails_ext/content_for_assignments_test.rb +0 -75
- data/test/unit/lib/rails_ext/plugin_configuration_test.rb +0 -40
- data/test/unit/lib/rails_ext/sticky_changes_test.rb +0 -33
- data/test/unit/lib/registry_test.rb +0 -91
- data/test/unit/lib/routing_filter/routing_filter_categories_spec.rb +0 -63
- data/test/unit/lib/routing_filter/routing_filter_categories_test.rb +0 -159
- data/test/unit/lib/routing_filter/routing_filter_locale_spec.rb +0 -73
- data/test/unit/lib/routing_filter/routing_filter_root_blog_archive_spec.rb +0 -40
- data/test/unit/lib/routing_filter/routing_filter_root_section_articles_spec.rb +0 -48
- data/test/unit/lib/routing_filter/routing_filter_root_wikipages_spec.rb +0 -40
- data/test/unit/lib/routing_filter/routing_filter_sections_spec.rb +0 -143
- data/test/unit/lib/routing_filter/routing_filter_sections_test.rb +0 -32
- data/test/unit/lib/routing_filter/routing_filter_sets_test.rb +0 -86
- data/test/unit/models/account_test.rb +0 -21
- data/test/unit/models/anonymous_test.rb +0 -54
- data/test/unit/models/article_test.rb +0 -191
- data/test/unit/models/category_test.rb +0 -68
- data/test/unit/models/content_test.rb +0 -409
- data/test/unit/models/counter_test.rb +0 -43
- data/test/unit/models/event_test.rb +0 -41
- data/test/unit/models/nested_categories_test.rb +0 -34
- data/test/unit/models/page_test.rb +0 -63
- data/test/unit/models/password_mailer_test.rb +0 -26
- data/test/unit/models/section_test.rb +0 -315
- data/test/unit/models/site_test.rb +0 -199
- data/test/unit/models/user_mailer_test.rb +0 -16
- data/test/unit/models/user_test.rb +0 -173
- data/test/unit/observers/activities_article_observer_test.rb +0 -42
- data/test/webrat/.document +0 -4
- data/test/webrat/History.txt +0 -264
- data/test/webrat/MIT-LICENSE.txt +0 -19
- data/test/webrat/README.rdoc +0 -85
- data/test/webrat/Rakefile +0 -151
- data/test/webrat/install.rb +0 -1
- data/test/webrat/lib/webrat/core/configuration.rb +0 -89
- data/test/webrat/lib/webrat/core/elements/area.rb +0 -31
- data/test/webrat/lib/webrat/core/elements/element.rb +0 -33
- data/test/webrat/lib/webrat/core/elements/field.rb +0 -396
- data/test/webrat/lib/webrat/core/elements/form.rb +0 -103
- data/test/webrat/lib/webrat/core/elements/label.rb +0 -31
- data/test/webrat/lib/webrat/core/elements/link.rb +0 -90
- data/test/webrat/lib/webrat/core/elements/select_option.rb +0 -35
- data/test/webrat/lib/webrat/core/locators/area_locator.rb +0 -38
- data/test/webrat/lib/webrat/core/locators/button_locator.rb +0 -54
- data/test/webrat/lib/webrat/core/locators/field_by_id_locator.rb +0 -37
- data/test/webrat/lib/webrat/core/locators/field_labeled_locator.rb +0 -56
- data/test/webrat/lib/webrat/core/locators/field_locator.rb +0 -25
- data/test/webrat/lib/webrat/core/locators/field_named_locator.rb +0 -41
- data/test/webrat/lib/webrat/core/locators/form_locator.rb +0 -19
- data/test/webrat/lib/webrat/core/locators/label_locator.rb +0 -34
- data/test/webrat/lib/webrat/core/locators/link_locator.rb +0 -66
- data/test/webrat/lib/webrat/core/locators/locator.rb +0 -20
- data/test/webrat/lib/webrat/core/locators/select_option_locator.rb +0 -59
- data/test/webrat/lib/webrat/core/locators.rb +0 -20
- data/test/webrat/lib/webrat/core/logging.rb +0 -21
- data/test/webrat/lib/webrat/core/matchers/have_content.rb +0 -69
- data/test/webrat/lib/webrat/core/matchers/have_selector.rb +0 -52
- data/test/webrat/lib/webrat/core/matchers/have_tag.rb +0 -71
- data/test/webrat/lib/webrat/core/matchers/have_xpath.rb +0 -93
- data/test/webrat/lib/webrat/core/matchers.rb +0 -4
- data/test/webrat/lib/webrat/core/methods.rb +0 -61
- data/test/webrat/lib/webrat/core/mime.rb +0 -29
- data/test/webrat/lib/webrat/core/save_and_open_page.rb +0 -50
- data/test/webrat/lib/webrat/core/scope.rb +0 -350
- data/test/webrat/lib/webrat/core/session.rb +0 -259
- data/test/webrat/lib/webrat/core/xml/hpricot.rb +0 -19
- data/test/webrat/lib/webrat/core/xml/nokogiri.rb +0 -76
- data/test/webrat/lib/webrat/core/xml/rexml.rb +0 -24
- data/test/webrat/lib/webrat/core/xml.rb +0 -115
- data/test/webrat/lib/webrat/core.rb +0 -14
- data/test/webrat/lib/webrat/core_extensions/blank.rb +0 -58
- data/test/webrat/lib/webrat/core_extensions/deprecate.rb +0 -8
- data/test/webrat/lib/webrat/core_extensions/detect_mapped.rb +0 -12
- data/test/webrat/lib/webrat/core_extensions/hash_with_indifferent_access.rb +0 -131
- data/test/webrat/lib/webrat/core_extensions/meta_class.rb +0 -6
- data/test/webrat/lib/webrat/core_extensions/nil_to_param.rb +0 -5
- data/test/webrat/lib/webrat/mechanize.rb +0 -74
- data/test/webrat/lib/webrat/merb.rb +0 -9
- data/test/webrat/lib/webrat/merb_session.rb +0 -65
- data/test/webrat/lib/webrat/rack.rb +0 -24
- data/test/webrat/lib/webrat/rails.rb +0 -105
- data/test/webrat/lib/webrat/rspec-rails.rb +0 -13
- data/test/webrat/lib/webrat/selenium/location_strategy_javascript/button.js +0 -12
- data/test/webrat/lib/webrat/selenium/location_strategy_javascript/label.js +0 -16
- data/test/webrat/lib/webrat/selenium/location_strategy_javascript/webrat.js +0 -5
- data/test/webrat/lib/webrat/selenium/location_strategy_javascript/webratlink.js +0 -9
- data/test/webrat/lib/webrat/selenium/location_strategy_javascript/webratlinkwithin.js +0 -15
- data/test/webrat/lib/webrat/selenium/location_strategy_javascript/webratselectwithoption.js +0 -5
- data/test/webrat/lib/webrat/selenium/matchers/have_content.rb +0 -66
- data/test/webrat/lib/webrat/selenium/matchers/have_selector.rb +0 -49
- data/test/webrat/lib/webrat/selenium/matchers/have_tag.rb +0 -72
- data/test/webrat/lib/webrat/selenium/matchers/have_xpath.rb +0 -45
- data/test/webrat/lib/webrat/selenium/matchers.rb +0 -4
- data/test/webrat/lib/webrat/selenium/selenium_extensions.js +0 -6
- data/test/webrat/lib/webrat/selenium/selenium_session.rb +0 -237
- data/test/webrat/lib/webrat/selenium.rb +0 -99
- data/test/webrat/lib/webrat/sinatra.rb +0 -30
- data/test/webrat/lib/webrat.rb +0 -34
- data/test/webrat/spec/fakes/test_session.rb +0 -34
- data/test/webrat/spec/integration/merb/.gitignore +0 -21
- data/test/webrat/spec/integration/merb/Rakefile +0 -35
- data/test/webrat/spec/integration/merb/app/controllers/application.rb +0 -2
- data/test/webrat/spec/integration/merb/app/controllers/exceptions.rb +0 -13
- data/test/webrat/spec/integration/merb/app/controllers/testing.rb +0 -18
- data/test/webrat/spec/integration/merb/app/views/exceptions/not_acceptable.html.erb +0 -63
- data/test/webrat/spec/integration/merb/app/views/exceptions/not_found.html.erb +0 -47
- data/test/webrat/spec/integration/merb/app/views/layout/application.html.erb +0 -12
- data/test/webrat/spec/integration/merb/app/views/testing/show_form.html.erb +0 -27
- data/test/webrat/spec/integration/merb/config/environments/development.rb +0 -15
- data/test/webrat/spec/integration/merb/config/environments/rake.rb +0 -11
- data/test/webrat/spec/integration/merb/config/environments/test.rb +0 -14
- data/test/webrat/spec/integration/merb/config/init.rb +0 -25
- data/test/webrat/spec/integration/merb/config/rack.rb +0 -11
- data/test/webrat/spec/integration/merb/config/router.rb +0 -33
- data/test/webrat/spec/integration/merb/spec/spec.opts +0 -1
- data/test/webrat/spec/integration/merb/spec/spec_helper.rb +0 -24
- data/test/webrat/spec/integration/merb/spec/webrat_spec.rb +0 -32
- data/test/webrat/spec/integration/merb/tasks/merb.thor/app_script.rb +0 -31
- data/test/webrat/spec/integration/merb/tasks/merb.thor/common.rb +0 -64
- data/test/webrat/spec/integration/merb/tasks/merb.thor/gem_ext.rb +0 -124
- data/test/webrat/spec/integration/merb/tasks/merb.thor/main.thor +0 -150
- data/test/webrat/spec/integration/merb/tasks/merb.thor/ops.rb +0 -93
- data/test/webrat/spec/integration/merb/tasks/merb.thor/utils.rb +0 -40
- data/test/webrat/spec/integration/rails/.gitignore +0 -3
- data/test/webrat/spec/integration/rails/Rakefile +0 -30
- data/test/webrat/spec/integration/rails/app/controllers/application.rb +0 -15
- data/test/webrat/spec/integration/rails/app/controllers/webrat_controller.rb +0 -35
- data/test/webrat/spec/integration/rails/app/views/webrat/before_redirect_form.html.erb +0 -4
- data/test/webrat/spec/integration/rails/app/views/webrat/form.html.erb +0 -28
- data/test/webrat/spec/integration/rails/config/boot.rb +0 -109
- data/test/webrat/spec/integration/rails/config/environment.rb +0 -12
- data/test/webrat/spec/integration/rails/config/environments/development.rb +0 -17
- data/test/webrat/spec/integration/rails/config/environments/selenium.rb +0 -22
- data/test/webrat/spec/integration/rails/config/environments/test.rb +0 -22
- data/test/webrat/spec/integration/rails/config/initializers/inflections.rb +0 -10
- data/test/webrat/spec/integration/rails/config/initializers/mime_types.rb +0 -5
- data/test/webrat/spec/integration/rails/config/initializers/new_rails_defaults.rb +0 -17
- data/test/webrat/spec/integration/rails/config/locales/en.yml +0 -5
- data/test/webrat/spec/integration/rails/config/routes.rb +0 -13
- data/test/webrat/spec/integration/rails/public/404.html +0 -30
- data/test/webrat/spec/integration/rails/public/422.html +0 -30
- data/test/webrat/spec/integration/rails/public/500.html +0 -33
- data/test/webrat/spec/integration/rails/script/about +0 -4
- data/test/webrat/spec/integration/rails/script/console +0 -3
- data/test/webrat/spec/integration/rails/script/dbconsole +0 -3
- data/test/webrat/spec/integration/rails/script/destroy +0 -3
- data/test/webrat/spec/integration/rails/script/generate +0 -3
- data/test/webrat/spec/integration/rails/script/performance/benchmarker +0 -3
- data/test/webrat/spec/integration/rails/script/performance/profiler +0 -3
- data/test/webrat/spec/integration/rails/script/performance/request +0 -3
- data/test/webrat/spec/integration/rails/script/plugin +0 -3
- data/test/webrat/spec/integration/rails/script/process/inspector +0 -3
- data/test/webrat/spec/integration/rails/script/process/reaper +0 -3
- data/test/webrat/spec/integration/rails/script/process/spawner +0 -3
- data/test/webrat/spec/integration/rails/script/runner +0 -3
- data/test/webrat/spec/integration/rails/script/server +0 -3
- data/test/webrat/spec/integration/rails/test/integration/webrat_test.rb +0 -74
- data/test/webrat/spec/integration/rails/test/test_helper.rb +0 -25
- data/test/webrat/spec/integration/sinatra/Rakefile +0 -5
- data/test/webrat/spec/integration/sinatra/app.rb +0 -64
- data/test/webrat/spec/integration/sinatra/test/test_helper.rb +0 -17
- data/test/webrat/spec/integration/sinatra/test/webrat_test.rb +0 -36
- data/test/webrat/spec/private/core/configuration_spec.rb +0 -99
- data/test/webrat/spec/private/core/field_spec.rb +0 -67
- data/test/webrat/spec/private/core/link_spec.rb +0 -24
- data/test/webrat/spec/private/core/logging_spec.rb +0 -10
- data/test/webrat/spec/private/core/session_spec.rb +0 -207
- data/test/webrat/spec/private/mechanize/mechanize_session_spec.rb +0 -81
- data/test/webrat/spec/private/merb/indifferent_access_spec.rb +0 -47
- data/test/webrat/spec/private/merb/merb_session_spec.rb +0 -42
- data/test/webrat/spec/private/nokogiri_spec.rb +0 -77
- data/test/webrat/spec/private/rails/attaches_file_spec.rb +0 -81
- data/test/webrat/spec/private/rails/rails_session_spec.rb +0 -110
- data/test/webrat/spec/private/selenium/selenium_session_spec.rb +0 -44
- data/test/webrat/spec/private/selenium/selenium_spec.rb +0 -59
- data/test/webrat/spec/private/sinatra/helper.rb +0 -2
- data/test/webrat/spec/private/sinatra/sinatra_session_spec.rb +0 -28
- data/test/webrat/spec/public/basic_auth_spec.rb +0 -24
- data/test/webrat/spec/public/check_spec.rb +0 -154
- data/test/webrat/spec/public/choose_spec.rb +0 -118
- data/test/webrat/spec/public/click_area_spec.rb +0 -106
- data/test/webrat/spec/public/click_button_spec.rb +0 -502
- data/test/webrat/spec/public/click_link_spec.rb +0 -469
- data/test/webrat/spec/public/fill_in_spec.rb +0 -209
- data/test/webrat/spec/public/locators/field_by_xpath_spec.rb +0 -19
- data/test/webrat/spec/public/locators/field_labeled_spec.rb +0 -157
- data/test/webrat/spec/public/locators/field_with_id_spec.rb +0 -16
- data/test/webrat/spec/public/matchers_spec.rb +0 -321
- data/test/webrat/spec/public/reload_spec.rb +0 -10
- data/test/webrat/spec/public/save_and_open_spec.rb +0 -51
- data/test/webrat/spec/public/select_date_spec.rb +0 -88
- data/test/webrat/spec/public/select_datetime_spec.rb +0 -106
- data/test/webrat/spec/public/select_spec.rb +0 -246
- data/test/webrat/spec/public/select_time_spec.rb +0 -79
- data/test/webrat/spec/public/set_hidden_field_spec.rb +0 -5
- data/test/webrat/spec/public/submit_form_spec.rb +0 -5
- data/test/webrat/spec/public/visit_spec.rb +0 -67
- data/test/webrat/spec/public/within_spec.rb +0 -177
- data/test/webrat/spec/rcov.opts +0 -1
- data/test/webrat/spec/spec.opts +0 -2
- data/test/webrat/spec/spec_helper.rb +0 -50
- data/test/webrat/vendor/selenium-server.jar +0 -0
- data/test/with/README.textile +0 -136
- data/test/with/demo.rb +0 -158
- data/test/with/lib/with/call.rb +0 -40
- data/test/with/lib/with/context.rb +0 -95
- data/test/with/lib/with/implementation.rb +0 -18
- data/test/with/lib/with/node.rb +0 -65
- data/test/with/lib/with/sharing.rb +0 -29
- data/test/with/lib/with.rb +0 -81
- data/test/with/test/all.rb +0 -1
- data/test/with/test/context_calls_test.rb +0 -56
- data/test/with/test/context_compile_test.rb +0 -106
- data/test/with/test/context_structure_test.rb +0 -142
- data/test/with/test/demo_test.rb +0 -63
- data/test/with/test/helper.rb +0 -68
- data/test/with-sugar/lib/with-sugar/caching.rb +0 -41
- data/test/with-sugar/lib/with-sugar/controller.rb +0 -110
- data/test/with-sugar/lib/with-sugar/core.rb +0 -7
- data/test/with-sugar/lib/with-sugar/model.rb +0 -151
- data/test/with-sugar/lib/with-sugar/routing.rb +0 -30
- data/test/with-sugar/lib/with-sugar/view.rb +0 -65
- data/test/with-sugar/lib/with-sugar.rb +0 -6
- data/test/with-sugar/test/helper.rb +0 -19
- data/test/with-sugar/test/view_test.rb +0 -12
- data/vendor/gems/authentication/.gitignore +0 -17
- data/vendor/gems/authentication/Gemfile +0 -4
- data/vendor/gems/authentication/LICENSE +0 -22
- data/vendor/gems/authentication/MIT-LICENSE +0 -38
- data/vendor/gems/authentication/README +0 -39
- data/vendor/gems/authentication/README.md +0 -29
- data/vendor/gems/authentication/RUNNING_UNIT_TESTS +0 -13
- data/vendor/gems/authentication/Rakefile +0 -61
- data/vendor/gems/authentication/authentication.gemspec +0 -17
- data/vendor/gems/authentication/lib/authentication/active_record_extensions.rb +0 -11
- data/vendor/gems/authentication/lib/authentication/bogus.rb +0 -13
- data/vendor/gems/authentication/lib/authentication/hash_helper.rb +0 -26
- data/vendor/gems/authentication/lib/authentication/ldap.rb +0 -49
- data/vendor/gems/authentication/lib/authentication/remember_me.rb +0 -52
- data/vendor/gems/authentication/lib/authentication/salted_hash.rb +0 -53
- data/vendor/gems/authentication/lib/authentication/single_token.rb +0 -54
- data/vendor/gems/authentication/lib/authentication/version.rb +0 -3
- data/vendor/gems/authentication/lib/authentication.rb +0 -270
- data/vendor/gems/authentication/lib/radius/dictionary +0 -207
- data/vendor/gems/authentication/test_backup/abstract_unit.rb +0 -30
- data/vendor/gems/authentication/test_backup/active_record_extension_test.rb +0 -17
- data/vendor/gems/authentication/test_backup/authentication_test.rb +0 -231
- data/vendor/gems/authentication/test_backup/database.yml +0 -12
- data/vendor/gems/authentication/test_backup/fixtures/user.rb +0 -3
- data/vendor/gems/authentication/test_backup/fixtures/users.yml +0 -3
- data/vendor/gems/authentication/test_backup/options_test.rb +0 -100
- data/vendor/gems/authentication/test_backup/remember_me_test.rb +0 -41
- data/vendor/gems/authentication/test_backup/salted_hash_test.rb +0 -38
- data/vendor/gems/authentication/test_backup/schema.rb +0 -10
- data/vendor/gems/authentication/test_backup/single_token_test.rb +0 -44
- data/vendor/gems/authentication/test_backup/test_helper.rb +0 -8
- data/vendor/gems/filtered_column/.gitignore +0 -17
- data/vendor/gems/filtered_column/Gemfile +0 -4
- data/vendor/gems/filtered_column/LICENSE +0 -22
- data/vendor/gems/filtered_column/README +0 -4
- data/vendor/gems/filtered_column/README.md +0 -29
- data/vendor/gems/filtered_column/Rakefile +0 -23
- data/vendor/gems/filtered_column/filtered_column.gemspec +0 -17
- data/vendor/gems/filtered_column/lib/filtered_column/filters/base.rb +0 -28
- data/vendor/gems/filtered_column/lib/filtered_column/filters/smartypants_filter.rb +0 -14
- data/vendor/gems/filtered_column/lib/filtered_column/filters/textile_filter.rb +0 -13
- data/vendor/gems/filtered_column/lib/filtered_column/macros/base.rb +0 -25
- data/vendor/gems/filtered_column/lib/filtered_column/mixin.rb +0 -46
- data/vendor/gems/filtered_column/lib/filtered_column/processor.rb +0 -52
- data/vendor/gems/filtered_column/lib/filtered_column/version.rb +0 -3
- data/vendor/gems/filtered_column/lib/filtered_column.rb +0 -17
- data/vendor/gems/filtered_column/tasks/filtered_column_tasks.rake +0 -4
- data/vendor/gems/filtered_column/test/abstract_unit.rb +0 -74
- data/vendor/gems/filtered_column/test/filtered_column_test.rb +0 -53
- data/vendor/gems/filtered_column/test/macro_filter_test.rb +0 -23
- data/vendor/gems/simple_taggable/.gitignore +0 -17
- data/vendor/gems/simple_taggable/Gemfile +0 -7
- data/vendor/gems/simple_taggable/LICENSE +0 -22
- data/vendor/gems/simple_taggable/README +0 -24
- data/vendor/gems/simple_taggable/README.md +0 -29
- data/vendor/gems/simple_taggable/Rakefile +0 -2
- data/vendor/gems/simple_taggable/lib/simple_taggable/version.rb +0 -3
- data/vendor/gems/simple_taggable/lib/simple_taggable.rb +0 -163
- data/vendor/gems/simple_taggable/lib/tag.rb +0 -31
- data/vendor/gems/simple_taggable/lib/tag_list.rb +0 -104
- data/vendor/gems/simple_taggable/lib/tagging.rb +0 -8
- data/vendor/gems/simple_taggable/simple_taggable.gemspec +0 -19
- data/vendor/gems/simple_taggable/test/db/schema.rb +0 -41
- data/vendor/gems/simple_taggable/test/db/simple_taggable.sqlite3.db +0 -0
- data/vendor/gems/simple_taggable/test/fixtures/magazine.rb +0 -3
- data/vendor/gems/simple_taggable/test/fixtures/magazines.yml +0 -2
- data/vendor/gems/simple_taggable/test/fixtures/photo.rb +0 -8
- data/vendor/gems/simple_taggable/test/fixtures/photos.yml +0 -19
- data/vendor/gems/simple_taggable/test/fixtures/post.rb +0 -5
- data/vendor/gems/simple_taggable/test/fixtures/posts.yml +0 -27
- data/vendor/gems/simple_taggable/test/fixtures/subscription.rb +0 -4
- data/vendor/gems/simple_taggable/test/fixtures/subscriptions.yml +0 -3
- data/vendor/gems/simple_taggable/test/fixtures/taggings.yml +0 -112
- data/vendor/gems/simple_taggable/test/fixtures/tags.yml +0 -14
- data/vendor/gems/simple_taggable/test/fixtures/user.rb +0 -6
- data/vendor/gems/simple_taggable/test/fixtures/users.yml +0 -5
- data/vendor/gems/simple_taggable/test/log/simple_taggable.log +0 -1614
- data/vendor/gems/simple_taggable/test/simple_taggable_test.rb +0 -253
- data/vendor/gems/simple_taggable/test/tag_list_test.rb +0 -123
- data/vendor/gems/simple_taggable/test/test_helper.rb +0 -80
- data/vendor/gems/table_builder/test/table_builder/table_test.rb +0 -230
- data/vendor/gems/table_builder/test/test_helper.rb +0 -49
- data/vendor/gems/tags/test/tags/menu_test.rb +0 -173
- data/vendor/gems/tags/test/tags/tag_test.rb +0 -13
- data/vendor/gems/tags/test/test_helper.rb +0 -18
- /data/{test → spec}/fixtures/templates/alternative_templates/index.html.erb +0 -0
- /data/{test → spec}/fixtures/templates/context_templates_test/index.html.erb +0 -0
- /data/{test → spec}/fixtures/templates/context_templates_test/show.html.erb +0 -0
- /data/{test → spec}/fixtures/templates/layouts/alternative.html.erb +0 -0
- /data/{test → spec}/fixtures/templates/layouts/default.html.erb +0 -0
- /data/{test → spec}/javascript/assets/jquery-lowpro.js +0 -0
- /data/{test → spec}/javascript/assets/jquery-ui.js +0 -0
- /data/{test → spec}/javascript/assets/jquery.js +0 -0
- /data/{test → spec}/javascript/assets/testrunner.js +0 -0
- /data/{test → spec}/javascript/assets/testsuite.scss +0 -0
- /data/vendor/gems/table_builder/{test → spec/support}/fixtures/templates/table_auto_body.html.erb +0 -0
- /data/vendor/gems/table_builder/{test → spec/support}/fixtures/templates/table_auto_columns.html.erb +0 -0
data/test/rr/README.rdoc
DELETED
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
= RR
|
|
2
|
-
|
|
3
|
-
RR (Double Ruby) is a test double framework that features a rich
|
|
4
|
-
selection of double techniques and a terse syntax.
|
|
5
|
-
|
|
6
|
-
== More Information
|
|
7
|
-
=== Mailing Lists
|
|
8
|
-
* double-ruby-users@rubyforge.org
|
|
9
|
-
* double-ruby-devel@rubyforge.org
|
|
10
|
-
|
|
11
|
-
=== Websites
|
|
12
|
-
* http://rubyforge.org/projects/double-ruby
|
|
13
|
-
* http://github.com/btakita/rr
|
|
14
|
-
|
|
15
|
-
== What is a Test Double?
|
|
16
|
-
A Test Double is a generalization of something that replaces a real
|
|
17
|
-
object to make it easier to test another object. Its like a stunt
|
|
18
|
-
double for tests. The following are test doubles:
|
|
19
|
-
* Mocks
|
|
20
|
-
* Stubs
|
|
21
|
-
* Fakes
|
|
22
|
-
* Spies
|
|
23
|
-
* Proxies
|
|
24
|
-
http://xunitpatterns.com/Test%20Double.html
|
|
25
|
-
|
|
26
|
-
Currently RR implements mocks, stubs, and proxies. In the future, RR will
|
|
27
|
-
support spies.
|
|
28
|
-
|
|
29
|
-
== Using RR
|
|
30
|
-
=== test/unit
|
|
31
|
-
class Test::Unit::TestCase
|
|
32
|
-
include RR::Adapters::TestUnit
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
=== rspec
|
|
36
|
-
Spec::Runners.configure do |config|
|
|
37
|
-
config.mock_with :rr
|
|
38
|
-
# or if that doesn't work due to a version incompatibility
|
|
39
|
-
# config.mock_with RR::Adapters::Rspec
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
== Syntax between RR and other double/mock frameworks
|
|
43
|
-
=== Terse Syntax
|
|
44
|
-
One of the goals of RR is to make doubles more scannable.
|
|
45
|
-
This is accomplished by making the double declaration look as much as the actual method invocation as possible.
|
|
46
|
-
Here is RR compared to other mock frameworks:
|
|
47
|
-
|
|
48
|
-
flexmock(User).should_receive(:find).with('42').and_return(jane) # Flexmock
|
|
49
|
-
User.should_receive(:find).with('42').and_return(jane) # Rspec
|
|
50
|
-
User.expects(:find).with('42').returns {jane} # Mocha
|
|
51
|
-
User.should_receive(:find).with('42') {jane} # Rspec using return value blocks
|
|
52
|
-
mock(User).find('42') {jane} # RR
|
|
53
|
-
|
|
54
|
-
=== Double Injections (a.k.a Partial Mocking)
|
|
55
|
-
RR utilizes a technique known as "double injection".
|
|
56
|
-
|
|
57
|
-
my_object = MyClass.new
|
|
58
|
-
mock(my_object).hello
|
|
59
|
-
|
|
60
|
-
Compare this with doing a mock in mocha:
|
|
61
|
-
my_mocked_object = mock()
|
|
62
|
-
my_mocked_object.expects(:hello)
|
|
63
|
-
|
|
64
|
-
== Pure Mock objects
|
|
65
|
-
If you wish to use objects for the sole purpose of being a mock, you can
|
|
66
|
-
do so by creating an empty object.
|
|
67
|
-
mock(my_mock_object = Object.new).hello
|
|
68
|
-
|
|
69
|
-
or by using mock!
|
|
70
|
-
my_mock_object = mock!.hello.subject # Mocks the #hello method and retrieves that object via the #subject method
|
|
71
|
-
|
|
72
|
-
=== No should_receive or expects method
|
|
73
|
-
RR uses method_missing to set your method expectation. This means you do not
|
|
74
|
-
need to use a method such as should_receive or expects.
|
|
75
|
-
|
|
76
|
-
mock(my_object).hello # The hello method on my_object is mocked
|
|
77
|
-
|
|
78
|
-
Mocha:
|
|
79
|
-
my_object.expects(:hello) # expects sets the hello method expectation
|
|
80
|
-
Rspec mocks:
|
|
81
|
-
my_object.should_receive(:hello) # should_receive sets the hello method expectation
|
|
82
|
-
|
|
83
|
-
=== with method call is not necessary
|
|
84
|
-
Since RR uses method_missing, it also makes using the #with method unnecessary in most circumstances
|
|
85
|
-
to set the argument expectations.
|
|
86
|
-
|
|
87
|
-
mock(my_object).hello('bob', 'jane')
|
|
88
|
-
|
|
89
|
-
Mocha:
|
|
90
|
-
my_object.expects(:hello).with('bob', 'jane')
|
|
91
|
-
Rspec mocks:
|
|
92
|
-
my_object.should_receive(:hello).with('bob', 'jane')
|
|
93
|
-
|
|
94
|
-
=== using a block to set the return value
|
|
95
|
-
RR supports using a block to set the return value. RR also has the #returns method.
|
|
96
|
-
Both of the examples are equivalent.
|
|
97
|
-
|
|
98
|
-
mock(my_object).hello('bob', 'jane') {'Hello Bob and Jane'}
|
|
99
|
-
mock(my_object).hello('bob', 'jane').returns('Hello Bob and Jane')
|
|
100
|
-
|
|
101
|
-
Mocha:
|
|
102
|
-
my_object.expects(:hello).with('bob', 'jane').returns('Hello Bob and Jane')
|
|
103
|
-
Rspec mocks:
|
|
104
|
-
my_object.should_receive(:hello).with('bob', 'jane').and_return('Hello Bob and Jane')
|
|
105
|
-
my_object.should_receive(:hello).with('bob', 'jane') {'Hello Bob and Jane'} #rspec also supports blocks for the return value
|
|
106
|
-
|
|
107
|
-
== Using RR
|
|
108
|
-
To create a double on an object, you can use the following methods:
|
|
109
|
-
* mock or mock!
|
|
110
|
-
* stub or stub!
|
|
111
|
-
* dont_allow or dont_allow!
|
|
112
|
-
* proxy or proxy!
|
|
113
|
-
* instance_of or instance_of!
|
|
114
|
-
|
|
115
|
-
These methods are composable. mock, stub, and dont_allow can be used by themselves and
|
|
116
|
-
are mutually exclusive.
|
|
117
|
-
proxy and instance_of must be chained with mock or stub. You can also chain
|
|
118
|
-
proxy and instance_of together.
|
|
119
|
-
|
|
120
|
-
The ! (bang) version of these methods causes the subject object of the Double to be instantiated.
|
|
121
|
-
|
|
122
|
-
=== mock
|
|
123
|
-
mock replaces the method on the object with an expectation and implementation.
|
|
124
|
-
The expectations are a mock will be called with certain arguments a certain
|
|
125
|
-
number of times (the default is once). You can also set the return value
|
|
126
|
-
of the method invocation.
|
|
127
|
-
|
|
128
|
-
See http://xunitpatterns.com/Mock%20Object.html
|
|
129
|
-
|
|
130
|
-
The following example sets an expectation that the view will receive a method
|
|
131
|
-
call to #render with the arguments {:partial => "user_info"} once.
|
|
132
|
-
When the method is called "Information" is returned.
|
|
133
|
-
view = controller.template
|
|
134
|
-
mock(view).render(:partial => "user_info") {"Information"}
|
|
135
|
-
|
|
136
|
-
=== stub
|
|
137
|
-
stub replaces the method on the object with only an implementation. You
|
|
138
|
-
can still use arguments to differentiate which stub gets invoked.
|
|
139
|
-
|
|
140
|
-
See http://xunitpatterns.com/Test%20Stub.html
|
|
141
|
-
|
|
142
|
-
The following example makes the User.find method return jane when passed
|
|
143
|
-
'42' and returns bob when passed '99'. If another id is passed to User.find,
|
|
144
|
-
an exception is raised.
|
|
145
|
-
jane = User.new
|
|
146
|
-
bob = User.new
|
|
147
|
-
stub(User).find('42') {jane}
|
|
148
|
-
stub(User).find('99') {bob}
|
|
149
|
-
stub(User).find do |id|
|
|
150
|
-
raise "Unexpected id #{id.inspect} passed to me"
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
=== dont_allow - aliased with do_not_allow, dont_call, and do_not_call
|
|
154
|
-
dont_allow sets an expectation on the Double that it will never be called.
|
|
155
|
-
If the Double is called, then a TimesCalledError is raised.
|
|
156
|
-
dont_allow(User).find('42')
|
|
157
|
-
User.find('42') # raises a TimesCalledError
|
|
158
|
-
|
|
159
|
-
=== mock.proxy
|
|
160
|
-
mock.proxy replaces the method on the object with an expectation, implementation, and
|
|
161
|
-
also invokes the actual method. mock.proxy also intercepts the return value and
|
|
162
|
-
passes it into the return value block.
|
|
163
|
-
|
|
164
|
-
The following example makes sets an expectation that view.render({:partial => "right_navigation"})
|
|
165
|
-
gets called once and return the actual content of the rendered partial template.
|
|
166
|
-
A call to view.render({:partial => "user_info"}) will render the user_info
|
|
167
|
-
partial template and send the content into the block and is represented by the html variable.
|
|
168
|
-
An assertion is done on the html and "Different html" is returned.
|
|
169
|
-
view = controller.template
|
|
170
|
-
mock.proxy(view).render(:partial => "right_navigation")
|
|
171
|
-
mock.proxy(view).render(:partial => "user_info") do |html|
|
|
172
|
-
html.should include("John Doe")
|
|
173
|
-
"Different html"
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
You can also use mock.proxy to set expectations on the returned value. In
|
|
177
|
-
the following example, a call to User.find('5') does the normal ActiveRecord
|
|
178
|
-
implementation and passes the actual value, represented by the variable bob,
|
|
179
|
-
into the block. bob is then set with a mock.proxy for projects to return
|
|
180
|
-
only the first 3 projects. bob is also mocked with valid? to return false.
|
|
181
|
-
mock.proxy(User).find('5') do |bob|
|
|
182
|
-
mock.proxy(bob).projects do |projects|
|
|
183
|
-
projects[0..3]
|
|
184
|
-
end
|
|
185
|
-
mock(bob).valid? {false}
|
|
186
|
-
bob
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
=== stub.proxy
|
|
190
|
-
Intercept the return value of a method call.
|
|
191
|
-
The following example verifies render partial will be called and
|
|
192
|
-
renders the partial.
|
|
193
|
-
|
|
194
|
-
view = controller.template
|
|
195
|
-
stub.proxy(view).render(:partial => "user_info") do |html|
|
|
196
|
-
html.should include("Joe Smith")
|
|
197
|
-
html
|
|
198
|
-
end
|
|
199
|
-
|
|
200
|
-
=== instance_of
|
|
201
|
-
Put double scenarios on instances of a Class.
|
|
202
|
-
|
|
203
|
-
mock.instance_of(User).valid? {false}
|
|
204
|
-
|
|
205
|
-
=== Block Syntax
|
|
206
|
-
The block syntax has two modes
|
|
207
|
-
* A normal block mode with a DoubleDefinitionCreatorProxy argument
|
|
208
|
-
|
|
209
|
-
script = MyScript.new
|
|
210
|
-
mock(script) do |expect|
|
|
211
|
-
expect.system("cd #{RAILS_ENV}") {true}
|
|
212
|
-
expect.system("rake foo:bar") {true}
|
|
213
|
-
expect.system("rake baz") {true}
|
|
214
|
-
end
|
|
215
|
-
|
|
216
|
-
* An instance_eval mode where the DoubleDefinitionCreatorProxy is instance_evaled
|
|
217
|
-
|
|
218
|
-
script = MyScript.new
|
|
219
|
-
mock(script) do
|
|
220
|
-
system("cd #{RAILS_ENV}") {true}
|
|
221
|
-
system("rake foo:bar") {true}
|
|
222
|
-
system("rake baz") {true}
|
|
223
|
-
end
|
|
224
|
-
|
|
225
|
-
=== Block Syntax with explicit DoubleDefinitionCreatorProxy argument
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
=== Double Graphs
|
|
229
|
-
RR has a method-chaining api support for Double graphs. For example,
|
|
230
|
-
lets say you want an object to receive a method call to #foo, and have
|
|
231
|
-
the return value receive a method call to #bar.
|
|
232
|
-
|
|
233
|
-
In RR, you would do:
|
|
234
|
-
stub(object).foo.stub!.bar {:baz}
|
|
235
|
-
object.foo.bar # :baz
|
|
236
|
-
# or
|
|
237
|
-
stub(object).foo {stub!.bar {:baz}}
|
|
238
|
-
object.foo.bar # :baz
|
|
239
|
-
# or
|
|
240
|
-
bar = stub!.bar {:baz}
|
|
241
|
-
stub(object).foo {bar}
|
|
242
|
-
object.foo.bar # :baz
|
|
243
|
-
|
|
244
|
-
=== Argument Wildcard matchers
|
|
245
|
-
==== anything
|
|
246
|
-
mock(object).foobar(1, anything)
|
|
247
|
-
object.foobar(1, :my_symbol)
|
|
248
|
-
|
|
249
|
-
==== is_a
|
|
250
|
-
mock(object).foobar(is_a(Time))
|
|
251
|
-
object.foobar(Time.now)
|
|
252
|
-
|
|
253
|
-
==== numeric
|
|
254
|
-
mock(object).foobar(numeric)
|
|
255
|
-
object.foobar(99)
|
|
256
|
-
|
|
257
|
-
==== boolean
|
|
258
|
-
mock(object).foobar(boolean)
|
|
259
|
-
object.foobar(false)
|
|
260
|
-
|
|
261
|
-
==== duck_type
|
|
262
|
-
mock(object).foobar(duck_type(:walk, :talk))
|
|
263
|
-
arg = Object.new
|
|
264
|
-
def arg.walk; 'waddle'; end
|
|
265
|
-
def arg.talk; 'quack'; end
|
|
266
|
-
object.foobar(arg)
|
|
267
|
-
|
|
268
|
-
==== Ranges
|
|
269
|
-
mock(object).foobar(1..10)
|
|
270
|
-
object.foobar(5)
|
|
271
|
-
|
|
272
|
-
==== Regexps
|
|
273
|
-
mock(object).foobar(/on/)
|
|
274
|
-
object.foobar("ruby on rails")
|
|
275
|
-
|
|
276
|
-
==== hash_including
|
|
277
|
-
mock(object).foobar(hash_including(:red => "#FF0000", :blue => "#0000FF"))
|
|
278
|
-
object.foobar({:red => "#FF0000", :blue => "#0000FF", :green => "#00FF00"})
|
|
279
|
-
|
|
280
|
-
==== satisfy
|
|
281
|
-
mock(object).foobar(satisfy {|arg| arg.length == 2})
|
|
282
|
-
object.foobar("xy")
|
|
283
|
-
|
|
284
|
-
=== Invocation Amount Wildcard Matchers
|
|
285
|
-
==== any_times
|
|
286
|
-
mock(object).method_name(anything).times(any_times) {return_value}
|
|
287
|
-
|
|
288
|
-
== Special Thanks To
|
|
289
|
-
With any development effort, there are countless people who have contributed
|
|
290
|
-
to making it possible. We all are standing on the shoulders of giants.
|
|
291
|
-
* Aslak Hellesoy for Developing Rspec
|
|
292
|
-
* Dan North for syntax ideas
|
|
293
|
-
* Dave Astels for some BDD inspiration
|
|
294
|
-
* David Chelimsky for encouragement to make the RR framework, for developing the Rspec mock framework, and syntax ideas
|
|
295
|
-
* Felix Morio for pairing with me
|
|
296
|
-
* Gerard Meszaros for his excellent book "xUnit Test Patterns"
|
|
297
|
-
* James Mead for developing Mocha
|
|
298
|
-
* Joe Ferris for patches
|
|
299
|
-
* Jeff Whitmire for documentation suggestions
|
|
300
|
-
* Jim Weirich for developing Flexmock, the first Terse ruby mock framework in Ruby
|
|
301
|
-
* Joe Ferris for patches
|
|
302
|
-
* Matthew O'Conner for patches
|
|
303
|
-
* Michael Niessner for patches and pairing with me
|
|
304
|
-
* Mike Mangino (from Elevated Rails) for patches and pairing with me
|
|
305
|
-
* Nick Kallen for documentation suggestions, bug reports, and patches
|
|
306
|
-
* Nathan Sobo for various ideas and inspiration for cleaner and more expressive code
|
|
307
|
-
* Parker Thompson for pairing with me
|
|
308
|
-
* Pivotal Labs for sponsoring RR development
|
|
309
|
-
* Stephen Baker for Developing Rspec
|
data/test/rr/Rakefile
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
require "rake"
|
|
2
|
-
require 'rake/gempackagetask'
|
|
3
|
-
require 'rake/contrib/rubyforgepublisher'
|
|
4
|
-
require 'rake/clean'
|
|
5
|
-
require 'rake/testtask'
|
|
6
|
-
require 'rake/rdoctask'
|
|
7
|
-
|
|
8
|
-
desc "Runs the Rspec suite"
|
|
9
|
-
task(:default) do
|
|
10
|
-
run_suite
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
desc "Runs the Rspec suite"
|
|
14
|
-
task(:spec) do
|
|
15
|
-
run_suite
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
desc "Copies the trunk to a tag with the name of the current release"
|
|
19
|
-
task(:tag_release) do
|
|
20
|
-
tag_release
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def run_suite
|
|
24
|
-
dir = File.dirname(__FILE__)
|
|
25
|
-
system("ruby #{dir}/spec/spec_suite.rb") || raise("Spec Suite failed")
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
PKG_NAME = "rr"
|
|
29
|
-
PKG_VERSION = "0.6.2"
|
|
30
|
-
PKG_FILES = FileList[
|
|
31
|
-
'[A-Z]*',
|
|
32
|
-
'*.rb',
|
|
33
|
-
'lib/**/*.rb',
|
|
34
|
-
'spec/**/*.rb'
|
|
35
|
-
]
|
|
36
|
-
|
|
37
|
-
spec = Gem::Specification.new do |s|
|
|
38
|
-
s.name = PKG_NAME
|
|
39
|
-
s.version = PKG_VERSION
|
|
40
|
-
s.summary = "RR (Double Ruby) is a double framework that features a rich " <<
|
|
41
|
-
"selection of double techniques and a terse syntax. " <<
|
|
42
|
-
"http://xunitpatterns.com/Test%20Double.html"
|
|
43
|
-
s.test_files = "spec/spec_suite.rb"
|
|
44
|
-
s.description = s.summary
|
|
45
|
-
|
|
46
|
-
s.files = PKG_FILES.to_a
|
|
47
|
-
s.require_path = 'lib'
|
|
48
|
-
|
|
49
|
-
s.has_rdoc = true
|
|
50
|
-
s.extra_rdoc_files = [ "README.rdoc", "CHANGES" ]
|
|
51
|
-
s.rdoc_options = ["--main", "README.rdoc", "--inline-source", "--line-numbers"]
|
|
52
|
-
|
|
53
|
-
s.test_files = Dir.glob('spec/*_spec.rb')
|
|
54
|
-
s.require_path = 'lib'
|
|
55
|
-
s.author = "Brian Takita"
|
|
56
|
-
s.email = "brian@pivotallabs.com"
|
|
57
|
-
s.homepage = "http://pivotallabs.com"
|
|
58
|
-
s.rubyforge_project = "pivotalrb"
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
Rake::GemPackageTask.new(spec) do |pkg|
|
|
62
|
-
pkg.need_zip = true
|
|
63
|
-
pkg.need_tar = true
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def tag_release
|
|
67
|
-
dashed_version = PKG_VERSION.gsub('.', '-')
|
|
68
|
-
svn_user = "#{ENV["SVN_USER"]}@" || ""
|
|
69
|
-
`svn cp svn+ssh://#{svn_user}rubyforge.org/var/svn/pivotalrb/rr/trunk svn+ssh://#{svn_user}rubyforge.org/var/svn/pivotalrb/rr/tags/REL-#{dashed_version} -m 'Version #{PKG_VERSION}'`
|
|
70
|
-
end
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
I'm pleased to announce the 0.6.0 version of RR. The [changes](http://github.com/btakita/rr/tree/master%2FCHANGES?raw=true) include:
|
|
2
|
-
|
|
3
|
-
* Declaring Double subject objects without having to pass it in via the mock!, stub!, dont_allow!, instance_of!, and proxy! methods
|
|
4
|
-
* Revised Double chaining API
|
|
5
|
-
* satisfy matcher
|
|
6
|
-
* hash_including matcher
|
|
7
|
-
|
|
8
|
-
# Declaring Double Subjects (The bang methods)
|
|
9
|
-
|
|
10
|
-
In previous versions of RR, you always needed to pass in the subject of the double. For example:
|
|
11
|
-
|
|
12
|
-
subject = Object.new
|
|
13
|
-
mock(subject).does_something {:and_returns_me}
|
|
14
|
-
subject.does_something # :and_returns_me
|
|
15
|
-
|
|
16
|
-
Now you can have RR automatically create the subject object for you by using the ! method:
|
|
17
|
-
|
|
18
|
-
subject = mock!.does_something {:and_returns_me}.subject
|
|
19
|
-
subject.does_something # :and_returns_me
|
|
20
|
-
|
|
21
|
-
Now the bang methods by themselves don't really add a whole lot, but when used in the context of Double chaining, they become a powerful addition.
|
|
22
|
-
|
|
23
|
-
# Double Chaining
|
|
24
|
-
|
|
25
|
-
Nick Kallen presented the use case for Double chaining and contributed a patch for the 0.5.0 release of RR. It has proved useful and is now more fully incorporated into RR. Now you can pass in your subject or use the subject provided by RR by using the ! method. Here are some examples of Double Chaining:
|
|
26
|
-
|
|
27
|
-
mock(subject).first(1) {mock(Object.new).second(2) {mock(Object.new).third(3) {4}}}
|
|
28
|
-
subject.first(1).second(2).third(3) # 4
|
|
29
|
-
|
|
30
|
-
mock(subject).first(1) {mock!.second(2) {mock!.third(3) {4}}}
|
|
31
|
-
subject.first(1).second(2).third(3) # 4
|
|
32
|
-
|
|
33
|
-
mock(subject).first(1).mock!.second(2).mock!.third(3) {4}
|
|
34
|
-
subject.first(1).second(2).third(3) # 4
|
|
35
|
-
|
|
36
|
-
Of course you have access to the proxy facilities:
|
|
37
|
-
|
|
38
|
-
mock.proxy(User).find('1').mock.proxy!.children.mock.proxy!.find_all_by_group_id(10)
|
|
39
|
-
User.find('1').children.find_all_by_group_id(10) # Makes verifications pass and returns the actual children
|
|
40
|
-
|
|
41
|
-
You can also do branched Double chaining:
|
|
42
|
-
|
|
43
|
-
mock(subject).first do
|
|
44
|
-
mock! do |expect|
|
|
45
|
-
expect.branch1.mock!.branch11 {11} # or expect.branch1 {mock!.branch11 {11}}
|
|
46
|
-
expect.branch2.mock!.branch22 {22} # or expect.branch2 {mock!.branch22 {22}}
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
o = subject.first
|
|
50
|
-
o.branch1.branch11 # 11
|
|
51
|
-
o.branch2.branch22 # 22
|
|
52
|
-
|
|
53
|
-
# Satisfy Matcher
|
|
54
|
-
|
|
55
|
-
Matthew O'Conner submitted a patch that added the satisfy matcher. This adds the ability to add arbitrary argument expectation matchers.
|
|
56
|
-
|
|
57
|
-
mock(object).foobar(satisfy {|arg| arg.length == 2})
|
|
58
|
-
object.foobar("xy")
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
# Hash Including Matcher
|
|
62
|
-
|
|
63
|
-
Matthew O'Conner also submitted a patch that added the hash_including matcher. This adds a convenient way to assert that the passed-in hash includes certain key/value pairs.
|
|
64
|
-
|
|
65
|
-
mock(object).foobar(hash_including(:red => "#FF0000", :blue => "#0000FF"))
|
|
66
|
-
object.foobar({:red => "#FF0000", :blue => "#0000FF", :green => "#00FF00"})
|
|
67
|
-
|
|
68
|
-
# Mailing list
|
|
69
|
-
|
|
70
|
-
RR has a mailing lists at:
|
|
71
|
-
|
|
72
|
-
* [double-ruby-users@rubyforge.org](mailto:double-ruby-users@rubyforge.org)
|
|
73
|
-
* [double-ruby-devel@rubyforge.org](mailto:double-ruby-devel@rubyforge.org)
|
|
74
|
-
|
|
75
|
-
Also, RR's rubyforge page is at [http://rubyforge.org/projects/double-ruby](http://rubyforge.org/projects/double-ruby) and of course the github page is at [http://github.com/btakita/rr](http://github.com/btakita/rr).
|
|
76
|
-
|
|
77
|
-
# Yes, and there is more to come
|
|
78
|
-
|
|
79
|
-
There are many interesting ideas floating around. Joseph Wilk has been playing around with [adding Spies](http://github.com/JoeSniff/rr) into RR. I'm also thinking about adding Double validation scoping into RR. Also, I'm impressed by Mocha's warning of unused stubs. Josh Susser also proposed having a mode where a warning would occur if a mocked method is not implemented on the subject being mocked.
|
|
80
|
-
|
|
81
|
-
If you have any feature requests, please send an email to the mailing list or add it to the rubyforge tracker.
|
data/test/rr/introducting_rr.txt
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
**Introducting RR**
|
|
2
|
-
|
|
3
|
-
I'm pleased to introduce a new Test Double framework names RR, which is short for Double Ruby.
|
|
4
|
-
A Test Double is [double description]. You can read more about test doubles at http://xunitpatterns.com/Test%20Double.html.
|
|
5
|
-
|
|
6
|
-
RR supports the following constructs:
|
|
7
|
-
* Mock
|
|
8
|
-
* Stub
|
|
9
|
-
* instance_of
|
|
10
|
-
* Probe
|
|
11
|
-
|
|
12
|
-
**Mock**
|
|
13
|
-
<pre>
|
|
14
|
-
real_user = User.new
|
|
15
|
-
mock(User).find('2') {real_user}
|
|
16
|
-
</pre>
|
|
17
|
-
|
|
18
|
-
The previous example overrides the User.find method and returns real_user. It also sets an expectation
|
|
19
|
-
that the find method will receive the argument '2' once.
|
|
20
|
-
|
|
21
|
-
**Stub**
|
|
22
|
-
<pre>
|
|
23
|
-
user = User.new
|
|
24
|
-
my_article = articles(:my_article)
|
|
25
|
-
stub(user).can_edit?(my_article) {true}
|
|
26
|
-
</pre>
|
|
27
|
-
|
|
28
|
-
The previous example overrides can_edit?. When the method receives the article, it returns true.
|
|
29
|
-
|
|
30
|
-
**instance_of**
|
|
31
|
-
You can mock or stub instances of a class.
|
|
32
|
-
<pre>
|
|
33
|
-
stub.instance_of(User).can_edit?(my_article) {true}
|
|
34
|
-
</pre>
|
|
35
|
-
|
|
36
|
-
The previous example stubs the can_edit? method of any intstance of User.
|
|
37
|
-
|
|
38
|
-
**Probe**
|
|
39
|
-
|
|
40
|
-
A probe is a test double strategy that lets the real method implementation be called, and allows you
|
|
41
|
-
to intercept the return value, and possibly inject you own replacement return value.
|
|
42
|
-
<pre>
|
|
43
|
-
my_article = articles(:my_article)
|
|
44
|
-
mock.probe(User).find('2') do |real_user|
|
|
45
|
-
stub.probe(real_user).can_edit?(my_article) {true}
|
|
46
|
-
real_user
|
|
47
|
-
end
|
|
48
|
-
</pre>
|
|
49
|
-
|
|
50
|
-
The previous example, lets the real User.find method call happen, and intercepts its return value inside
|
|
51
|
-
of the block.
|
|
52
|
-
|
|
53
|
-
The real_user's can_edit? method is then stubbed and probed to return true.
|
|
54
|
-
|
|
55
|
-
**Thats nice, how is it useful?**
|
|
56
|
-
|
|
57
|
-
As with any tool, Mocks and Stubs have limitations.
|
|
58
|
-
For example, mocks alone do not verify that the mocked out method conforms to the real object's interface.
|
|
59
|
-
Probes solve this issue.
|
|
60
|
-
|
|
61
|
-
Adding a probe ensures that:
|
|
62
|
-
* The method call to User.find is valid
|
|
63
|
-
* The return value of User.find is available to validate and/or add test doubles to
|
|
64
|
-
* The method call to real_user.can_edit? is valid
|
|
65
|
-
|
|
66
|
-
**I don't use Mocks. Why should I care?**
|
|
67
|
-
|
|
68
|
-
State based testing is often the simplest and most straightforward way to make assertions.
|
|
69
|
-
However Interaction assertions can serve as good documentation of how your system fits together.
|
|
70
|
-
Interaction tests can also aid you in making your tests easier to set up and removing coupling between tests.
|
|
71
|
-
|
|
72
|
-
Lets compare the state and interaction testing approaches in the can edit article example for the
|
|
73
|
-
ArticlesController#edit action:
|
|
74
|
-
|
|
75
|
-
**State Based Example**
|
|
76
|
-
<pre>
|
|
77
|
-
user = users(:bob)
|
|
78
|
-
login(user)
|
|
79
|
-
my_article = articles(:my_article)
|
|
80
|
-
user.can_edit?(my_article).should == false
|
|
81
|
-
|
|
82
|
-
lambda do
|
|
83
|
-
post :edit, :id => my_article.id, :body => "Hello everybody"
|
|
84
|
-
end.should raise_error(SecurityTrangressionError)
|
|
85
|
-
</pre>
|
|
86
|
-
|
|
87
|
-
**Interaction Based Example**
|
|
88
|
-
<pre>
|
|
89
|
-
user = users(:bob)
|
|
90
|
-
login(user)
|
|
91
|
-
my_article = articles(:my_article)
|
|
92
|
-
mock.probe(user).can_edit? {false}
|
|
93
|
-
|
|
94
|
-
lambda do
|
|
95
|
-
post :edit, :id => my_article.id, :body => "Hello everybody"
|
|
96
|
-
end.should raise_error(SecurityTrangressionError)
|
|
97
|
-
</pre>
|
|
98
|
-
|
|
99
|
-
These two examples are interesting because they verify slight different things.
|
|
100
|
-
The interaction example states that when can_edit? with @article is called and returns false, a SecurityTrangressionError
|
|
101
|
-
is raised.
|
|
102
|
-
The state example gives information that bob cannot edit the article, and from that one can infer that
|
|
103
|
-
bob trying to edit the article will raise a SecurityTrangressionError.
|
|
104
|
-
|
|
105
|
-
State based testing tends to be more coupling than interaction based testing.
|
|
106
|
-
Note that coupling is not necessarily bad.
|
|
107
|
-
The state based example has both interface, data, and knowledge coupling compared to the interaction based test:
|
|
108
|
-
* Interface coupling - If can_edit? does not return false, there is an error.
|
|
109
|
-
* Fixture Data coupling - If the fixture data changes, there is an error.
|
|
110
|
-
* Knowledge coupling - The ArticleController test needs to know how can_edit? returns false
|
|
111
|
-
|
|
112
|
-
Interface coupling is actually a good thing, because it verifies the User and ArticleController work
|
|
113
|
-
together proberly. This sort of testing is functional or integration testing.
|
|
114
|
-
|
|
115
|
-
The Data and Knowledge coupling are not desirable characteristics because they cause the
|
|
116
|
-
developer to be concerned about another part of the system, which takes development time.
|
|
117
|
-
It can also cause unwanted test failures when the global fixture data is changed or when a change
|
|
118
|
-
occurs that makes the ArticleController's test setup logic incorrect.
|
|
119
|
-
|
|
120
|
-
Martin Fowler also notes that interaction testing has coupling to the edit action's implementation,
|
|
121
|
-
in that the interaction example states that User#can_edit? must be called for the test to pass.
|
|
122
|
-
I've found that sometimes this is desirable and sometimes it is not desirable.
|
|
123
|
-
|
|
124
|
-
The coupling to the implementation encourages more decomposition but it also makes
|
|
125
|
-
causes brittleness because changing the edit action to call another method will cause
|
|
126
|
-
the test to fail.
|
|
127
|
-
|
|
128
|
-
I'm not proposing the right solution in this case, because it is dependent on
|
|
129
|
-
your situation. One thing to consider is:
|
|
130
|
-
* Do you have functional or integration tests for the failure case?
|
|
131
|
-
|
|
132
|
-
Taking the desirable and undesirable coupling into account
|
|
133
|
-
|
|
134
|
-
Here is a view example that renders counts:
|
|
135
|
-
|
|
136
|
-
**State Based Example**
|
|
137
|
-
<pre>
|
|
138
|
-
user = users(:bob)
|
|
139
|
-
user.articles.count.should == 5
|
|
140
|
-
user.articles.comments.count.should == 15
|
|
141
|
-
user.gold_stars.count.should == 0
|
|
142
|
-
|
|
143
|
-
render :template => "users/show"
|
|
144
|
-
response.body.should include("Articles Posted: 5")
|
|
145
|
-
response.body.should include("Comments Received: 15")
|
|
146
|
-
response.body.should include("Gold Stars Received: 0")
|
|
147
|
-
</pre>
|
|
148
|
-
|
|
149
|
-
**Interaction Based Example**
|
|
150
|
-
<pre>
|
|
151
|
-
user = User.new
|
|
152
|
-
mock.probe(user.articles).count {5}
|
|
153
|
-
mock.probe(user.articles.comments).count {15}
|
|
154
|
-
mock.probe(user.gold_stars).count {80}
|
|
155
|
-
|
|
156
|
-
render :template => "users/show"
|
|
157
|
-
response.body.should include("Articles Posted: 5")
|
|
158
|
-
response.body.should include("Comments Received: 15")
|
|
159
|
-
response.body.should include("Gold Stars Received: 80")
|
|
160
|
-
</pre>
|
|
161
|
-
|
|
162
|
-
The same tradeoffs are present in this view example as in the ActiclesController example,
|
|
163
|
-
but the values of each of the tradeoffs are different.
|
|
164
|
-
|
|
165
|
-
State testing couplings:
|
|
166
|
-
* Interface coupling - If count returns a non-number, there is an error.
|
|
167
|
-
* Fixture Data coupling - If the fixture data changes, there is an error.
|
|
168
|
-
* Knowledge coupling - There is no noticeable knowledge coupling.
|
|
169
|
-
|
|
170
|
-
Interaction testing couplings:
|
|
171
|
-
* Implementation coupling - If the way the count is determined changes, there is an error.
|
|
172
|
-
|
|
173
|
-
In these examples, it is fair to expect the counts derived from the fixtures to change quite often.
|
|
174
|
-
Decoupling the counts from your fixtures yields more of a benefit because the interaction based example
|
|
175
|
-
will probably not need to be changed as often as the state based example.
|
|
176
|
-
|
|
177
|
-
The interaction based example also provides the benefits of:
|
|
178
|
-
* being faster because there is no database access
|
|
179
|
-
* providing more focus because non-count user data is not important to this example (the interaction example
|
|
180
|
-
ignores the user data while the state based approach includes the user data)
|
|
181
|
-
* not requiring you to change the fixture data to provide add "Gold Stars Received" because having
|
|
182
|
-
"Gold Stars Received: 0" is almost meaningless (It could easily be calling count on something else
|
|
183
|
-
that returns 0)
|
|
184
|
-
|
|
185
|
-
**State vs. Interaction Based testing?**
|
|
186
|
-
|
|
187
|
-
The examples I provided favor or are neutral to interaction based testing.
|
|
188
|
-
This does not mean all testing should be done with interaction testing.
|
|
189
|
-
There are many situations where state based testing is more
|
|
190
|
-
straightforward and no more coupled than an interaction based test.
|
|
191
|
-
|
|
192
|
-
Please pick the right toolset for your situation.
|
|
193
|
-
In the future, I will blog about different situations and the trade-offs of
|
|
194
|
-
using a state based approach, and/or an interaction based approach.
|
|
195
|
-
|
|
196
|
-
**Extremely Bad Examples**
|
|
197
|
-
|
|
198
|
-
Since this is a blog post, the examples are short and relatively benign.
|
|
199
|
-
However, There are many examples where state and/or interaction
|
|
200
|
-
based testing is overused and abused.
|
|
201
|
-
Expanding your toolset can help you and your coworkers fix these issues.
|
|
202
|
-
|
|
203
|
-
There are already several nice Mock/Stub frameworks in the ruby world. These libraries include:
|
|
204
|
-
* Mocha
|
|
205
|
-
* Flexmock
|
|
206
|
-
* Rspec's Mock Framework
|