card 0.0.1 → 1.15.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +4 -0
- data/GPL +331 -0
- data/LICENSE +16 -0
- data/VERSION +1 -0
- data/card.gemspec +48 -19
- data/config/initializers/01_init_ruby_extensions.rb +7 -0
- data/config/initializers/inflections.rb +13 -0
- data/config/initializers/mime_types.rb +13 -0
- data/config/initializers/notification.rb +4 -0
- data/config/initializers/recaptcha.rb +6 -0
- data/config/initializers/uuid_state_file.rb +3 -0
- data/db/bootstrap/card_actions.yml +3872 -0
- data/db/bootstrap/card_acts.yml +7 -0
- data/db/bootstrap/card_changes.yml +11909 -0
- data/db/bootstrap/card_references.yml +3970 -0
- data/db/bootstrap/cards.yml +10805 -0
- data/db/migrate/20110511221913_require_earlier_migrations.rb +19 -0
- data/db/migrate/20120105203350_require_1_8_migrations.rb +15 -0
- data/db/migrate/20121111025347_require_1_10_migrations.rb +15 -0
- data/db/migrate/20121118114000_split_link_type.rb +16 -0
- data/db/migrate/20121118115000_update_link_type.rb +19 -0
- data/db/migrate/20130106052640_table_cleanup.rb +25 -0
- data/db/migrate/20130109015336_trunk_left.rb +14 -0
- data/db/migrate/20130411210957_update_codenames.rb +14 -0
- data/db/migrate/20140822073704_create_new_revision_tables.rb +43 -0
- data/db/migrate/20141001105348_move_revisions_to_actions.rb +62 -0
- data/db/migrate/20141121172918_rename_card_migration_table.rb +15 -0
- data/db/migrate/20141208132159_remove_present_from_reference_table.rb +9 -0
- data/db/migrate/20141216053032_better_index_names.rb +24 -0
- data/db/migrate_core_cards/20130411191151_renaming_for_menu.rb +49 -0
- data/db/migrate_core_cards/20130411211600_delete_old_related_tab_cards.rb +18 -0
- data/db/migrate_core_cards/20130419215612_import_help_text.rb +13 -0
- data/db/migrate_core_cards/20130823192433_add_style_cards.rb +87 -0
- data/db/migrate_core_cards/20130910183318_move_styles_to_content.rb +11 -0
- data/db/migrate_core_cards/20130920214038_jsonize_tinymce.rb +15 -0
- data/db/migrate_core_cards/20130920291703_update_stylesheets.rb +18 -0
- data/db/migrate_core_cards/20130927191728_account_events.rb +21 -0
- data/db/migrate_core_cards/20131016172445_common_css_patch.rb +12 -0
- data/db/migrate_core_cards/20140110193325_reset_account_request_type.rb +11 -0
- data/db/migrate_core_cards/20140307231621_user_data_to_cards.rb +73 -0
- data/db/migrate_core_cards/20140317035504_account_requests_to_signups.rb +51 -0
- data/db/migrate_core_cards/20140512155840_add_script_cards.rb +83 -0
- data/db/migrate_core_cards/20140629222005_add_email_cards.rb +134 -0
- data/db/migrate_core_cards/20140725180118_config_card_updates.rb +9 -0
- data/db/migrate_core_cards/20141111083921_delete_machine_output.rb +9 -0
- data/db/migrate_core_cards/20141115034214_config_descriptions_etc.rb +14 -0
- data/db/migrate_core_cards/20141119001955_make_symlinks_relative.rb +15 -0
- data/db/migrate_core_cards/20141120120605_fix_notification_html_message.rb +10 -0
- data/db/migrate_core_cards/20141204061304_watchers_to_following.rb +38 -0
- data/db/migrate_core_cards/20141208132416_partial_reference_type.rb +7 -0
- data/db/migrate_core_cards/20141208162106_add_ace_script.rb +12 -0
- data/db/migrate_core_cards/20141216155251_add_more_following_cards.rb +24 -0
- data/db/migrate_core_cards/20141230204340_uri_codename.rb +13 -0
- data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +17 -0
- data/db/migrate_core_cards/20150220134731_following_to_follow_rule.rb +18 -0
- data/db/migrate_core_cards/data/1.11_help_text.json +410 -0
- data/db/migrate_core_cards/data/1.12_stylesheets/classic_cards.scss +100 -0
- data/db/migrate_core_cards/data/1.12_stylesheets/common.scss +226 -0
- data/db/migrate_core_cards/data/1.12_stylesheets/right_sidebar.scss +27 -0
- data/db/migrate_core_cards/data/1.12_stylesheets/traditional.scss +152 -0
- data/db/migrate_core_cards/data/1.13_config_text.json +32 -0
- data/db/migrate_core_cards/data/1.14_config_descriptions_etc.json +77 -0
- data/db/migrate_core_cards/data/bootstrap_layout.json +81 -0
- data/db/migrate_core_cards/data/mailer/follower_notification_email.html +9 -0
- data/db/migrate_core_cards/data/mailer/follower_notification_email.txt +11 -0
- data/db/migrate_core_cards/data/mailer/mail_config.json +22 -0
- data/db/migrate_core_cards/data/mailer/password_reset_email.html +10 -0
- data/db/migrate_core_cards/data/mailer/password_reset_email.txt +11 -0
- data/db/migrate_core_cards/data/mailer/signup_alert_email.html +7 -0
- data/db/migrate_core_cards/data/mailer/signup_alert_email.txt +5 -0
- data/db/migrate_core_cards/data/mailer/verification_email.html +9 -0
- data/db/migrate_core_cards/data/mailer/verification_email.txt +8 -0
- data/db/schema.rb +128 -0
- data/db/seeds.rb +8 -0
- data/db/version.txt +1 -0
- data/db/version_core_cards.txt +1 -0
- data/lib/card.rb +46 -3
- data/lib/card/active_record_ext.rb +77 -0
- data/lib/card/auth.rb +181 -0
- data/lib/card/cache.rb +199 -0
- data/lib/card/chunk.rb +104 -0
- data/lib/card/codename.rb +72 -0
- data/lib/card/content.rb +211 -0
- data/lib/card/core_ext.rb +105 -0
- data/lib/card/core_migration.rb +6 -0
- data/lib/card/diff.rb +430 -0
- data/lib/card/env.rb +52 -0
- data/lib/card/exceptions.rb +44 -0
- data/lib/card/format.rb +563 -0
- data/lib/card/loader.rb +165 -0
- data/lib/card/log.rb +450 -0
- data/lib/card/mailer.rb +37 -0
- data/lib/card/migration.rb +145 -0
- data/lib/card/name.rb +45 -0
- data/lib/card/query.rb +81 -0
- data/lib/card/query/card_clause.rb +527 -0
- data/lib/card/query/clause.rb +21 -0
- data/lib/card/query/ref_clause.rb +47 -0
- data/lib/card/query/value_clause.rb +65 -0
- data/lib/card/reference.rb +63 -0
- data/lib/card/set.rb +369 -0
- data/lib/card/set_pattern.rb +168 -0
- data/lib/card/simplecov_helper.rb +61 -0
- data/lib/card/spec_helper.rb +68 -0
- data/lib/card/version.rb +9 -2
- data/lib/cardio.rb +145 -0
- data/lib/generators/card.rb +32 -0
- data/lib/generators/card/format/USAGE +9 -0
- data/lib/generators/card/format/format_generator.rb +27 -0
- data/lib/generators/card/format/templates/format_spec_template.erb +5 -0
- data/lib/generators/card/format/templates/format_template.erb +3 -0
- data/lib/generators/card/migration/USAGE +24 -0
- data/lib/generators/card/migration/migration_generator.rb +38 -0
- data/lib/generators/card/migration/templates/card_migration.erb +10 -0
- data/lib/generators/card/set/USAGE +15 -0
- data/lib/generators/card/set/set_generator.rb +29 -0
- data/lib/generators/card/set/templates/set_spec_template.erb +5 -0
- data/lib/generators/card/set/templates/set_template.erb +1 -0
- data/mod/01_core/chunk/include.rb +85 -0
- data/mod/01_core/chunk/link.rb +87 -0
- data/mod/01_core/chunk/literal.rb +24 -0
- data/mod/01_core/chunk/reference.rb +53 -0
- data/mod/01_core/chunk/uri.rb +135 -0
- data/mod/01_core/format/data_format.rb +2 -0
- data/mod/01_core/format/html_format.rb +129 -0
- data/mod/01_core/format/text_format.rb +10 -0
- data/mod/01_core/layout/blank.html +5 -0
- data/mod/01_core/layout/default.html +20 -0
- data/mod/01_core/layout/noside.html +16 -0
- data/mod/01_core/layout/pre.html +2 -0
- data/mod/01_core/layout/simple.html +5 -0
- data/mod/01_core/set/all/active_card.rb +35 -0
- data/mod/01_core/set/all/collection.rb +142 -0
- data/mod/01_core/set/all/content.rb +64 -0
- data/mod/01_core/set/all/erb.rb +11 -0
- data/mod/01_core/set/all/fetch.rb +228 -0
- data/mod/01_core/set/all/haml.rb +7 -0
- data/mod/01_core/set/all/initialize.rb +49 -0
- data/mod/01_core/set/all/name.rb +275 -0
- data/mod/01_core/set/all/pattern.rb +56 -0
- data/mod/01_core/set/all/permissions.rb +284 -0
- data/mod/01_core/set/all/phases.rb +185 -0
- data/mod/01_core/set/all/references.rb +118 -0
- data/mod/01_core/set/all/rules.rb +315 -0
- data/mod/01_core/set/all/states.rb +16 -0
- data/mod/01_core/set/all/templating.rb +120 -0
- data/mod/01_core/set/all/tracked_attributes.rb +114 -0
- data/mod/01_core/set/all/trash.rb +50 -0
- data/mod/01_core/set/all/type.rb +85 -0
- data/mod/01_core/set/all/utils.rb +85 -0
- data/mod/01_core/set_pattern/01_all.rb +11 -0
- data/mod/01_core/set_pattern/02_all_plus.rb +13 -0
- data/mod/01_core/set_pattern/03_type.rb +23 -0
- data/mod/01_core/set_pattern/04_star.rb +15 -0
- data/mod/01_core/set_pattern/05_rstar.rb +17 -0
- data/mod/01_core/set_pattern/06_right.rb +20 -0
- data/mod/01_core/set_pattern/07_type_plus_right.rb +23 -0
- data/mod/01_core/set_pattern/08_self.rb +19 -0
- data/mod/01_core/spec/chunk/literal_spec.rb +14 -0
- data/mod/01_core/spec/chunk/uri_spec.rb +292 -0
- data/mod/01_core/spec/format/data_format_spec.rb +5 -0
- data/mod/01_core/spec/format/html_format_spec.rb +140 -0
- data/mod/01_core/spec/format/text_format_spec.rb +5 -0
- data/mod/01_core/spec/set/all/active_card_spec.rb +5 -0
- data/mod/01_core/spec/set/all/attribute_tracking_spec.rb +21 -0
- data/mod/01_core/spec/set/all/collection_spec.rb +65 -0
- data/mod/01_core/spec/set/all/content_spec.rb +15 -0
- data/mod/01_core/spec/set/all/fetch_spec.rb +204 -0
- data/mod/01_core/spec/set/all/initialize_spec.rb +58 -0
- data/mod/01_core/spec/set/all/name_spec.rb +61 -0
- data/mod/01_core/spec/set/all/pattern_spec.rb +81 -0
- data/mod/01_core/spec/set/all/permissions_spec.rb +505 -0
- data/mod/01_core/spec/set/all/phases_spec.rb +6 -0
- data/mod/01_core/spec/set/all/references_spec.rb +8 -0
- data/mod/01_core/spec/set/all/rules2_spec.rb +250 -0
- data/mod/01_core/spec/set/all/rules_spec.rb +130 -0
- data/mod/01_core/spec/set/all/states_spec.rb +5 -0
- data/mod/01_core/spec/set/all/templating_spec.rb +111 -0
- data/mod/01_core/spec/set/all/tracked_attributes_spec.rb +328 -0
- data/mod/01_core/spec/set/all/trash_spec.rb +34 -0
- data/mod/01_core/spec/set/all/type_spec.rb +71 -0
- data/mod/01_core/spec/set/all/utils_spec.rb +5 -0
- data/mod/01_history/lib/card/act.rb +60 -0
- data/mod/01_history/lib/card/action.rb +176 -0
- data/mod/01_history/lib/card/change.rb +29 -0
- data/mod/01_history/set/all/actions.rb +47 -0
- data/mod/01_history/set/all/content_history.rb +131 -0
- data/mod/01_history/set/all/history.rb +296 -0
- data/mod/02_basic_types/format/css_format.rb +6 -0
- data/mod/02_basic_types/format/csv_format.rb +6 -0
- data/mod/02_basic_types/format/file_format.rb +3 -0
- data/mod/02_basic_types/format/js_format.rb +6 -0
- data/mod/02_basic_types/format/json_format.rb +6 -0
- data/mod/02_basic_types/format/rss_format.rb +11 -0
- data/mod/02_basic_types/format/xml_format.rb +6 -0
- data/mod/02_basic_types/set/all/all_css.rb +42 -0
- data/mod/02_basic_types/set/all/all_csv.rb +52 -0
- data/mod/02_basic_types/set/all/all_js.rb +7 -0
- data/mod/02_basic_types/set/all/base.rb +122 -0
- data/mod/02_basic_types/set/all/file.rb +13 -0
- data/mod/02_basic_types/set/all/json.rb +66 -0
- data/mod/02_basic_types/set/all/rss.rb +72 -0
- data/mod/02_basic_types/set/all/text.rb +8 -0
- data/mod/02_basic_types/set/type/plain_text.rb +10 -0
- data/mod/02_basic_types/set/type/pointer.rb +323 -0
- data/mod/02_basic_types/spec/set/all/all_css_spec.rb +10 -0
- data/mod/02_basic_types/spec/set/all/all_csv_spec.rb +9 -0
- data/mod/02_basic_types/spec/set/all/base_spec.rb +57 -0
- data/mod/02_basic_types/spec/set/all/file_spec.rb +5 -0
- data/mod/02_basic_types/spec/set/all/json_spec.rb +26 -0
- data/mod/02_basic_types/spec/set/all/rss_spec.rb +8 -0
- data/mod/02_basic_types/spec/set/all/text_spec.rb +5 -0
- data/mod/02_basic_types/spec/set/type/plain_text_spec.rb +11 -0
- data/mod/02_basic_types/spec/set/type/pointer_spec.rb +103 -0
- data/mod/03_machines/lib/card/machine.rb +185 -0
- data/mod/03_machines/lib/card/machine_input.rb +40 -0
- data/mod/03_machines/lib/javascript/ace.js +18204 -0
- data/mod/03_machines/lib/javascript/html5shiv-printshiv.js +1 -0
- data/mod/03_machines/lib/javascript/jquery-ui.js +14913 -0
- data/mod/03_machines/lib/javascript/jquery.autosize.js +274 -0
- data/mod/03_machines/lib/javascript/jquery.fileupload.js +1114 -0
- data/mod/03_machines/lib/javascript/jquery.iframe-transport.js +185 -0
- data/mod/03_machines/lib/javascript/jquery.js +4 -0
- data/mod/03_machines/lib/javascript/jquery.ui.autocomplete.html.js +41 -0
- data/mod/03_machines/lib/javascript/jquery_ujs.js +469 -0
- data/mod/03_machines/lib/javascript/jquerymobile.js +15454 -0
- data/mod/03_machines/lib/javascript/theme-textmate.js +130 -0
- data/mod/03_machines/lib/javascript/tinymce.js +13 -0
- data/mod/03_machines/lib/javascript/wagn.js.coffee +336 -0
- data/mod/03_machines/lib/javascript/wagn_menu.js +72 -0
- data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +446 -0
- data/mod/03_machines/lib/stylesheets/functional.scss +184 -0
- data/mod/03_machines/lib/stylesheets/jquery-ui-smoothness.css +1178 -0
- data/mod/03_machines/lib/stylesheets/standard.scss +760 -0
- data/mod/03_machines/set/right/machine_output.rb +20 -0
- data/mod/03_machines/set/self/script_ace.rb +8 -0
- data/mod/03_machines/set/self/script_card_menu.rb +8 -0
- data/mod/03_machines/set/self/script_html5shiv_printshiv.rb +7 -0
- data/mod/03_machines/set/self/script_jquery.rb +8 -0
- data/mod/03_machines/set/self/script_jquery_helper.rb +14 -0
- data/mod/03_machines/set/self/script_slot.rb +9 -0
- data/mod/03_machines/set/self/script_tinymce.rb +8 -0
- data/mod/03_machines/set/self/style_functional.rb +8 -0
- data/mod/03_machines/set/self/style_jquery_ui_smoothness.rb +8 -0
- data/mod/03_machines/set/self/style_standard.rb +8 -0
- data/mod/03_machines/set/type/coffee_script.rb +61 -0
- data/mod/03_machines/set/type/css.rb +45 -0
- data/mod/03_machines/set/type/java_script.rb +38 -0
- data/mod/03_machines/set/type/scss.rb +23 -0
- data/mod/03_machines/set/type/skin.rb +12 -0
- data/mod/03_machines/spec/lib/shared_machine_examples.rb +175 -0
- data/mod/03_machines/spec/lib/shared_machine_input_examples.rb +65 -0
- data/mod/03_machines/spec/set/right/machine_output_spec.rb +5 -0
- data/mod/03_machines/spec/set/self/style_functional_spec.rb +5 -0
- data/mod/03_machines/spec/set/self/style_jquery_ui_smoothness_spec.rb +5 -0
- data/mod/03_machines/spec/set/self/style_standard_spec.rb +5 -0
- data/mod/03_machines/spec/set/type/coffeescript_spec.rb +29 -0
- data/mod/03_machines/spec/set/type/css_spec.rb +34 -0
- data/mod/03_machines/spec/set/type/javascript_spec.rb +28 -0
- data/mod/03_machines/spec/set/type/scss_spec.rb +56 -0
- data/mod/03_machines/spec/set/type/skin_spec.rb +70 -0
- data/mod/04_settings/lib/card/setting.rb +65 -0
- data/mod/04_settings/set/right/add_help.rb +11 -0
- data/mod/04_settings/set/right/comment.rb +91 -0
- data/mod/04_settings/set/right/create.rb +3 -0
- data/mod/04_settings/set/right/default.rb +3 -0
- data/mod/04_settings/set/right/delete.rb +4 -0
- data/mod/04_settings/set/right/help.rb +3 -0
- data/mod/04_settings/set/right/read.rb +2 -0
- data/mod/04_settings/set/right/script.rb +10 -0
- data/mod/04_settings/set/right/structure.rb +4 -0
- data/mod/04_settings/set/right/style.rb +10 -0
- data/mod/04_settings/set/right/update.rb +2 -0
- data/mod/04_settings/set/self/accountable.rb +3 -0
- data/mod/04_settings/set/self/add_help.rb +2 -0
- data/mod/04_settings/set/self/autoname.rb +2 -0
- data/mod/04_settings/set/self/captcha.rb +2 -0
- data/mod/04_settings/set/self/comment.rb +2 -0
- data/mod/04_settings/set/self/create.rb +2 -0
- data/mod/04_settings/set/self/default.rb +2 -0
- data/mod/04_settings/set/self/delete.rb +2 -0
- data/mod/04_settings/set/self/help.rb +2 -0
- data/mod/04_settings/set/self/input.rb +2 -0
- data/mod/04_settings/set/self/layout.rb +2 -0
- data/mod/04_settings/set/self/on_create.rb +2 -0
- data/mod/04_settings/set/self/on_delete.rb +2 -0
- data/mod/04_settings/set/self/on_update.rb +2 -0
- data/mod/04_settings/set/self/options.rb +2 -0
- data/mod/04_settings/set/self/options_label.rb +2 -0
- data/mod/04_settings/set/self/read.rb +2 -0
- data/mod/04_settings/set/self/script.rb +2 -0
- data/mod/04_settings/set/self/structure.rb +2 -0
- data/mod/04_settings/set/self/style.rb +2 -0
- data/mod/04_settings/set/self/table_of_contents.rb +2 -0
- data/mod/04_settings/set/self/thanks.rb +2 -0
- data/mod/04_settings/set/self/update.rb +2 -0
- data/mod/04_settings/set/type/setting.rb +82 -0
- data/mod/04_settings/spec/set/right/add_help_spec.rb +5 -0
- data/mod/04_settings/spec/set/right/comment_spec.rb +41 -0
- data/mod/04_settings/spec/set/right/create_spec.rb +10 -0
- data/mod/04_settings/spec/set/right/default_spec.rb +5 -0
- data/mod/04_settings/spec/set/right/delete_spec.rb +5 -0
- data/mod/04_settings/spec/set/right/help_spec.rb +5 -0
- data/mod/04_settings/spec/set/right/read_spec.rb +5 -0
- data/mod/04_settings/spec/set/right/script_spec.rb +24 -0
- data/mod/04_settings/spec/set/right/structure_spec.rb +17 -0
- data/mod/04_settings/spec/set/right/style_spec.rb +29 -0
- data/mod/04_settings/spec/set/right/update_spec.rb +5 -0
- data/mod/04_settings/spec/set/type/setting_spec.rb +10 -0
- data/mod/05_email/format/email_html_format.rb +9 -0
- data/mod/05_email/format/email_text_format.rb +11 -0
- data/mod/05_email/lib/card/follow_option.rb +90 -0
- data/mod/05_email/set/all/email_html.rb +5 -0
- data/mod/05_email/set/all/email_text.rb +5 -0
- data/mod/05_email/set/all/follow.rb +256 -0
- data/mod/05_email/set/all/notify.rb +223 -0
- data/mod/05_email/set/all/observer.rb +27 -0
- data/mod/05_email/set/right/bcc.rb +45 -0
- data/mod/05_email/set/right/cc.rb +3 -0
- data/mod/05_email/set/right/follow.rb +9 -0
- data/mod/05_email/set/right/follow_fields.rb +3 -0
- data/mod/05_email/set/right/followers.rb +30 -0
- data/mod/05_email/set/right/following.rb +52 -0
- data/mod/05_email/set/right/from.rb +3 -0
- data/mod/05_email/set/right/html_message.rb +3 -0
- data/mod/05_email/set/right/to.rb +3 -0
- data/mod/05_email/set/self/always.rb +14 -0
- data/mod/05_email/set/self/created.rb +21 -0
- data/mod/05_email/set/self/edited.rb +24 -0
- data/mod/05_email/set/self/follow.rb +2 -0
- data/mod/05_email/set/self/follow_defaults.rb +66 -0
- data/mod/05_email/set/self/never.rb +15 -0
- data/mod/05_email/set/type/email_template.rb +113 -0
- data/mod/05_email/set/type_plus_right/user/follow.rb +176 -0
- data/mod/05_email/spec/set/all/follow_spec.rb +133 -0
- data/mod/05_email/spec/set/all/notify_spec.rb +364 -0
- data/mod/05_email/spec/set/all/observer_spec.rb +76 -0
- data/mod/05_email/spec/set/right/followers_spec.rb +126 -0
- data/mod/05_email/spec/set/right/following_spec.rb +4 -0
- data/mod/05_email/spec/set/self/follow_defaults_spec.rb +18 -0
- data/mod/05_standard/file/103/icon-6566.ico +0 -0
- data/mod/05_standard/file/103/large-6566.ico +0 -0
- data/mod/05_standard/file/103/medium-6566.ico +0 -0
- data/mod/05_standard/file/103/original-6566.ico +0 -0
- data/mod/05_standard/file/103/small-6566.ico +0 -0
- data/mod/05_standard/file/79/icon-6556.png +0 -0
- data/mod/05_standard/file/79/large-6556.png +0 -0
- data/mod/05_standard/file/79/medium-6556.png +0 -0
- data/mod/05_standard/file/79/original-6556.png +0 -0
- data/mod/05_standard/file/79/small-6556.png +0 -0
- data/mod/05_standard/file/790/icon-6419.png +0 -0
- data/mod/05_standard/file/790/large-6419.png +0 -0
- data/mod/05_standard/file/790/medium-6419.png +0 -0
- data/mod/05_standard/file/790/original-6419.png +0 -0
- data/mod/05_standard/file/790/small-6419.png +0 -0
- data/mod/05_standard/set/all/account.rb +67 -0
- data/mod/05_standard/set/all/attach.rb +152 -0
- data/mod/05_standard/set/all/comment.rb +39 -0
- data/mod/05_standard/set/all/error.rb +214 -0
- data/mod/05_standard/set/all/event_viz.rb +62 -0
- data/mod/05_standard/set/all/links.rb +110 -0
- data/mod/05_standard/set/all/rich_html/content.rb +173 -0
- data/mod/05_standard/set/all/rich_html/editing.rb +145 -0
- data/mod/05_standard/set/all/rich_html/form.rb +234 -0
- data/mod/05_standard/set/all/rich_html/header.rb +64 -0
- data/mod/05_standard/set/all/rich_html/wrapper.rb +105 -0
- data/mod/05_standard/set/right/account.rb +180 -0
- data/mod/05_standard/set/right/email.rb +52 -0
- data/mod/05_standard/set/right/password.rb +39 -0
- data/mod/05_standard/set/right/salt.rb +5 -0
- data/mod/05_standard/set/right/stats.rb +35 -0
- data/mod/05_standard/set/right/status.rb +9 -0
- data/mod/05_standard/set/right/token.rb +5 -0
- data/mod/05_standard/set/right/when_created.rb +5 -0
- data/mod/05_standard/set/right/when_last_edited.rb +5 -0
- data/mod/05_standard/set/rstar/rules.rb +407 -0
- data/mod/05_standard/set/self/account_links.rb +61 -0
- data/mod/05_standard/set/self/alerts.rb +5 -0
- data/mod/05_standard/set/self/all.rb +21 -0
- data/mod/05_standard/set/self/foot.rb +8 -0
- data/mod/05_standard/set/self/head.rb +121 -0
- data/mod/05_standard/set/self/navbox.rb +20 -0
- data/mod/05_standard/set/self/now.rb +6 -0
- data/mod/05_standard/set/self/recent.rb +48 -0
- data/mod/05_standard/set/self/search.rb +43 -0
- data/mod/05_standard/set/self/signin.rb +121 -0
- data/mod/05_standard/set/self/stats.rb +91 -0
- data/mod/05_standard/set/self/version.rb +9 -0
- data/mod/05_standard/set/type/basic.rb +46 -0
- data/mod/05_standard/set/type/cardtype.rb +43 -0
- data/mod/05_standard/set/type/date.rb +8 -0
- data/mod/05_standard/set/type/file.rb +85 -0
- data/mod/05_standard/set/type/html.rb +22 -0
- data/mod/05_standard/set/type/image.rb +67 -0
- data/mod/05_standard/set/type/layout_type.rb +14 -0
- data/mod/05_standard/set/type/number.rb +19 -0
- data/mod/05_standard/set/type/phrase.rb +3 -0
- data/mod/05_standard/set/type/search_type.rb +243 -0
- data/mod/05_standard/set/type/set.rb +198 -0
- data/mod/05_standard/set/type/signup.rb +144 -0
- data/mod/05_standard/set/type/toggle.rb +12 -0
- data/mod/05_standard/set/type/uri.rb +11 -0
- data/mod/05_standard/set/type/user.rb +72 -0
- data/mod/05_standard/spec/chunk/include_spec.rb +186 -0
- data/mod/05_standard/spec/chunk/link_spec.rb +61 -0
- data/mod/05_standard/spec/format/css_format_spec.rb +5 -0
- data/mod/05_standard/spec/format/csv_format_spec.rb +5 -0
- data/mod/05_standard/spec/format/email_html_format_spec.rb +5 -0
- data/mod/05_standard/spec/format/file_format_spec.rb +5 -0
- data/mod/05_standard/spec/format/js_format_spec.rb +5 -0
- data/mod/05_standard/spec/format/json_format_spec.rb +5 -0
- data/mod/05_standard/spec/format/rss_format_spec.rb +5 -0
- data/mod/05_standard/spec/format/xml_format_spec.rb +5 -0
- data/mod/05_standard/spec/set/all/account_spec.rb +137 -0
- data/mod/05_standard/spec/set/all/attach_spec.rb +9 -0
- data/mod/05_standard/spec/set/all/comment_spec.rb +5 -0
- data/mod/05_standard/spec/set/all/email_html_spec.rb +15 -0
- data/mod/05_standard/spec/set/all/error_spec.rb +9 -0
- data/mod/05_standard/spec/set/all/event_viz_spec.rb +9 -0
- data/mod/05_standard/spec/set/all/history_spec.rb +173 -0
- data/mod/05_standard/spec/set/all/rich_html/form_spec.rb +43 -0
- data/mod/05_standard/spec/set/all/rich_html/wrapper_spec.rb +28 -0
- data/mod/05_standard/spec/set/right/account_spec.rb +162 -0
- data/mod/05_standard/spec/set/right/email_spec.rb +55 -0
- data/mod/05_standard/spec/set/right/password_spec.rb +45 -0
- data/mod/05_standard/spec/set/right/salt_spec.rb +5 -0
- data/mod/05_standard/spec/set/right/stats_spec.rb +13 -0
- data/mod/05_standard/spec/set/right/status_spec.rb +5 -0
- data/mod/05_standard/spec/set/right/token_spec.rb +5 -0
- data/mod/05_standard/spec/set/right/when_created_spec.rb +7 -0
- data/mod/05_standard/spec/set/right/when_last_edited_spec.rb +7 -0
- data/mod/05_standard/spec/set/rstar/rules_spec.rb +25 -0
- data/mod/05_standard/spec/set/self/account_links_spec.rb +9 -0
- data/mod/05_standard/spec/set/self/alerts_spec.rb +5 -0
- data/mod/05_standard/spec/set/self/all_spec.rb +48 -0
- data/mod/05_standard/spec/set/self/foot_spec.rb +5 -0
- data/mod/05_standard/spec/set/self/head_spec.rb +17 -0
- data/mod/05_standard/spec/set/self/navbox_spec.rb +7 -0
- data/mod/05_standard/spec/set/self/now_spec.rb +7 -0
- data/mod/05_standard/spec/set/self/recent_spec.rb +5 -0
- data/mod/05_standard/spec/set/self/search_spec.rb +5 -0
- data/mod/05_standard/spec/set/self/signin_spec.rb +73 -0
- data/mod/05_standard/spec/set/self/stats_spec.rb +12 -0
- data/mod/05_standard/spec/set/self/version_spec.rb +7 -0
- data/mod/05_standard/spec/set/type/basic_spec.rb +5 -0
- data/mod/05_standard/spec/set/type/cardtype_spec.rb +5 -0
- data/mod/05_standard/spec/set/type/date_spec.rb +7 -0
- data/mod/05_standard/spec/set/type/email_template_spec.rb +208 -0
- data/mod/05_standard/spec/set/type/file_spec.rb +5 -0
- data/mod/05_standard/spec/set/type/html_spec.rb +23 -0
- data/mod/05_standard/spec/set/type/image_spec.rb +16 -0
- data/mod/05_standard/spec/set/type/layout_type_spec.rb +7 -0
- data/mod/05_standard/spec/set/type/number_spec.rb +7 -0
- data/mod/05_standard/spec/set/type/phrase_spec.rb +7 -0
- data/mod/05_standard/spec/set/type/search_type_spec.rb +27 -0
- data/mod/05_standard/spec/set/type/set_spec.rb +26 -0
- data/mod/05_standard/spec/set/type/signup_spec.rb +228 -0
- data/mod/05_standard/spec/set/type/toggle_spec.rb +12 -0
- data/mod/05_standard/spec/set/type/uri_spec.rb +41 -0
- data/mod/05_standard/spec/set/type/user_spec.rb +5 -0
- data/mod/06_bootstrap/lib/javascript/bootstrap.js +2306 -0
- data/mod/06_bootstrap/lib/javascript/bootstrap.min.js +7 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap-theme.css +476 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap.css +6565 -0
- data/mod/06_bootstrap/lib/stylesheets/darkly.css +6583 -0
- data/mod/06_bootstrap/set/all/bootstrap/form.rb +37 -0
- data/mod/06_bootstrap/set/all/bootstrap/header.rb +29 -0
- data/mod/06_bootstrap/set/all/bootstrap/wrapper.rb +12 -0
- data/mod/06_bootstrap/set/all/rich_bootstrap.rb +28 -0
- data/mod/06_bootstrap/set/self/bootstrap_css.rb +7 -0
- data/mod/06_bootstrap/set/self/bootstrap_js.rb +7 -0
- data/mod/06_bootstrap/set/self/bootstrap_theme_css.rb +7 -0
- data/mod/06_bootstrap/set/self/navbox.rb +32 -0
- data/mod/06_bootstrap/set/type/search_type.rb +79 -0
- data/mod/06_bootstrap/spec/set/all/bootstrap/form_spec.rb +13 -0
- data/spec/lib/card/action_spec.rb +14 -0
- data/spec/lib/card/auth_spec.rb +17 -0
- data/spec/lib/card/cache_spec.rb +122 -0
- data/spec/lib/card/chunk_spec.rb +17 -0
- data/spec/lib/card/codename_spec.rb +25 -0
- data/spec/lib/card/content_spec.rb +314 -0
- data/spec/lib/card/diff_spec.rb +210 -0
- data/spec/lib/card/format_spec.rb +82 -0
- data/spec/lib/card/loader_spec.rb +39 -0
- data/spec/lib/card/log_spec.rb +270 -0
- data/spec/lib/card/name_spec.rb +279 -0
- data/spec/lib/card/query_spec.rb +456 -0
- data/spec/lib/card/reference_spec.rb +213 -0
- data/spec/lib/card/set_pattern_spec.rb +56 -0
- data/spec/lib/card/set_spec.rb +88 -0
- data/spec/mailers/mailer_spec.rb +64 -0
- data/spec/models/card/cardtype_spec.rb +216 -0
- data/spec/models/card/create_spec.rb +82 -0
- data/spec/models/card/trash_spec.rb +260 -0
- data/spec/models/card/type_transition_spec.rb +161 -0
- data/spec/models/card/validation_spec.rb +36 -0
- data/spec/models/card_spec.rb +177 -0
- data/spec/spec_helper.rb +130 -0
- data/test/fixtures/.gitkeep +0 -0
- data/test/fixtures/card_actions.yml +5706 -0
- data/test/fixtures/card_acts.yml +835 -0
- data/test/fixtures/card_changes.yml +17182 -0
- data/test/fixtures/card_references.yml +5405 -0
- data/test/fixtures/cards.yml +15533 -0
- data/test/fixtures/mao2.jpg +0 -0
- data/test/fixtures/rails.gif +0 -0
- data/test/seed.rb +201 -0
- metadata +762 -38
- data/.gitignore +0 -17
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -22
- data/README.md +0 -29
- data/Rakefile +0 -1
@@ -0,0 +1,213 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
describe Card::Reference do
|
4
|
+
|
5
|
+
before do
|
6
|
+
Card::Auth.current_id = Card::WagnBotID
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "references on hard templated cards should get updated" do
|
10
|
+
it "on structuree creation" do
|
11
|
+
Card.create! :name=>"JoeForm", :type=>'UserForm'
|
12
|
+
Card["JoeForm"].format.render(:core)
|
13
|
+
assert_equal ["joe_form+age", "joe_form+description", "joe_form+name"],
|
14
|
+
Card["JoeForm"].includees.map(&:key).sort
|
15
|
+
expect(Card["JoeForm"].references_expired).not_to eq(true)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "on template creation" do
|
19
|
+
Card.create! :name=>"SpecialForm", :type=>'Cardtype'
|
20
|
+
Card.create! :name=>"Form1", :type=>'SpecialForm', :content=>"foo"
|
21
|
+
c = Card["Form1"]
|
22
|
+
expect(c.references_expired).to be_nil
|
23
|
+
Card.create! :name=>"SpecialForm+*type+*structure", :content=>"{{+bar}}"
|
24
|
+
c = Card["Form1"]
|
25
|
+
expect(c.references_expired).to be_truthy
|
26
|
+
Card["Form1"].format.render(:core)
|
27
|
+
c = Card["Form1"]
|
28
|
+
expect(c.references_expired).to be_nil
|
29
|
+
expect(Card["Form1"].includees.map(&:key)).to eq(["form1+bar"])
|
30
|
+
end
|
31
|
+
|
32
|
+
it "on template update" do
|
33
|
+
Card.create! :name=>"JoeForm", :type=>'UserForm'
|
34
|
+
tmpl = Card["UserForm+*type+*structure"]
|
35
|
+
tmpl.content = "{{+monkey}} {{+banana}} {{+fruit}}";
|
36
|
+
tmpl.save!
|
37
|
+
expect(Card["JoeForm"].references_expired).to be_truthy
|
38
|
+
Card["JoeForm"].format.render(:core)
|
39
|
+
assert_equal ["joe_form+banana", "joe_form+fruit", "joe_form+monkey"],
|
40
|
+
Card["JoeForm"].includees.map(&:key).sort
|
41
|
+
expect(Card["JoeForm"].references_expired).not_to eq(true)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it "in references should survive cardtype change" do
|
46
|
+
newcard("Banana","[[Yellow]]")
|
47
|
+
newcard("Submarine","[[Yellow]]")
|
48
|
+
newcard("Sun","[[Yellow]]")
|
49
|
+
newcard("Yellow")
|
50
|
+
expect(Card["Yellow"].referencers.map(&:name).sort).to eq(%w{ Banana Submarine Sun })
|
51
|
+
y=Card["Yellow"];
|
52
|
+
y.type_id= Card.fetch_id "UserForm";
|
53
|
+
y.save!
|
54
|
+
expect(Card["Yellow"].referencers.map(&:name).sort).to eq(%w{ Banana Submarine Sun })
|
55
|
+
end
|
56
|
+
|
57
|
+
it "container inclusion" do
|
58
|
+
Card.create :name=>'bob+city'
|
59
|
+
Card.create :name=>'address+*right+*default',:content=>"{{_L+city}}"
|
60
|
+
Card.create :name=>'bob+address'
|
61
|
+
expect(Card.fetch('bob+address').includees.map(&:name)).to eq(["bob+city"])
|
62
|
+
expect(Card.fetch('bob+city').includers.map(&:name)).to eq(["bob+address"])
|
63
|
+
end
|
64
|
+
|
65
|
+
it "pickup new links on rename" do
|
66
|
+
@l = newcard("L", "[[Ethan]]") # no Ethan card yet...
|
67
|
+
@e = newcard("Earthman")
|
68
|
+
@e.update_attributes! :name => "Ethan" # NOW there is an Ethan card
|
69
|
+
# @e.referencers.map(&:name).include("L") as the test was originally written, fails
|
70
|
+
# do we need the links to be caught before reloading the card?
|
71
|
+
expect(Card["Ethan"].referencers.map(&:name).include?("L")).not_to eq(nil)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should update references on rename when requested" do
|
75
|
+
watermelon = newcard('watermelon', 'mmmm')
|
76
|
+
watermelon_seeds = newcard('watermelon+seeds', 'black')
|
77
|
+
lew = newcard('Lew', "likes [[watermelon]] and [[watermelon+seeds|seeds]]")
|
78
|
+
|
79
|
+
watermelon = Card['watermelon']
|
80
|
+
watermelon.update_referencers = true
|
81
|
+
watermelon.name="grapefruit"
|
82
|
+
watermelon.save!
|
83
|
+
expect(lew.reload.content).to eq("likes [[grapefruit]] and [[grapefruit+seeds|seeds]]")
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should update referencers on rename when requested (case 2)" do
|
87
|
+
card = Card['Administrator Menu+*self+*read']
|
88
|
+
refs = Card::Reference.where(:referee_id => Card::AdministratorID).map(&:referer_id).sort
|
89
|
+
card.update_referencers = true
|
90
|
+
card.name='Administrator Menu+*type+*read'
|
91
|
+
card.save
|
92
|
+
expect(Card::Reference.where(:referee_id => Card::AdministratorID).map(&:referer_id).sort).to eq(refs)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should not update references when not requested" do
|
96
|
+
|
97
|
+
watermelon = newcard('watermelon', 'mmmm')
|
98
|
+
watermelon_seeds = newcard('watermelon+seeds', 'black')
|
99
|
+
lew = newcard('Lew', "likes [[watermelon]] and [[watermelon+seeds|seeds]]")
|
100
|
+
|
101
|
+
assert_equal [1,1,1,1], lew.references_to.map(&:present), "links should not be Wanted before"
|
102
|
+
watermelon = Card['watermelon']
|
103
|
+
watermelon.update_referencers = false
|
104
|
+
watermelon.name="grapefruit"
|
105
|
+
watermelon.save!
|
106
|
+
expect(lew.reload.content).to eq("likes [[watermelon]] and [[watermelon+seeds|seeds]]")
|
107
|
+
assert_equal lew.references_to.order(:id).map(&:ref_type), ['L','P','P','L'], "links should be a LINK"
|
108
|
+
assert_equal lew.references_to.order(:id).map(&:present), [ 0, 0, 1, 0 ], "only reference to +seeds should be present"
|
109
|
+
end
|
110
|
+
|
111
|
+
it "update referencing content on rename junction card" do
|
112
|
+
@ab = Card["A+B"] #linked to from X, included by Y
|
113
|
+
@ab.update_attributes! :name=>'Peanut+Butter', :update_referencers => true
|
114
|
+
@x = Card['X']
|
115
|
+
expect(@x.content).to eq("[[A]] [[Peanut+Butter]] [[T]]")
|
116
|
+
end
|
117
|
+
|
118
|
+
it "update referencing content on rename junction card" do
|
119
|
+
@ab = Card["A+B"] #linked to from X, included by Y
|
120
|
+
@ab.update_attributes! :name=>'Peanut+Butter', :update_referencers=>false
|
121
|
+
@x = Card['X']
|
122
|
+
expect(@x.content).to eq("[[A]] [[A+B]] [[T]]")
|
123
|
+
end
|
124
|
+
|
125
|
+
it "template inclusion" do
|
126
|
+
cardtype = Card.create! :name=>"ColorType", :type=>'Cardtype', :content=>""
|
127
|
+
Card.create! :name=>"ColorType+*type+*structure", :content=>"{{+rgb}}"
|
128
|
+
green = Card.create! :name=>"green", :type=>'ColorType'
|
129
|
+
rgb = newcard 'rgb'
|
130
|
+
green_rgb = Card.create! :name => "green+rgb", :content=>"#00ff00"
|
131
|
+
|
132
|
+
expect(green.reload.includees.map(&:name)).to eq(["green+rgb"])
|
133
|
+
expect(green_rgb.reload.includers.map(&:name)).to eq(['green'])
|
134
|
+
end
|
135
|
+
|
136
|
+
it "simple link" do
|
137
|
+
alpha = Card.create :name=>'alpha'
|
138
|
+
beta = Card.create :name=>'beta', :content=>"I link to [[alpha]]"
|
139
|
+
expect(Card['alpha'].referencers.map(&:name)).to eq(['beta'])
|
140
|
+
expect(Card['beta'].referees.map(&:name)).to eq(['alpha'])
|
141
|
+
end
|
142
|
+
|
143
|
+
it "link with spaces" do
|
144
|
+
alpha = Card.create! :name=>'alpha card'
|
145
|
+
beta = Card.create! :name=>'beta card', :content=>"I link to [[alpha_card|ALPHA CARD]]"
|
146
|
+
expect(Card['beta card'].referees.map(&:name)).to eq(['alpha card'])
|
147
|
+
expect(Card['alpha card'].referencers.map(&:name)).to eq(['beta card'])
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
it "simple inclusion" do
|
152
|
+
alpha = Card.create :name=>'alpha'
|
153
|
+
beta = Card.create :name=>'beta', :content=>"I include to {{alpha}}"
|
154
|
+
expect(Card['beta'].includees.map(&:name)).to eq(['alpha'])
|
155
|
+
expect(Card['alpha'].includers.map(&:name)).to eq(['beta'])
|
156
|
+
end
|
157
|
+
|
158
|
+
it "non simple link" do
|
159
|
+
alpha = Card.create :name=>'alpha'
|
160
|
+
beta = Card.create :name=>'beta', :content=>"I link to [[alpha|ALPHA]]"
|
161
|
+
expect(Card['beta'].referees.map(&:name)).to eq(['alpha'])
|
162
|
+
expect(Card['alpha'].referencers.map(&:name)).to eq(['beta'])
|
163
|
+
end
|
164
|
+
|
165
|
+
it "should handle commented inclusion" do
|
166
|
+
c = Card.create :name=>'inclusion comment test', :content=>'{{## hi mom }}'
|
167
|
+
expect(c.errors.any?).to be_falsey
|
168
|
+
end
|
169
|
+
|
170
|
+
|
171
|
+
it "pickup new links on create" do
|
172
|
+
@l = newcard("woof", "[[Lewdog]]") # no Lewdog card yet...
|
173
|
+
@e = newcard("Lewdog") # now there is
|
174
|
+
# NOTE @e.referencers does not work, you have to reload
|
175
|
+
expect(@e.reload.referencers.map(&:name).include?("woof")).not_to eq(nil)
|
176
|
+
end
|
177
|
+
|
178
|
+
it "pickup new inclusions on create" do
|
179
|
+
@l = Card.create! :name=>"woof", :content=>"{{Lewdog}}" # no Lewdog card yet...
|
180
|
+
@e = Card.new(:name=>"Lewdog", :content=>"grrr") # now there is
|
181
|
+
expect(@e.name_referencers.map(&:name).include?("woof")).not_to eq(nil)
|
182
|
+
end
|
183
|
+
|
184
|
+
=begin
|
185
|
+
|
186
|
+
# This test doesn't make much sense to me... LWH
|
187
|
+
it "revise changes references from wanted to linked for new cards" do
|
188
|
+
new_card = Card.create(:name=>'NewCard')
|
189
|
+
new_card.revise('Reference to [[WantedCard]], and to [[WantedCard2]]', Time.now, Card['quentin'].account),
|
190
|
+
new_format)
|
191
|
+
|
192
|
+
references = new_card.card_references(true)
|
193
|
+
references.size.should == 2
|
194
|
+
references[0].referee_key.should == 'WantedCard'
|
195
|
+
references[0].ref_type.should == Card::Reference::WANTED_PAGE
|
196
|
+
references[1].referee_key.should == 'WantedCard2'
|
197
|
+
references[1].ref_type.should == Card::Reference::WANTED_PAGE
|
198
|
+
|
199
|
+
wanted_card = Card.create(:name=>'WantedCard')
|
200
|
+
wanted_card.revise('And here it is!', Time.now, Card['quentin'].account), new_format)
|
201
|
+
|
202
|
+
# link type stored for NewCard -> WantedCard reference should change from WANTED to LINKED
|
203
|
+
# reference NewCard -> WantedCard2 should remain the same
|
204
|
+
references = new_card.card_references(true)
|
205
|
+
references.size.should == 2
|
206
|
+
references[0].referee_key.should == 'WantedCard'
|
207
|
+
references[0].ref_type.should == Card::Reference::LINKED_PAGE
|
208
|
+
references[1].referee_key.should == 'WantedCard2'
|
209
|
+
references[1].ref_type.should == Card::Reference::WANTED_PAGE
|
210
|
+
end
|
211
|
+
=end
|
212
|
+
|
213
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
module SetPatternSpecHelper
|
4
|
+
def it_generates( opts )
|
5
|
+
name = opts[:name]
|
6
|
+
card = opts[:from]
|
7
|
+
it "generates name '#{name}' for card '#{card.name}'" do
|
8
|
+
expect(described_class.new(card).to_s).to eq(name)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
include SetPatternSpecHelper
|
14
|
+
|
15
|
+
describe Card::SetPattern do
|
16
|
+
end
|
17
|
+
|
18
|
+
#FIXME - these should probably be in pattern-specific specs, though that may not leave much to test in the base class :)
|
19
|
+
|
20
|
+
describe Card::RightSet do
|
21
|
+
it_generates :name => "author+*right", :from => Card.new( :name => "Iliad+author" )
|
22
|
+
it_generates :name => "author+*right", :from => Card.new( :name => "+author" )
|
23
|
+
end
|
24
|
+
|
25
|
+
describe Card::TypeSet do
|
26
|
+
it_generates :name => "Book+*type", :from => Card.new( :type => "Book" )
|
27
|
+
end
|
28
|
+
|
29
|
+
describe Card::TypeSet do
|
30
|
+
before :each do
|
31
|
+
Card::Auth.as_bot do
|
32
|
+
@mylist = Card.create! :name=>'MyList', :type_id=>Card::CardtypeID
|
33
|
+
Card.create :name=>'MyList+*type+*default', :type_id=>Card::PointerID
|
34
|
+
end
|
35
|
+
@mylist_card = Card.create :name=>'ip', :type_id=>@mylist.id
|
36
|
+
end
|
37
|
+
# similar tests for an inherited type of Pointer
|
38
|
+
it 'has inherited set module' do
|
39
|
+
expect(@mylist_card.set_format_modules(Card::HtmlFormat)).to include(Card::Set::Type::Pointer::HtmlFormat)
|
40
|
+
expect(@mylist_card.set_format_modules(Card::CssFormat)).to include(Card::Set::Type::Pointer::CssFormat)
|
41
|
+
expect(@mylist_card.set_format_modules(Card::JsFormat)).to include(Card::Set::Type::Pointer::JsFormat)
|
42
|
+
expect(@mylist_card.set_modules).to include(Card::Set::Type::Pointer)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe Card::AllPlusSet do
|
47
|
+
it_generates :name => "*all plus", :from => Card.new( :name => "Book+author" )
|
48
|
+
end
|
49
|
+
|
50
|
+
describe Card::AllSet do
|
51
|
+
it_generates :name => "*all", :from => Card.new( :type => "Book" )
|
52
|
+
end
|
53
|
+
|
54
|
+
describe Card::TypePlusRightSet do
|
55
|
+
it_generates :name => "Book+author+*type plus right", :from => Card.new( :name=>"Iliad+author" )
|
56
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
# module Card::Set::Right::Account # won't this conflict with a real set (and fail to provide controlled test?)
|
4
|
+
# extend Card::Set
|
5
|
+
#
|
6
|
+
# card_accessor :role, :default => "request", :type=>:phrase
|
7
|
+
# card_writer :write, :default => "request", :type=>:phrase
|
8
|
+
# card_reader :read, :default => "request", :type=>:phrase
|
9
|
+
# end
|
10
|
+
#
|
11
|
+
# describe Card do
|
12
|
+
# before do
|
13
|
+
# @account_card = Card['sara'].fetch :trait=>:account
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# describe "Read and write card attribute" do
|
17
|
+
# it "gets email attribute" do
|
18
|
+
# expect(@account_card.role).to eq('request')
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# it "shouldn't have a reader method for card_writer" do
|
22
|
+
# expect(@account_card.respond_to?( :write)).to be_falsey
|
23
|
+
# expect(@account_card.method( :write= )).to be
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# it "shouldn't have a reader method for card_reader" do
|
27
|
+
# expect(@account_card.method( :read)).to be
|
28
|
+
# expect(@account_card.respond_to?( :read= )).to be_falsey
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# it "sets and saves attribute" do
|
32
|
+
# @account_card.write= 'test_value'
|
33
|
+
# @account_card.status= 'pending'
|
34
|
+
# # @account_card.status.should == 'pending'
|
35
|
+
# Card::Auth.as_bot { @account_card.save }
|
36
|
+
# # Card.cache.reset
|
37
|
+
# expect(tcard = Card['sara'].fetch(:trait=>:account)).to be
|
38
|
+
# expect(tcard.status).to eq('pending')
|
39
|
+
# expect(tcard.fetch(:trait=>:write).content).to eq('test_value')
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# let(:card) { Card.new(:name=>'simple') }
|
45
|
+
# let(:card_self) { Card.new(:name=>'*navbox') }
|
46
|
+
# let(:card_right) { Card.new(:name=>'card+*right') }
|
47
|
+
# let(:card_type_search) { Card.new(:name=>'search_me', :type=>Card::SearchID) }
|
48
|
+
# let(:card_double) { Card }
|
49
|
+
# let(:format_double) { object_double(Card.new(:name=>'card+*right').format) }
|
50
|
+
#
|
51
|
+
# #let(:html_format_double) { Card::HtmlFormat }
|
52
|
+
# let(:html_format_double) { double("Card::HtmlFormat") }
|
53
|
+
#
|
54
|
+
# it "should define Formatter methods from modules" do
|
55
|
+
# expect(format_double).to respond_to(:render_navbox_self_core)
|
56
|
+
# expect(format_double.method(:render_navbox_self_core)).to be
|
57
|
+
# expect(format_double.method(:_render_right_right_raw)).to be
|
58
|
+
# expect(format_double.method(:render_type_search_core)).to be
|
59
|
+
# expect(format_double.method(:_final_type_search_raw)).to be
|
60
|
+
# end
|
61
|
+
# it "should call set render methods" do
|
62
|
+
# expect(card_self).to receive(:_final_self_navbox_core)
|
63
|
+
# card_self.format.render_core
|
64
|
+
# #expect(card_right.format.method(:_render_right_right_raw)).to be
|
65
|
+
# #expect(card_right.format).to respond_to(:_render_right_right_raw)
|
66
|
+
# card_right.format.render_core
|
67
|
+
# expect(card_type_search.method(:render_type_search_core)).to be
|
68
|
+
# card_type_search.format.render_core
|
69
|
+
# expect(card.method(:_final_type_search_raw)).to be
|
70
|
+
# card.format.render_core
|
71
|
+
# end
|
72
|
+
# it "should define Formatter methods from modules" do
|
73
|
+
# expect(html_format_double.method(:render_self_navbox_core)).to be
|
74
|
+
# expect(html_format_double.method(:_render_right_right_raw)).to be
|
75
|
+
# expect(html_format_double.method(:render_type_search_core)).to be
|
76
|
+
# expect(html_format_double.method(:_final_type_search_raw)).to be
|
77
|
+
# end
|
78
|
+
# it "should define Formatter methods from modules" do
|
79
|
+
# expect(card_self).to receive(:_final_self_navbox_titled)
|
80
|
+
# card_self.render_titled
|
81
|
+
# expect(card_right.method(:_render_right_right_edit)).to be
|
82
|
+
# card_right.render_edit
|
83
|
+
# expect(card_type_search.method(:render_type_search_menu)).to be
|
84
|
+
# card_type_search.render_menu
|
85
|
+
# expect(card.method(:_final_type_search_content)).to be
|
86
|
+
# card.render_content
|
87
|
+
# end
|
88
|
+
# end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'card/mailer'
|
3
|
+
|
4
|
+
describe Card::Mailer do
|
5
|
+
#include ActionMailer::Quoting
|
6
|
+
|
7
|
+
before do
|
8
|
+
ActionMailer::Base.deliveries = []
|
9
|
+
|
10
|
+
@expected = Mail.new
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
## see notifier test for data used in these tests
|
15
|
+
# FIXME: the cache is not cleared properly between tests. if the order changes
|
16
|
+
# (ie try renamed change notice below to change_notice) then *notify+*from gets stuck on.
|
17
|
+
# context "change notice" do
|
18
|
+
# before do
|
19
|
+
# user = Card['sara'].id
|
20
|
+
# card = Card["Sunglasses"]
|
21
|
+
# action = "edited"
|
22
|
+
# Card::Mailer.change_notice( user, card, action, card.name ).deliver
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# it "deliver a message" do
|
26
|
+
# assert_equal 1, ActionMailer::Base.deliveries.size
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# context "change notice message" do
|
30
|
+
# before do
|
31
|
+
# @mail = ActionMailer::Base.deliveries[0]
|
32
|
+
# end
|
33
|
+
# it "is addressed to users email" do
|
34
|
+
# assert_equal ["sara@user.com"], @mail.to
|
35
|
+
# end
|
36
|
+
# it "is from Wag bot email" do
|
37
|
+
# assert_equal [Card[Card::WagnBotID].account.email], @mail.from
|
38
|
+
# end
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# describe "flexmail" do
|
43
|
+
# # FIXME: at least two tests should be here, with & w/o attachment.
|
44
|
+
# end
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
# describe "cardmail" do
|
49
|
+
# before do
|
50
|
+
# Card.gimme "mailtest", :content => "test"
|
51
|
+
# end
|
52
|
+
# it "renders email text" do
|
53
|
+
# Card::Mailer.cardmail(:to => "sara@user.com").deliver
|
54
|
+
# @mail = ActionMailer::Base.deliveries.last
|
55
|
+
# expect(@mail.body).to eq("test")
|
56
|
+
# end
|
57
|
+
# end
|
58
|
+
|
59
|
+
private
|
60
|
+
def encode(subject)
|
61
|
+
quoted_printable(subject, Card::Mailer::CHARSET)
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
@@ -0,0 +1,216 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
class Card
|
4
|
+
# REVIEW: hooks api will do this differently, probably should remove and add new tests elsewhere
|
5
|
+
# this is used by some type based modules on CardtypeE from type_transition
|
6
|
+
cattr_accessor :count
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "Card (Cardtype)" do
|
10
|
+
|
11
|
+
it "should not allow cardtype remove when instances present" do
|
12
|
+
Card.create :name=>'City', :type=>'Cardtype'
|
13
|
+
city = Card.fetch('City')
|
14
|
+
c1=Card.create :name=>'Sparta', :type=>'City'
|
15
|
+
c2=Card.create :name=>'Eugene', :type=>'City'
|
16
|
+
assert_equal ['Eugene','Sparta'], Card.search(:type=>'City').map(&:name).sort
|
17
|
+
assert_raises ActiveRecord::RecordInvalid do
|
18
|
+
city.delete!
|
19
|
+
end
|
20
|
+
# make sure it wasn't deleted / trashed
|
21
|
+
expect(Card['City']).not_to be_nil
|
22
|
+
end
|
23
|
+
|
24
|
+
it "remove cardtype" do
|
25
|
+
Card.create! :name=>'County', :type=>'Cardtype'
|
26
|
+
c = Card['County']
|
27
|
+
c.delete
|
28
|
+
end
|
29
|
+
|
30
|
+
it "cardtype creation and dynamic cardtype" do
|
31
|
+
|
32
|
+
assert Card.create( :name=>'BananaPudding', :type=>'Cardtype' ).type_id == Card::Codename[:cardtype]
|
33
|
+
assert_instance_of Card, c=Card.fetch("BananaPudding")
|
34
|
+
|
35
|
+
# you have to have a module to include or it's just a Basic (type_code fielde excepted)
|
36
|
+
cd = Card.create(:type=>'banana_pudding',:name=>"figgy" )
|
37
|
+
assert cd.type_name == 'BananaPudding'
|
38
|
+
assert Card.find_by_type_id(c.id)
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "conversion to cardtype" do
|
42
|
+
before do
|
43
|
+
@card = Card.create!(:type=>'Cardtype', :name=>'Cookie')
|
44
|
+
expect(@card.type_name).to eq('Cardtype')
|
45
|
+
end
|
46
|
+
|
47
|
+
it "creates cardtype model and permission" do
|
48
|
+
@card.type_id = Card.fetch_id('cookie')
|
49
|
+
@card.save!
|
50
|
+
expect(@card.type_name).to eq('Cookie')
|
51
|
+
@card=Card['Cookie']
|
52
|
+
assert_instance_of Card, @card
|
53
|
+
expect(@card.type_code).to eq(nil) # :cookie
|
54
|
+
assert_equal 'Cookie', Card.create!( :name=>'Oreo', :type=>'Cookie' ).type_name
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
it "cardtype" do
|
59
|
+
Card.find(:all).each do |card|
|
60
|
+
assert !card.type_card.nil?
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
describe Card, "created without permission" do
|
68
|
+
before do
|
69
|
+
Card::Auth.current_id = Card::AnonymousID
|
70
|
+
end
|
71
|
+
|
72
|
+
# FIXME: this one should pass. unfortunately when I tried to fix it it started looking like the clean solution
|
73
|
+
# was to rewrite most of the permissions section as simple validations and i decided not to go down that rabbit hole.
|
74
|
+
#
|
75
|
+
#it "should not be valid" do
|
76
|
+
# Card.new( :name=>'foo', :type=>'Cardtype').valid?.should_not be_true
|
77
|
+
#end
|
78
|
+
|
79
|
+
it "should not create a new cardtype until saved" do
|
80
|
+
expect {
|
81
|
+
Card.new( :name=>'foo', :type=>'Cardtype')
|
82
|
+
}.not_to change(Card, :count)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
describe Card, "Normal card with dependents" do
|
88
|
+
before do
|
89
|
+
@a = Card['A']
|
90
|
+
end
|
91
|
+
it "should confirm that it has dependents" do
|
92
|
+
expect(@a.dependents.length).to be > 0
|
93
|
+
end
|
94
|
+
it "should successfully have its type changed" do
|
95
|
+
Card::Auth.as_bot do
|
96
|
+
@a.type_id = Card::PhraseID;
|
97
|
+
@a.save!
|
98
|
+
expect(Card['A'].type_code).to eq(:phrase)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
it "should still have its dependents after changing type" do
|
102
|
+
Card::Auth.as_bot do
|
103
|
+
assert type_id = Card.fetch_id('cardtype_e')
|
104
|
+
@a.type_id = type_id; @a.save!
|
105
|
+
expect(Card['A'].dependents.length).to be > 0
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
=begin No extension any more, is there a modified version of this we need?
|
112
|
+
describe Card, "Recreated Card" do
|
113
|
+
before do
|
114
|
+
Card::Auth.as_bot do
|
115
|
+
@ct = Card.create! :name=>'Species', :type=>'Cardtype'
|
116
|
+
@ct.delete!
|
117
|
+
@ct = Card.create! :name=>'Species', :type=>'Cardtype'
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
it "should have a cardtype extension" do
|
122
|
+
@ct.extension.should_not be_nil
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
=end
|
127
|
+
|
128
|
+
describe Card, "New Cardtype" do
|
129
|
+
before do
|
130
|
+
Card::Auth.as_bot do
|
131
|
+
@ct = Card.create! :name=>'Animal', :type=>'Cardtype'
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should have create permissions" do
|
136
|
+
expect(@ct.who_can(:create)).not_to be_nil
|
137
|
+
end
|
138
|
+
|
139
|
+
it "its create permissions should be based on Basic" do
|
140
|
+
expect(@ct.who_can(:create)).to eq(Card['Basic'].who_can(:create))
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe Card, "Wannabe Cardtype Card" do
|
145
|
+
before do
|
146
|
+
Card::Auth.as_bot do
|
147
|
+
@card = Card.create! :name=> 'convertible'
|
148
|
+
@card.type_id=Card::CardtypeID
|
149
|
+
@card.save!
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
153
|
+
it "should successfully change its type to a Cardtype" do
|
154
|
+
expect(Card['convertible'].type_code).to eq(:cardtype)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
describe Card, "Joe User" do
|
159
|
+
before do
|
160
|
+
Card::Auth.as_bot do
|
161
|
+
@r3 = Card['r3']
|
162
|
+
Card.create :name=>'Cardtype F+*type+*create', :type=>'Pointer', :content=>'[[r3]]'
|
163
|
+
end
|
164
|
+
|
165
|
+
@ucard = Card::Auth.current
|
166
|
+
@type_names = Card::Auth.createable_types
|
167
|
+
end
|
168
|
+
|
169
|
+
it "should not have r3 permissions" do
|
170
|
+
expect(@ucard.fetch(:new=>{}, :trait=>:roles).item_names.member?(@r3.name)).to be_falsey
|
171
|
+
end
|
172
|
+
it "should ponder creating a card of Cardtype F, but find that he lacks create permissions" do
|
173
|
+
expect(Card.new(:type=>'Cardtype F').ok?(:create)).to be_falsey
|
174
|
+
end
|
175
|
+
it "should not find Cardtype F on its list of createable cardtypes" do
|
176
|
+
expect(@type_names.member?('Cardtype F')).to be_falsey
|
177
|
+
end
|
178
|
+
it "should find Basic on its list of createable cardtypes" do
|
179
|
+
expect(@type_names.member?('Basic')).to be_truthy
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
183
|
+
|
184
|
+
|
185
|
+
describe Card, "Cardtype with Existing Cards" do
|
186
|
+
before do
|
187
|
+
@ct = Card['Cardtype F']
|
188
|
+
end
|
189
|
+
it "should have existing cards of that type" do
|
190
|
+
expect(Card.search(:type=>@ct.name)).not_to be_empty
|
191
|
+
end
|
192
|
+
|
193
|
+
it "should raise an error when you try to delete it" do
|
194
|
+
Card::Auth.as_bot do
|
195
|
+
@ct.delete
|
196
|
+
expect(@ct.errors[:cardtype]).not_to be_empty
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
|
202
|
+
describe Card::Set::Type::Cardtype do
|
203
|
+
|
204
|
+
it "should handle changing away from Cardtype" do
|
205
|
+
Card::Auth.as_bot do
|
206
|
+
ctg = Card.create! :name=>"CardtypeG", :type=>"Cardtype"
|
207
|
+
ctg.type_id = Card::BasicID
|
208
|
+
ctg.save!
|
209
|
+
ctg = Card["CardtypeG"]
|
210
|
+
expect(ctg.type_code).to eq(:basic)
|
211
|
+
#ctg.extension.should == nil
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
|