card 1.16.6 → 1.16.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardoc/checksums +234 -49
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/VERSION +1 -1
- data/config/initializers/mime_types.rb +3 -3
- data/config/initializers/notification.rb +1 -1
- data/db/migrate/20121118115000_update_link_type.rb +8 -8
- data/db/migrate/20130411210957_update_codenames.rb +2 -2
- data/db/migrate/20140822073704_create_new_revision_tables.rb +12 -13
- data/db/migrate/20141001105348_move_revisions_to_actions.rb +16 -16
- data/db/migrate/20141121172918_rename_card_migration_table.rb +4 -4
- data/db/migrate_core_cards/20130419215612_import_help_text.rb +3 -3
- data/db/migrate_core_cards/20130823192433_add_style_cards.rb +45 -47
- data/db/migrate_core_cards/20130910183318_move_styles_to_content.rb +1 -1
- data/db/migrate_core_cards/20130920214038_jsonize_tinymce.rb +3 -3
- data/db/migrate_core_cards/20130920291703_update_stylesheets.rb +3 -3
- data/db/migrate_core_cards/20130927191728_account_events.rb +6 -6
- data/db/migrate_core_cards/20131016172445_common_css_patch.rb +1 -1
- data/db/migrate_core_cards/20140110193325_reset_account_request_type.rb +1 -1
- data/db/migrate_core_cards/20140307231621_user_data_to_cards.rb +19 -19
- data/db/migrate_core_cards/20140317035504_account_requests_to_signups.rb +11 -12
- data/db/migrate_core_cards/20140512155840_add_script_cards.rb +35 -36
- data/db/migrate_core_cards/20140629222005_add_email_cards.rb +55 -55
- data/db/migrate_core_cards/20140725180118_config_card_updates.rb +1 -1
- data/db/migrate_core_cards/20141111083921_delete_machine_output.rb +2 -2
- data/db/migrate_core_cards/20141115034214_config_descriptions_etc.rb +3 -3
- data/db/migrate_core_cards/20141120120605_fix_notification_html_message.rb +2 -2
- data/db/migrate_core_cards/20141204061304_watchers_to_following.rb +8 -8
- data/db/migrate_core_cards/20141208162106_add_ace_script.rb +2 -2
- data/db/migrate_core_cards/20141216155251_add_more_following_cards.rb +16 -16
- data/db/migrate_core_cards/20141230204340_uri_codename.rb +1 -1
- data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +19 -19
- data/db/migrate_core_cards/20150220134731_following_to_follow_rule.rb +3 -3
- data/db/migrate_core_cards/20150317162412_bootstrap_themes.rb +15 -15
- data/db/migrate_core_cards/20150326205655_bootswatch_themes.rb +11 -11
- data/db/migrate_core_cards/20150331135745_new_card_menu.rb +1 -1
- data/db/migrate_core_cards/20150429090551_search_card_context.rb +1 -1
- data/db/migrate_core_cards/20150508212032_menu_compatibility.rb +3 -3
- data/db/migrate_core_cards/20150510031118_fix_skin_images.rb +1 -1
- data/db/migrate_core_cards/20150528084659_add_session_cardtype.rb +4 -4
- data/db/migrate_core_cards/20150601133433_add_recent_setting_session_card.rb +5 -5
- data/db/migrate_core_cards/20150605115802_add_performance_log_card.rb +1 -1
- data/db/migrate_core_cards/20150610171702_add_debugger_session_card.rb +2 -2
- data/db/migrate_core_cards/20150611203506_rails_inflection_updates.rb +5 -5
- data/db/migrate_core_cards/20150627205133_fix_script_bootstrap_card_type.rb +1 -1
- data/db/migrate_core_cards/20150702130543_remove_edit_toolbar_pinned.rb +1 -1
- data/db/migrate_core_cards/20150724123438_update_file_and_image_cards.rb +5 -5
- data/db/migrate_core_cards/20150807205221_create_references_for_search_cards.rb +1 -1
- data/db/migrate_core_cards/20150824135418_update_file_history.rb +3 -3
- data/db/migrate_core_cards/20150903130006_attachment_upload_cards.rb +2 -2
- data/db/migrate_core_cards/20150910085603_remove_performance_log_card.rb +1 -1
- data/lib/card.rb +4 -4
- data/lib/card/active_record_ext.rb +8 -8
- data/lib/card/auth.rb +6 -6
- data/lib/card/cache.rb +1 -1
- data/lib/card/chunk.rb +1 -1
- data/lib/card/content.rb +1 -1
- data/lib/card/diff.rb +10 -10
- data/lib/card/env.rb +1 -1
- data/lib/card/format.rb +12 -12
- data/lib/card/loader.rb +1 -1
- data/lib/card/migration.rb +1 -1
- data/lib/card/name.rb +4 -4
- data/lib/card/query.rb +255 -61
- data/lib/card/query/attributes.rb +310 -0
- data/lib/card/query/clause.rb +12 -15
- data/lib/card/query/join.rb +73 -0
- data/lib/card/query/reference.rb +51 -0
- data/lib/card/query/sql_statement.rb +228 -0
- data/lib/card/query/value.rb +66 -0
- data/lib/card/reference.rb +6 -6
- data/lib/card/set.rb +12 -12
- data/lib/card/set_pattern.rb +9 -9
- data/lib/card/spec_helper.rb +5 -5
- data/lib/card/success.rb +1 -1
- data/lib/cardio.rb +7 -7
- data/lib/generators/card/format/format_generator.rb +3 -3
- data/lib/generators/card/migration/migration_generator.rb +5 -5
- data/lib/generators/card/set/set_generator.rb +4 -4
- data/mod/01_core/chunk/include.rb +4 -4
- data/mod/01_core/chunk/link.rb +5 -5
- data/mod/01_core/chunk/literal.rb +2 -2
- data/mod/01_core/chunk/query_reference.rb +8 -8
- data/mod/01_core/chunk/uri.rb +18 -18
- data/mod/01_core/format/html_format.rb +4 -4
- data/mod/01_core/set/all/active_card.rb +2 -2
- data/mod/01_core/set/all/collection.rb +21 -26
- data/mod/01_core/set/all/content.rb +2 -2
- data/mod/01_core/set/all/fetch.rb +6 -6
- data/mod/01_core/set/all/initialize.rb +4 -4
- data/mod/01_core/set/all/location_history.rb +2 -2
- data/mod/01_core/set/all/name.rb +14 -14
- data/mod/01_core/set/all/pattern.rb +1 -1
- data/mod/01_core/set/all/permissions.rb +12 -12
- data/mod/01_core/set/all/phases.rb +29 -12
- data/mod/01_core/set/all/references.rb +14 -14
- data/mod/01_core/set/all/rules.rb +8 -8
- data/mod/01_core/set/all/templating.rb +10 -9
- data/mod/01_core/set/all/tracked_attributes.rb +7 -7
- data/mod/01_core/set/all/trash.rb +6 -6
- data/mod/01_core/set/all/type.rb +7 -7
- data/mod/01_core/set/all/utils.rb +4 -4
- data/mod/01_core/set/all/view_cache.rb +1 -1
- data/mod/01_core/set_pattern/02_all_plus.rb +2 -2
- data/mod/01_core/set_pattern/03_type.rb +1 -1
- data/mod/01_core/set_pattern/04_star.rb +1 -1
- data/mod/01_core/set_pattern/05_rstar.rb +2 -2
- data/mod/01_core/set_pattern/06_right.rb +4 -4
- data/mod/01_core/set_pattern/07_type_plus_right.rb +4 -4
- data/mod/01_core/set_pattern/08_self.rb +1 -1
- data/mod/01_core/spec/chunk/uri_spec.rb +73 -73
- data/mod/01_core/spec/format/html_format_spec.rb +5 -5
- data/mod/01_core/spec/set/all/attribute_tracking_spec.rb +1 -1
- data/mod/01_core/spec/set/all/collection_spec.rb +22 -22
- data/mod/01_core/spec/set/all/content_spec.rb +1 -1
- data/mod/01_core/spec/set/all/fetch_spec.rb +24 -24
- data/mod/01_core/spec/set/all/initialize_spec.rb +9 -9
- data/mod/01_core/spec/set/all/name_spec.rb +8 -8
- data/mod/01_core/spec/set/all/pattern_spec.rb +10 -10
- data/mod/01_core/spec/set/all/permissions_spec.rb +45 -45
- data/mod/01_core/spec/set/all/references_spec.rb +1 -1
- data/mod/01_core/spec/set/all/rules2_spec.rb +15 -15
- data/mod/01_core/spec/set/all/rules_spec.rb +37 -37
- data/mod/01_core/spec/set/all/templating_spec.rb +21 -21
- data/mod/01_core/spec/set/all/tracked_attributes_spec.rb +55 -55
- data/mod/01_core/spec/set/all/trash_spec.rb +4 -4
- data/mod/01_core/spec/set/all/type_spec.rb +15 -15
- data/mod/01_history/lib/card/act.rb +2 -2
- data/mod/01_history/lib/card/action.rb +22 -22
- data/mod/01_history/lib/card/change.rb +1 -1
- data/mod/01_history/set/all/actions.rb +2 -2
- data/mod/01_history/set/all/content_history.rb +4 -4
- data/mod/01_history/set/all/history.rb +46 -46
- data/mod/02_basic_types/set/all/all_css.rb +10 -10
- data/mod/02_basic_types/set/all/all_csv.rb +7 -7
- data/mod/02_basic_types/set/all/base.rb +25 -25
- data/mod/02_basic_types/set/all/json.rb +16 -16
- data/mod/02_basic_types/set/all/rss.rb +7 -7
- data/mod/02_basic_types/set/type/html.rb +2 -2
- data/mod/02_basic_types/set/type/plain_text.rb +1 -1
- data/mod/02_basic_types/set/type/pointer.rb +39 -31
- data/mod/02_basic_types/spec/set/all/all_css_spec.rb +1 -1
- data/mod/02_basic_types/spec/set/all/all_csv_spec.rb +1 -1
- data/mod/02_basic_types/spec/set/all/base_spec.rb +18 -18
- data/mod/02_basic_types/spec/set/all/json_spec.rb +4 -4
- data/mod/02_basic_types/spec/set/all/rss_spec.rb +8 -2
- data/mod/02_basic_types/spec/set/type/plain_text_spec.rb +1 -1
- data/mod/02_basic_types/spec/set/type/pointer_spec.rb +54 -44
- data/mod/03_machines/lib/card/machine.rb +46 -29
- data/mod/03_machines/lib/card/machine_input.rb +34 -10
- data/mod/03_machines/set/type/coffee_script.rb +3 -3
- data/mod/03_machines/set/type/css.rb +8 -8
- data/mod/03_machines/set/type/java_script.rb +4 -4
- data/mod/03_machines/set/type/scss.rb +2 -2
- data/mod/03_machines/set/type/skin.rb +1 -1
- data/mod/03_machines/spec/lib/shared_machine_examples.rb +27 -27
- data/mod/03_machines/spec/lib/shared_machine_input_examples.rb +8 -8
- data/mod/03_machines/spec/set/type/coffeescript_spec.rb +6 -6
- data/mod/03_machines/spec/set/type/css_spec.rb +9 -9
- data/mod/03_machines/spec/set/type/javascript_spec.rb +6 -6
- data/mod/03_machines/spec/set/type/scss_spec.rb +5 -5
- data/mod/03_machines/spec/set/type/skin_spec.rb +25 -25
- data/mod/04_settings/lib/card/setting.rb +11 -11
- data/mod/04_settings/set/abstract/permission.rb +9 -9
- data/mod/04_settings/set/right/script.rb +1 -1
- data/mod/04_settings/set/right/structure.rb +0 -5
- data/mod/04_settings/set/right/style.rb +2 -2
- data/mod/04_settings/set/self/accountable.rb +1 -1
- data/mod/04_settings/set/self/add_help.rb +1 -1
- data/mod/04_settings/set/self/autoname.rb +1 -1
- data/mod/04_settings/set/self/captcha.rb +1 -1
- data/mod/04_settings/set/self/create.rb +1 -1
- data/mod/04_settings/set/self/default.rb +1 -1
- data/mod/04_settings/set/self/delete.rb +1 -1
- data/mod/04_settings/set/self/help.rb +1 -1
- data/mod/04_settings/set/self/input.rb +1 -1
- data/mod/04_settings/set/self/layout.rb +1 -1
- data/mod/04_settings/set/self/on_create.rb +1 -1
- data/mod/04_settings/set/self/on_delete.rb +1 -1
- data/mod/04_settings/set/self/on_update.rb +1 -1
- data/mod/04_settings/set/self/options.rb +1 -1
- data/mod/04_settings/set/self/options_label.rb +1 -1
- data/mod/04_settings/set/self/read.rb +1 -1
- data/mod/04_settings/set/self/script.rb +1 -1
- data/mod/04_settings/set/self/structure.rb +1 -1
- data/mod/04_settings/set/self/style.rb +1 -1
- data/mod/04_settings/set/self/table_of_contents.rb +1 -1
- data/mod/04_settings/set/self/thanks.rb +1 -1
- data/mod/04_settings/set/self/update.rb +1 -1
- data/mod/04_settings/set/type/setting.rb +14 -14
- data/mod/04_settings/spec/set/right/comment_spec.rb +5 -5
- data/mod/04_settings/spec/set/right/create_spec.rb +1 -1
- data/mod/04_settings/spec/set/right/script_spec.rb +5 -5
- data/mod/04_settings/spec/set/right/structure_spec.rb +4 -2
- data/mod/04_settings/spec/set/right/style_spec.rb +7 -7
- data/mod/04_settings/spec/set/type/setting_spec.rb +2 -2
- data/mod/05_email/lib/card/follow_option.rb +24 -24
- data/mod/05_email/set/all/follow.rb +24 -16
- data/mod/05_email/set/all/notify.rb +25 -23
- data/mod/05_email/set/all/observer.rb +5 -5
- data/mod/05_email/set/right/bcc.rb +8 -8
- data/mod/05_email/set/right/follow.rb +44 -17
- data/mod/05_email/set/right/follow_fields.rb +1 -1
- data/mod/05_email/set/right/following.rb +49 -40
- data/mod/05_email/set/self/always.rb +2 -2
- data/mod/05_email/set/self/created.rb +1 -1
- data/mod/05_email/set/self/edited.rb +4 -4
- data/mod/05_email/set/self/follow.rb +1 -1
- data/mod/05_email/set/self/follow_defaults.rb +9 -9
- data/mod/05_email/set/self/never.rb +1 -1
- data/mod/05_email/set/type/email_template.rb +9 -9
- data/mod/05_email/set/type_plus_right/user/follow.rb +16 -16
- data/mod/05_email/spec/set/all/follow_spec.rb +10 -10
- data/mod/05_email/spec/set/all/notify_spec.rb +82 -82
- data/mod/05_email/spec/set/all/observer_spec.rb +16 -16
- data/mod/05_email/spec/set/right/followers_spec.rb +6 -6
- data/mod/05_email/spec/set/self/follow_defaults_spec.rb +2 -2
- data/mod/05_standard/lib/carrier_wave/cardmount.rb +5 -5
- data/mod/05_standard/lib/image_uploader.rb +8 -8
- data/mod/05_standard/set/abstract/attachment.rb +18 -18
- data/mod/05_standard/set/all/account.rb +5 -5
- data/mod/05_standard/set/all/comment.rb +7 -7
- data/mod/05_standard/set/all/error.rb +25 -25
- data/mod/05_standard/set/all/event_viz.rb +1 -1
- data/mod/05_standard/set/all/links.rb +9 -9
- data/mod/05_standard/set/all/rich_html/content.rb +34 -34
- data/mod/05_standard/set/all/rich_html/editing.rb +35 -35
- data/mod/05_standard/set/all/rich_html/form.rb +20 -20
- data/mod/05_standard/set/all/rich_html/header.rb +8 -8
- data/mod/05_standard/set/all/rich_html/menu.rb +33 -33
- data/mod/05_standard/set/all/rich_html/modal.rb +16 -16
- data/mod/05_standard/set/all/rich_html/toolbar.rb +63 -63
- data/mod/05_standard/set/all/rich_html/wrapper.rb +8 -8
- data/mod/05_standard/set/right/account.rb +27 -27
- data/mod/05_standard/set/right/email.rb +5 -5
- data/mod/05_standard/set/right/password.rb +5 -5
- data/mod/05_standard/set/rstar/rules.rb +52 -52
- data/mod/05_standard/set/self/account_links.rb +27 -27
- data/mod/05_standard/set/self/all.rb +1 -1
- data/mod/05_standard/set/self/head.rb +5 -5
- data/mod/05_standard/set/self/navbox.rb +11 -11
- data/mod/05_standard/set/self/recent.rb +2 -2
- data/mod/05_standard/set/self/search.rb +13 -13
- data/mod/05_standard/set/self/signin.rb +19 -19
- data/mod/05_standard/set/self/stats.rb +2 -2
- data/mod/05_standard/set/type/basic.rb +1 -1
- data/mod/05_standard/set/type/cardtype.rb +5 -5
- data/mod/05_standard/set/type/date.rb +1 -1
- data/mod/05_standard/set/type/file.rb +7 -7
- data/mod/05_standard/set/type/image.rb +8 -8
- data/mod/05_standard/set/type/number.rb +2 -2
- data/mod/05_standard/set/type/phrase.rb +1 -1
- data/mod/05_standard/set/type/search_type.rb +27 -21
- data/mod/05_standard/set/type/session.rb +2 -2
- data/mod/05_standard/set/type/set.rb +37 -37
- data/mod/05_standard/set/type/signup.rb +25 -25
- data/mod/05_standard/set/type/uri.rb +1 -1
- data/mod/05_standard/set/type/user.rb +21 -21
- data/mod/05_standard/spec/chunk/include_spec.rb +16 -16
- data/mod/05_standard/spec/chunk/link_spec.rb +18 -18
- data/mod/05_standard/spec/chunk/query_reference_spec.rb +1 -1
- data/mod/05_standard/spec/set/all/account_spec.rb +7 -7
- data/mod/05_standard/spec/set/all/email_html_spec.rb +3 -3
- data/mod/05_standard/spec/set/all/history_spec.rb +14 -14
- data/mod/05_standard/spec/set/all/rich_html/editing_spec.rb +1 -1
- data/mod/05_standard/spec/set/all/rich_html/form_spec.rb +2 -2
- data/mod/05_standard/spec/set/right/account_spec.rb +9 -9
- data/mod/05_standard/spec/set/right/email_spec.rb +8 -8
- data/mod/05_standard/spec/set/right/password_spec.rb +9 -9
- data/mod/05_standard/spec/set/right/stats_spec.rb +1 -1
- data/mod/05_standard/spec/set/right/when_created_spec.rb +1 -1
- data/mod/05_standard/spec/set/right/when_last_edited_spec.rb +1 -1
- data/mod/05_standard/spec/set/rstar/rules_spec.rb +2 -2
- data/mod/05_standard/spec/set/self/account_links_spec.rb +2 -2
- data/mod/05_standard/spec/set/self/all_spec.rb +8 -11
- data/mod/05_standard/spec/set/self/head_spec.rb +1 -1
- data/mod/05_standard/spec/set/self/navbox_spec.rb +1 -1
- data/mod/05_standard/spec/set/self/now_spec.rb +1 -1
- data/mod/05_standard/spec/set/self/stats_spec.rb +1 -1
- data/mod/05_standard/spec/set/self/version_spec.rb +1 -1
- data/mod/05_standard/spec/set/type/email_template_spec.rb +25 -25
- data/mod/05_standard/spec/set/type/file_spec.rb +4 -4
- data/mod/05_standard/spec/set/type/html_spec.rb +3 -3
- data/mod/05_standard/spec/set/type/image_spec.rb +6 -6
- data/mod/05_standard/spec/set/type/layout_type_spec.rb +1 -1
- data/mod/05_standard/spec/set/type/search_type_spec.rb +10 -10
- data/mod/05_standard/spec/set/type/signup_spec.rb +11 -11
- data/mod/05_standard/spec/set/type/toggle_spec.rb +2 -2
- data/mod/05_standard/spec/set/type/uri_spec.rb +9 -9
- data/mod/06_bootstrap/set/all/bootstrap/helper.rb +10 -10
- data/mod/06_bootstrap/set/all/bootstrap/wrapper.rb +4 -4
- data/mod/06_bootstrap/set/all/rich_bootstrap.rb +1 -1
- data/spec/lib/card/action_spec.rb +2 -2
- data/spec/lib/card/cache_spec.rb +7 -7
- data/spec/lib/card/content_spec.rb +31 -37
- data/spec/lib/card/diff_spec.rb +56 -56
- data/spec/lib/card/format_spec.rb +11 -11
- data/spec/lib/card/query_spec.rb +382 -265
- data/spec/lib/card/reference_spec.rb +133 -140
- data/spec/lib/card/set_pattern_spec.rb +10 -9
- data/spec/lib/card/set_spec.rb +11 -11
- data/spec/lib/card/success_spec.rb +16 -8
- data/spec/mailers/mailer_spec.rb +5 -5
- data/spec/models/card/cardtype_spec.rb +20 -20
- data/spec/models/card/create_spec.rb +6 -6
- data/spec/models/card/trash_spec.rb +20 -20
- data/spec/models/card/type_transition_spec.rb +3 -3
- data/spec/models/card/validation_spec.rb +5 -5
- data/spec/models/card_spec.rb +24 -24
- data/spec/spec_helper.rb +5 -5
- data/tmpsets/set/mod001-01_core/all/active_card.rb +2 -2
- data/tmpsets/set/mod001-01_core/all/collection.rb +23 -26
- data/tmpsets/set/mod001-01_core/all/content.rb +2 -2
- data/tmpsets/set/mod001-01_core/all/fetch.rb +6 -6
- data/tmpsets/set/mod001-01_core/all/initialize.rb +8 -4
- data/tmpsets/set/mod001-01_core/all/name.rb +14 -14
- data/tmpsets/set/mod001-01_core/all/pattern.rb +1 -1
- data/tmpsets/set/mod001-01_core/all/permissions.rb +12 -12
- data/tmpsets/set/mod001-01_core/all/phases.rb +31 -13
- data/tmpsets/set/mod001-01_core/all/references.rb +14 -14
- data/tmpsets/set/mod001-01_core/all/rules.rb +8 -10
- data/tmpsets/set/mod001-01_core/all/templating.rb +10 -9
- data/tmpsets/set/mod001-01_core/all/tracked_attributes.rb +7 -7
- data/tmpsets/set/mod001-01_core/all/trash.rb +9 -8
- data/tmpsets/set/mod001-01_core/all/type.rb +7 -7
- data/tmpsets/set/mod001-01_core/all/utils.rb +16 -4
- data/tmpsets/set/mod001-01_core/all/view_cache.rb +1 -1
- data/tmpsets/set/mod002-01_history/all/actions.rb +2 -2
- data/tmpsets/set/mod002-01_history/all/content_history.rb +11 -7
- data/tmpsets/set/mod002-01_history/all/history.rb +46 -46
- data/tmpsets/set/mod003-02_basic_types/all/all_css.rb +10 -10
- data/tmpsets/set/mod003-02_basic_types/all/all_csv.rb +7 -7
- data/tmpsets/set/mod003-02_basic_types/all/base.rb +25 -25
- data/tmpsets/set/mod003-02_basic_types/all/json.rb +16 -16
- data/tmpsets/set/mod003-02_basic_types/all/rss.rb +7 -7
- data/tmpsets/set/mod003-02_basic_types/type/html.rb +2 -2
- data/tmpsets/set/mod003-02_basic_types/type/plain_text.rb +1 -1
- data/tmpsets/set/mod003-02_basic_types/type/pointer.rb +38 -31
- data/tmpsets/set/mod004-03_machines/right/machine_output.rb +4 -0
- data/tmpsets/set/mod004-03_machines/type/coffee_script.rb +3 -3
- data/tmpsets/set/mod004-03_machines/type/css.rb +8 -8
- data/tmpsets/set/mod004-03_machines/type/java_script.rb +4 -4
- data/tmpsets/set/mod004-03_machines/type/scss.rb +2 -2
- data/tmpsets/set/mod004-03_machines/type/skin.rb +1 -1
- data/tmpsets/set/mod005-04_settings/abstract/permission.rb +9 -9
- data/tmpsets/set/mod005-04_settings/right/script.rb +1 -1
- data/tmpsets/set/mod005-04_settings/right/structure.rb +0 -5
- data/tmpsets/set/mod005-04_settings/right/style.rb +2 -2
- data/tmpsets/set/mod005-04_settings/self/accountable.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/add_help.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/autoname.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/captcha.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/create.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/default.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/delete.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/help.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/input.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/layout.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/on_create.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/on_delete.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/on_update.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/options.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/options_label.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/read.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/script.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/structure.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/style.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/table_of_contents.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/thanks.rb +1 -1
- data/tmpsets/set/mod005-04_settings/self/update.rb +1 -1
- data/tmpsets/set/mod005-04_settings/type/setting.rb +14 -14
- data/tmpsets/set/mod006-05_email/all/follow.rb +24 -16
- data/tmpsets/set/mod006-05_email/all/notify.rb +25 -23
- data/tmpsets/set/mod006-05_email/all/observer.rb +8 -8
- data/tmpsets/set/mod006-05_email/right/bcc.rb +8 -8
- data/tmpsets/set/mod006-05_email/right/follow.rb +44 -17
- data/tmpsets/set/mod006-05_email/right/follow_fields.rb +1 -1
- data/tmpsets/set/mod006-05_email/right/following.rb +49 -40
- data/tmpsets/set/mod006-05_email/self/always.rb +2 -2
- data/tmpsets/set/mod006-05_email/self/created.rb +1 -1
- data/tmpsets/set/mod006-05_email/self/edited.rb +4 -4
- data/tmpsets/set/mod006-05_email/self/follow.rb +1 -1
- data/tmpsets/set/mod006-05_email/self/follow_defaults.rb +9 -9
- data/tmpsets/set/mod006-05_email/self/never.rb +1 -1
- data/tmpsets/set/mod006-05_email/type/email_template.rb +9 -9
- data/tmpsets/set/mod006-05_email/type_plus_right/user/follow.rb +17 -17
- data/tmpsets/set/mod007-05_standard/abstract/attachment.rb +98 -46
- data/tmpsets/set/mod007-05_standard/all/account.rb +5 -5
- data/tmpsets/set/mod007-05_standard/all/comment.rb +7 -7
- data/tmpsets/set/mod007-05_standard/all/error.rb +26 -26
- data/tmpsets/set/mod007-05_standard/all/event_viz.rb +1 -1
- data/tmpsets/set/mod007-05_standard/all/links.rb +10 -9
- data/tmpsets/set/mod007-05_standard/all/rich_html/content.rb +34 -34
- data/tmpsets/set/mod007-05_standard/all/rich_html/editing.rb +35 -35
- data/tmpsets/set/mod007-05_standard/all/rich_html/form.rb +20 -20
- data/tmpsets/set/mod007-05_standard/all/rich_html/header.rb +8 -8
- data/tmpsets/set/mod007-05_standard/all/rich_html/menu.rb +33 -33
- data/tmpsets/set/mod007-05_standard/all/rich_html/modal.rb +16 -16
- data/tmpsets/set/mod007-05_standard/all/rich_html/toolbar.rb +63 -63
- data/tmpsets/set/mod007-05_standard/all/rich_html/wrapper.rb +8 -8
- data/tmpsets/set/mod007-05_standard/right/account.rb +27 -27
- data/tmpsets/set/mod007-05_standard/right/email.rb +5 -5
- data/tmpsets/set/mod007-05_standard/right/password.rb +5 -5
- data/tmpsets/set/mod007-05_standard/rstar/rules.rb +52 -52
- data/tmpsets/set/mod007-05_standard/self/account_links.rb +27 -27
- data/tmpsets/set/mod007-05_standard/self/all.rb +1 -1
- data/tmpsets/set/mod007-05_standard/self/head.rb +5 -5
- data/tmpsets/set/mod007-05_standard/self/navbox.rb +11 -11
- data/tmpsets/set/mod007-05_standard/self/recent.rb +2 -2
- data/tmpsets/set/mod007-05_standard/self/search.rb +13 -13
- data/tmpsets/set/mod007-05_standard/self/signin.rb +19 -19
- data/tmpsets/set/mod007-05_standard/self/stats.rb +2 -2
- data/tmpsets/set/mod007-05_standard/type/basic.rb +1 -1
- data/tmpsets/set/mod007-05_standard/type/cardtype.rb +5 -5
- data/tmpsets/set/mod007-05_standard/type/date.rb +1 -1
- data/tmpsets/set/mod007-05_standard/type/file.rb +23 -8
- data/tmpsets/set/mod007-05_standard/type/image.rb +10 -8
- data/tmpsets/set/mod007-05_standard/type/number.rb +2 -2
- data/tmpsets/set/mod007-05_standard/type/phrase.rb +1 -1
- data/tmpsets/set/mod007-05_standard/type/search_type.rb +21 -19
- data/tmpsets/set/mod007-05_standard/type/session.rb +2 -2
- data/tmpsets/set/mod007-05_standard/type/set.rb +37 -37
- data/tmpsets/set/mod007-05_standard/type/signup.rb +25 -25
- data/tmpsets/set/mod007-05_standard/type/uri.rb +1 -1
- data/tmpsets/set/mod007-05_standard/type/user.rb +21 -21
- data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/helper.rb +10 -10
- data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/wrapper.rb +4 -4
- data/tmpsets/set/mod008-06_bootstrap/all/rich_bootstrap.rb +1 -1
- data/tmpsets/set_pattern/101-all_plus.rb +2 -2
- data/tmpsets/set_pattern/102-type.rb +1 -1
- data/tmpsets/set_pattern/103-star.rb +1 -1
- data/tmpsets/set_pattern/104-rstar.rb +2 -2
- data/tmpsets/set_pattern/105-right.rb +4 -4
- data/tmpsets/set_pattern/106-type_plus_right.rb +4 -4
- data/tmpsets/set_pattern/107-self.rb +1 -1
- metadata +7 -5
- data/lib/card/query/card_clause.rb +0 -528
- data/lib/card/query/ref_clause.rb +0 -47
- data/lib/card/query/value_clause.rb +0 -65
data/spec/lib/card/diff_spec.rb
CHANGED
@@ -17,12 +17,12 @@ describe Card::Diff do
|
|
17
17
|
def diff old_s, new_s, opts=@opts
|
18
18
|
Card::Diff.complete(old_s, new_s, opts)
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def summary old_s, new_s, opts=@opts
|
22
22
|
Card::Diff.summary(old_s, new_s, opts)
|
23
23
|
end
|
24
|
-
|
25
|
-
|
24
|
+
|
25
|
+
|
26
26
|
old_p = '<p>old</p>'
|
27
27
|
new_p = '<p>new</p>'
|
28
28
|
new_h = '<h1>new</h1>'
|
@@ -33,111 +33,111 @@ describe Card::Diff do
|
|
33
33
|
describe 'traffic light' do
|
34
34
|
it 'is green for addition' do
|
35
35
|
a = "a"
|
36
|
-
b = "a b"
|
36
|
+
b = "a b"
|
37
37
|
db = Card::Diff::DiffBuilder.new(a,b)
|
38
38
|
expect(db.green?).to be_truthy
|
39
39
|
expect(db.red?).to be_falsey
|
40
40
|
end
|
41
41
|
it 'is red for deletion' do
|
42
42
|
a = "a"
|
43
|
-
b = ""
|
43
|
+
b = ""
|
44
44
|
db = Card::Diff::DiffBuilder.new(a,b)
|
45
45
|
expect(db.green?).to be_falsey
|
46
46
|
expect(db.red?).to be_truthy
|
47
47
|
end
|
48
48
|
it 'is green and red for change' do
|
49
49
|
a = "a"
|
50
|
-
b = "b"
|
50
|
+
b = "b"
|
51
51
|
db = Card::Diff::DiffBuilder.new(a,b)
|
52
52
|
expect(db.green?).to be_truthy
|
53
53
|
expect(db.red?).to be_truthy
|
54
54
|
end
|
55
55
|
it 'is off for no change' do
|
56
56
|
a = "a"
|
57
|
-
b = "a"
|
57
|
+
b = "a"
|
58
58
|
db = Card::Diff::DiffBuilder.new(a,b)
|
59
59
|
expect(db.green?).to be_falsey
|
60
60
|
expect(db.red?).to be_falsey
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
64
|
-
|
63
|
+
|
64
|
+
|
65
65
|
describe 'summary' do
|
66
66
|
before(:all) do
|
67
|
-
@opts = {:
|
67
|
+
@opts = {format: :html}
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
it 'omits unchanged text' do
|
71
71
|
a = "<p>this was the original string</p>"
|
72
|
-
b = "<p>this is the new string</p>"
|
72
|
+
b = "<p>this is the new string</p>"
|
73
73
|
expect(summary a, b).to eq(
|
74
74
|
"...#{del 'was'}#{ins 'is'}...#{del 'original'}#{ins 'new'}..."
|
75
75
|
)
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
it 'no ellipsis if changes fit exactly' do
|
79
79
|
a = "123"
|
80
|
-
b = "456"
|
81
|
-
expect(summary a, b, :
|
80
|
+
b = "456"
|
81
|
+
expect(summary a, b, summary: {length: 6}).to eq(
|
82
82
|
"#{del '123'}#{ins '456'}"
|
83
83
|
)
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
86
|
it 'green ellipsis if added text does not fit' do
|
87
87
|
a = "123"
|
88
|
-
b = "5678"
|
89
|
-
expect(summary a, b, :
|
88
|
+
b = "5678"
|
89
|
+
expect(summary a, b, summary: {length: 6}).to eq(
|
90
90
|
"#{del '123'}#{ins '...'}"
|
91
91
|
)
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
it 'neutral ellipsis if complete change does not fit' do
|
95
95
|
a = "123 123"
|
96
|
-
b = "456 456"
|
97
|
-
expect(summary a, b, :
|
96
|
+
b = "456 456"
|
97
|
+
expect(summary a, b, summary: {length: 9}).to eq(
|
98
98
|
"#{del '123'}#{ins '456'}..."
|
99
99
|
)
|
100
100
|
end
|
101
|
-
|
101
|
+
|
102
102
|
it 'red ellipsis if deleted text partially fits' do
|
103
103
|
a = "123456"
|
104
|
-
b = "567"
|
105
|
-
expect(summary a, b, :
|
104
|
+
b = "567"
|
105
|
+
expect(summary a, b, summary: {length: 4}).to eq(
|
106
106
|
"#{del '1...'}"
|
107
107
|
)
|
108
108
|
end
|
109
|
-
|
109
|
+
|
110
110
|
it 'green ellipsis if added text partially fits' do
|
111
111
|
a = "1234"
|
112
|
-
b = "56789"
|
113
|
-
expect(summary a, b, :
|
112
|
+
b = "56789"
|
113
|
+
expect(summary a, b, summary: {length: 8}).to eq(
|
114
114
|
"#{del '1234'}#{ins '5...'}"
|
115
115
|
)
|
116
116
|
end
|
117
|
-
|
117
|
+
|
118
118
|
it 'removes html tags' do
|
119
119
|
a = "<a>A</a>"
|
120
|
-
b = "<b>B</b>"
|
121
|
-
expect(summary a, b, :
|
120
|
+
b = "<b>B</b>"
|
121
|
+
expect(summary a, b, format: :html).to eq(
|
122
122
|
"#{del 'A'}#{ins 'B'}"
|
123
123
|
)
|
124
124
|
end
|
125
|
-
|
125
|
+
|
126
126
|
it 'with html tags in raw format' do
|
127
127
|
a = "<a>1</a>"
|
128
|
-
b = "<b>1</b>"
|
129
|
-
expect(summary a, b, :
|
128
|
+
b = "<b>1</b>"
|
129
|
+
expect(summary a, b, format: :raw).to eq(
|
130
130
|
"#{del( tag 'a' )}#{ins(tag 'b')}...#{del( tag '/a' )}#{ins(tag '/b')}"
|
131
131
|
)
|
132
132
|
end
|
133
|
-
|
133
|
+
|
134
134
|
end
|
135
|
-
|
135
|
+
|
136
136
|
context "html format" do
|
137
137
|
before(:all) do
|
138
|
-
@opts = {:
|
138
|
+
@opts = {format: :html}
|
139
139
|
end
|
140
|
-
|
140
|
+
|
141
141
|
it "doesn't change a text without changes" do
|
142
142
|
text = "Hello World!\n How are you?"
|
143
143
|
expect(diff text, text).to eq(text)
|
@@ -148,10 +148,10 @@ describe Card::Diff do
|
|
148
148
|
it 'ignores html changes' do
|
149
149
|
expect(diff old_p, new_h).to eq("<h1>#{del 'old'}#{ins 'new'}</h1>")
|
150
150
|
end
|
151
|
-
|
151
|
+
|
152
152
|
it 'diff with multiple paragraphs' do
|
153
153
|
a = "<p>this was the original string</p>"
|
154
|
-
b = "<p>this is</p>\n<p> the new string</p>\n<p>around the world</p>"
|
154
|
+
b = "<p>this is</p>\n<p> the new string</p>\n<p>around the world</p>"
|
155
155
|
|
156
156
|
expect(diff a, b).to eq(
|
157
157
|
"<p>this #{del 'was'}#{ins 'is'}</p>"+
|
@@ -162,49 +162,49 @@ describe Card::Diff do
|
|
162
162
|
)
|
163
163
|
end
|
164
164
|
end
|
165
|
-
|
165
|
+
|
166
166
|
context "text format" do
|
167
167
|
before(:all) do
|
168
|
-
@opts = {:
|
168
|
+
@opts = {format: :text}
|
169
169
|
end
|
170
|
-
|
170
|
+
|
171
171
|
it 'removes html' do
|
172
172
|
expect(p_diff).to eq("#{del 'old'}#{ins 'new'}")
|
173
173
|
end
|
174
|
-
|
174
|
+
|
175
175
|
it 'compares complete links' do
|
176
|
-
diff = Card::Diff.complete("[[A]]\n[[B]]", "[[A]]\n[[C]]", :
|
176
|
+
diff = Card::Diff.complete("[[A]]\n[[B]]", "[[A]]\n[[C]]", format: :html)
|
177
177
|
expect(diff).to eq( "[[A]]\n#{del '[[B]]'}#{ins '[[C]]'}")
|
178
178
|
end
|
179
|
-
|
179
|
+
|
180
180
|
it 'compares complete inclusions' do
|
181
|
-
diff = Card::Diff.complete("{{A}}\n{{B}}", "{{A}}\n{{C}}", :
|
181
|
+
diff = Card::Diff.complete("{{A}}\n{{B}}", "{{A}}\n{{C}}", format: :html)
|
182
182
|
expect(diff).to eq( "{{A}}\n#{del '{{B}}'}#{ins '{{C}}'}")
|
183
183
|
end
|
184
|
-
|
184
|
+
|
185
185
|
end
|
186
|
-
|
186
|
+
|
187
187
|
context "raw format" do
|
188
188
|
before(:all) do
|
189
|
-
@opts = {:
|
189
|
+
@opts = {format: :raw}
|
190
190
|
end
|
191
|
-
|
191
|
+
|
192
192
|
it 'excapes html' do
|
193
193
|
expect(p_diff).to eq("#{tag 'p'}#{del 'old'}#{ins 'new'}#{tag '/p'}")
|
194
194
|
end
|
195
|
-
|
195
|
+
|
196
196
|
it 'diff for tag change' do
|
197
197
|
expect(diff old_p, new_h).to eq( del("#{tag 'p'}old#{tag '/p'}") + ins("#{tag 'h1'}new#{tag '/h1'}") )
|
198
|
-
end
|
198
|
+
end
|
199
199
|
end
|
200
|
-
|
200
|
+
|
201
201
|
context 'pointer format' do
|
202
202
|
before(:all) do
|
203
|
-
@opts = {:
|
203
|
+
@opts = {format: :pointer}
|
204
204
|
end
|
205
|
-
|
205
|
+
|
206
206
|
it 'removes square brackets' do
|
207
207
|
expect(diff "[[Hello]]", "[[Hi]]").to eq( del('Hello') + ins('Hi') )
|
208
|
-
end
|
208
|
+
end
|
209
209
|
end
|
210
210
|
end
|
@@ -6,26 +6,26 @@ describe Card::Format do
|
|
6
6
|
let(:format) { described_class.new Card.new }
|
7
7
|
|
8
8
|
it "should respect defaults" do
|
9
|
-
expect(format.show_view?( :menu, :
|
10
|
-
expect(format.show_view?( :menu, :
|
9
|
+
expect(format.show_view?( :menu, default_visibility: :show )).to be_truthy
|
10
|
+
expect(format.show_view?( :menu, default_visibility: :hide )).to be_falsey
|
11
11
|
expect(format.show_view?( :menu, {} )).to be_truthy
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should respect developer default overrides" do
|
15
|
-
expect(format.show_view?( :menu, :
|
16
|
-
expect(format.show_view?( :menu, :
|
17
|
-
expect(format.show_view?( :menu, :
|
15
|
+
expect(format.show_view?( :menu, optional_menu: :show, default_visibility: :hide )).to be_truthy
|
16
|
+
expect(format.show_view?( :menu, optional_menu: :hide, default_visibility: :show )).to be_falsey
|
17
|
+
expect(format.show_view?( :menu, optional_menu: :hide )).to be_falsey
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should handle args from inclusions" do
|
21
|
-
expect(format.show_view?( :menu, :
|
22
|
-
expect(format.show_view?( :menu, :
|
23
|
-
expect(format.show_view?( :menu, :
|
21
|
+
expect(format.show_view?( :menu, show: 'menu', default_visibility: :hide )).to be_truthy
|
22
|
+
expect(format.show_view?( :menu, hide: 'menu, paging', default_visibility: :show )).to be_falsey
|
23
|
+
expect(format.show_view?( :menu, show: 'menu', optional_menu: :hide )).to be_truthy
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should handle hard developer overrides" do
|
27
|
-
expect(format.show_view?( :menu, :
|
28
|
-
expect(format.show_view?( :menu, :
|
27
|
+
expect(format.show_view?( :menu, optional_menu: :always, hide: 'menu' )).to be_truthy
|
28
|
+
expect(format.show_view?( :menu, optional_menu: :never, show: 'menu' )).to be_falsey
|
29
29
|
end
|
30
30
|
|
31
31
|
end
|
@@ -71,7 +71,7 @@ describe Card::Format do
|
|
71
71
|
it "formats page_path" do
|
72
72
|
expect(text_format.page_path card.cardname).to eq '/'+card.name
|
73
73
|
expect(html_format.page_path card.cardname).to eq '/'+card.name
|
74
|
-
expect(text_format.page_path card.cardname, :
|
74
|
+
expect(text_format.page_path card.cardname, format: 'txt', opt1: 11, opt2: 'foo').to eq "/#{card.name}.txt?opt1=11&opt2=foo"
|
75
75
|
end
|
76
76
|
|
77
77
|
it "fomats full path and url" do
|
data/spec/lib/card/query_spec.rb
CHANGED
@@ -1,456 +1,573 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
|
-
A_JOINEES =
|
4
|
-
|
5
|
-
CARDS_MATCHING_TWO = ["Two","One+Two","One+Two+Three","Joe User"].sort
|
3
|
+
A_JOINEES = %w( B C D E F )
|
4
|
+
CARDS_MATCHING_TWO = ['Joe User', 'One+Two', 'One+Two+Three', 'Two']
|
6
5
|
|
7
6
|
describe Card::Query do
|
7
|
+
subject do
|
8
|
+
Card::Query.run @query.reverse_merge return: :name, sort: :name
|
9
|
+
end
|
8
10
|
|
9
11
|
describe 'append' do
|
10
|
-
it
|
11
|
-
|
12
|
+
it 'should find real cards' do
|
13
|
+
@query = {
|
14
|
+
name: [:in, 'C', 'D', 'F'],
|
15
|
+
append: 'A'
|
16
|
+
}
|
17
|
+
is_expected.to eq(%w( C+A D+A F+A ))
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should absolutize names' do
|
21
|
+
@query = {
|
22
|
+
name: [:in, 'C', 'D', 'F'],
|
23
|
+
append: '_right',
|
24
|
+
context: 'B+A'
|
25
|
+
}
|
26
|
+
is_expected.to eq(%w( C+A D+A F+A ))
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should find virtual cards' do
|
30
|
+
@query = {
|
31
|
+
name: [:in, 'C', 'D'],
|
32
|
+
append: '*plus cards'
|
33
|
+
}
|
34
|
+
is_expected.to eq(['C+*plus cards', 'D+*plus cards'])
|
12
35
|
end
|
36
|
+
end
|
13
37
|
|
14
|
-
|
15
|
-
|
38
|
+
describe 'in' do
|
39
|
+
it 'should work for content options' do
|
40
|
+
@query = { in: %w( AlphaBeta Theta ) }
|
41
|
+
is_expected.to eq(%w( A+B T ))
|
16
42
|
end
|
17
43
|
|
18
|
-
it
|
19
|
-
|
44
|
+
it 'should find the same thing in full syntax' do
|
45
|
+
@query = { content: [:in, 'Theta', 'AlphaBeta'] }
|
46
|
+
is_expected.to eq(%w( A+B T ))
|
20
47
|
end
|
21
|
-
end
|
22
48
|
|
23
|
-
|
24
|
-
|
25
|
-
|
49
|
+
it 'should work on types' do
|
50
|
+
@query = { type: [:in, 'Cardtype E', 'Cardtype F'] }
|
51
|
+
is_expected.to eq(%w(type-e-card type-f-card))
|
26
52
|
end
|
53
|
+
end
|
27
54
|
|
28
|
-
|
29
|
-
|
55
|
+
describe 'member_of/member' do
|
56
|
+
it 'member_of should find members' do
|
57
|
+
@query = { member_of: 'r1' }
|
58
|
+
is_expected.to eq(%w(u1 u2 u3))
|
30
59
|
end
|
31
60
|
|
32
|
-
it
|
33
|
-
|
61
|
+
it 'member should find roles' do
|
62
|
+
@query = { member: { match: 'u1' } }
|
63
|
+
is_expected.to eq(%w(r1 r2 r3))
|
34
64
|
end
|
35
65
|
end
|
36
66
|
|
37
|
-
describe
|
38
|
-
it
|
39
|
-
|
40
|
-
|
67
|
+
describe 'not' do
|
68
|
+
it 'should exclude cards matching not criteria' do
|
69
|
+
Card::Auth.as_bot
|
70
|
+
@query = { plus: 'A', not: { plus: 'A+B' } }
|
71
|
+
is_expected.to eq(%w( B D E F ))
|
41
72
|
end
|
42
73
|
end
|
43
74
|
|
75
|
+
describe 'multiple values' do
|
76
|
+
it 'should handle :all as the first element of an Array' do
|
77
|
+
@query = { member_of: [:all, { name: 'r1' }, { key: 'r2' }] }
|
78
|
+
is_expected.to eq(%w( u1 u2 ))
|
79
|
+
end
|
44
80
|
|
81
|
+
it 'should handle act like :all by default' do
|
82
|
+
@query = { member_of: [{ name: 'r1' }, { key: 'r2' }] }
|
83
|
+
is_expected.to eq(%w( u1 u2 ))
|
84
|
+
end
|
45
85
|
|
86
|
+
it 'should handle :any as the first element of an Array' do
|
87
|
+
@query = { member_of: [:any, { name: 'r1' }, { key: 'r2' }] }
|
88
|
+
is_expected.to eq(%w( u1 u2 u3 ))
|
89
|
+
end
|
46
90
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
expect(Card::Query.new( :member_of => "r1" ).run.map(&:name).sort).to eq(%w(u1 u2 u3))
|
91
|
+
it 'should handle :any as a relationship' do
|
92
|
+
@query = { member_of: { any: [{ name: 'r1' }, { key: 'r2' }] } }
|
93
|
+
is_expected.to eq(%w( u1 u2 u3 ))
|
51
94
|
end
|
52
|
-
|
53
|
-
|
95
|
+
|
96
|
+
it 'should handle explicit conjunctions in plus_relational keys' do
|
97
|
+
@query = { right_plus: [:all, 'e', 'c'] }
|
98
|
+
is_expected.to eq(%w( A ))
|
54
99
|
end
|
55
|
-
end
|
56
100
|
|
101
|
+
it 'should handle multiple values for right_part in compound relations' do
|
102
|
+
@query = { right_plus: [['e', {}], 'c'] }
|
103
|
+
is_expected.to eq(%w( A )) # first element is array
|
104
|
+
end
|
57
105
|
|
58
|
-
|
59
|
-
|
60
|
-
|
106
|
+
it 'should not interpret simple arrays as multi values for plus' do
|
107
|
+
@query = { right_plus: %w( e c ) }
|
108
|
+
is_expected.to eq([]) # NOT interpreted as multi-value
|
61
109
|
end
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
it "should handle multiple values for relational keys" do
|
67
|
-
expect(Card::Query.new( :member_of=>[:all, {:name=>'r1'}, {:key=>'r2'} ], :return=>:name).run.sort).to eq(%w{ u1 u2 })
|
68
|
-
expect(Card::Query.new( :member_of=>[ {:name=>'r1'}, {:key=>'r2'} ], :return=>:name).run.sort).to eq(%w{ u1 u2 })
|
69
|
-
expect(Card::Query.new( :member_of=>[:any, {:name=>'r1'}, {:key=>'r2'} ], :return=>:name).run.sort).to eq(%w{ u1 u2 u3 })
|
110
|
+
|
111
|
+
it 'should handle :and for references' do
|
112
|
+
@query = { refer_to: [:and, 'a', 'b'] }
|
113
|
+
is_expected.to eq(%w( Y ))
|
70
114
|
end
|
71
115
|
|
72
|
-
it
|
73
|
-
|
74
|
-
|
75
|
-
expect(Card::Query.new( :right_plus=>[ 'e', 'c' ], :return=>:name ).run.sort).to eq([]) # NOT interpreted as multi-value
|
116
|
+
it 'should handle :or for references' do
|
117
|
+
@query = { refer_to: [:or, 'b', 'z'] }
|
118
|
+
is_expected.to eq(%w( A B Y))
|
76
119
|
end
|
77
120
|
|
78
|
-
it
|
79
|
-
|
80
|
-
|
81
|
-
expect(Card::Query.new( :refer_to=>[ :or, 'b', 'z' ], :return=>:name ).run.sort).to eq(%w{ A B Y})
|
121
|
+
it 'should handle treat simple arrays like :all for references' do
|
122
|
+
@query = { refer_to: %w( A T ) }
|
123
|
+
is_expected.to eq(%w( X Y ))
|
82
124
|
end
|
83
|
-
|
84
125
|
end
|
85
126
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
127
|
+
describe 'edited_by/editor_of' do
|
128
|
+
it 'should find card edited by joe using subquery' do
|
129
|
+
@query = { edited_by: { match: 'Joe User' } }
|
130
|
+
is_expected.to eq(%w( JoeLater JoeNow ))
|
90
131
|
end
|
91
|
-
|
92
|
-
|
93
|
-
#
|
94
|
-
|
132
|
+
|
133
|
+
it 'should find card edited by Wagn Bot' do
|
134
|
+
# this is a weak test, since it gives the name, but different sorting
|
135
|
+
# mechanisms in other db setups
|
136
|
+
# was having it return *account in some cases and 'A' in others
|
137
|
+
@query = { edited_by: 'Wagn Bot', name: 'A' }
|
138
|
+
is_expected.to eq(%w( A ))
|
95
139
|
end
|
96
|
-
|
97
|
-
|
140
|
+
|
141
|
+
it 'should fail gracefully if user isn\'t there' do
|
142
|
+
@query = { edited_by: 'Joe LUser' }
|
143
|
+
is_expected.to eq([])
|
98
144
|
end
|
99
145
|
|
100
|
-
it
|
101
|
-
c=Card[
|
102
|
-
c.content=
|
146
|
+
it 'should not give duplicate results for multiple edits' do
|
147
|
+
c = Card['JoeNow']
|
148
|
+
c.content = 'testagagin'
|
103
149
|
c.save
|
104
|
-
c.content=
|
150
|
+
c.content = 'test3'
|
105
151
|
c.save!
|
106
|
-
|
152
|
+
@query = { edited_by: 'Joe User' }
|
153
|
+
is_expected.to eq(%w( JoeLater JoeNow ))
|
107
154
|
end
|
108
155
|
|
109
|
-
it
|
110
|
-
|
156
|
+
it 'should find joe user among card\'s editors' do
|
157
|
+
@query = { editor_of: 'JoeLater' }
|
158
|
+
is_expected.to eq(['Joe User'])
|
111
159
|
end
|
112
160
|
end
|
113
161
|
|
114
|
-
describe
|
162
|
+
describe 'created_by/creator_of' do
|
115
163
|
before do
|
116
|
-
Card.create :
|
164
|
+
Card.create name: 'Create Test', content: 'sufficiently distinctive'
|
117
165
|
end
|
118
166
|
|
119
167
|
it "should find Joe User as the card's creator" do
|
120
|
-
|
121
|
-
|
168
|
+
@query = { creator_of: 'Create Test' }
|
169
|
+
is_expected.to eq(['Joe User'])
|
122
170
|
end
|
123
171
|
|
124
|
-
it
|
125
|
-
|
172
|
+
it 'should find card created by Joe User' do
|
173
|
+
@query = { created_by: 'Joe User', eq: 'sufficiently distinctive' }
|
174
|
+
is_expected.to eq(['Create Test'])
|
126
175
|
end
|
127
176
|
end
|
128
177
|
|
129
|
-
describe
|
178
|
+
describe 'last_edited_by/last_editor_of' do
|
130
179
|
before do
|
131
|
-
c=Card.fetch('A')
|
132
|
-
c.content='peculicious'
|
180
|
+
c = Card.fetch('A')
|
181
|
+
c.content = 'peculicious'
|
133
182
|
c.save!
|
134
183
|
end
|
135
184
|
|
136
185
|
it "should find Joe User as the card's last editor" do
|
137
|
-
|
186
|
+
@query = { last_editor_of: 'A' }
|
187
|
+
is_expected.to eq(['Joe User'])
|
188
|
+
end
|
189
|
+
|
190
|
+
it 'should find card created by Joe User' do
|
191
|
+
@query = { last_edited_by: 'Joe User', eq: 'peculicious' }
|
192
|
+
is_expected.to eq(['A'])
|
138
193
|
end
|
194
|
+
end
|
139
195
|
|
140
|
-
|
141
|
-
|
196
|
+
describe 'keyword' do
|
197
|
+
it 'should escape nonword characters' do
|
198
|
+
@query = { match: 'two :(!' }
|
199
|
+
is_expected.to eq(CARDS_MATCHING_TWO)
|
142
200
|
end
|
143
201
|
end
|
144
202
|
|
145
|
-
describe
|
146
|
-
it
|
147
|
-
|
203
|
+
describe 'search count' do
|
204
|
+
it 'should return integer' do
|
205
|
+
search = Card.create!(
|
206
|
+
name: 'tmpsearch',
|
207
|
+
type: 'Search',
|
208
|
+
content: '{"match":"two"}'
|
209
|
+
)
|
210
|
+
expect(search.count).to eq(CARDS_MATCHING_TWO.length + 1)
|
148
211
|
end
|
149
212
|
end
|
150
213
|
|
151
|
-
describe
|
152
|
-
it
|
153
|
-
|
154
|
-
|
214
|
+
describe 'cgi_params' do
|
215
|
+
it 'should match content from cgi' do
|
216
|
+
@query = { match: '$keyword', vars: { keyword: 'two' } }
|
217
|
+
is_expected.to eq(CARDS_MATCHING_TWO)
|
155
218
|
end
|
156
219
|
end
|
157
220
|
|
221
|
+
describe 'content equality' do
|
222
|
+
it 'should match content explicitly' do
|
223
|
+
@query = { content: ['=', "I'm number two"] }
|
224
|
+
is_expected.to eq(['Joe User'])
|
225
|
+
end
|
158
226
|
|
159
|
-
|
160
|
-
|
161
|
-
|
227
|
+
it 'should match via shortcut' do
|
228
|
+
@query = { '=' => "I'm number two" }
|
229
|
+
is_expected.to eq(['Joe User'])
|
162
230
|
end
|
163
231
|
end
|
164
232
|
|
233
|
+
describe 'links' do
|
234
|
+
it 'should handle refer_to' do
|
235
|
+
@query = { refer_to: 'Z' }
|
236
|
+
is_expected.to eq(%w( A B ))
|
237
|
+
end
|
165
238
|
|
239
|
+
it 'should handle link_to' do
|
240
|
+
@query = { link_to: 'Z' }
|
241
|
+
is_expected.to eq(%w( A ))
|
242
|
+
end
|
166
243
|
|
167
|
-
|
168
|
-
|
169
|
-
|
244
|
+
it 'should handle include' do
|
245
|
+
@query = { include: 'Z' }
|
246
|
+
is_expected.to eq(%w( B ))
|
170
247
|
end
|
171
|
-
|
172
|
-
|
248
|
+
|
249
|
+
it 'should handle linked_to_by' do
|
250
|
+
@query = { linked_to_by: 'A' }
|
251
|
+
is_expected.to eq(%w( Z ))
|
173
252
|
end
|
174
|
-
end
|
175
253
|
|
254
|
+
it 'should handle included_by' do
|
255
|
+
@query = { included_by: 'B' }
|
256
|
+
is_expected.to eq(%w( Z ))
|
257
|
+
end
|
176
258
|
|
177
|
-
|
259
|
+
it 'should handle referred_to_by' do
|
260
|
+
@query = { referred_to_by: 'X' }
|
261
|
+
is_expected.to eq(%w( A A+B T ))
|
262
|
+
end
|
263
|
+
end
|
178
264
|
|
179
|
-
|
180
|
-
it
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
265
|
+
describe 'compound relationships' do
|
266
|
+
it 'right_plus should handle subqueries' do
|
267
|
+
@query = { right_plus: ['*create', refer_to: 'Anyone']}
|
268
|
+
is_expected.to eq(['Fruit+*type', 'Sign up+*type'])
|
269
|
+
end
|
270
|
+
|
271
|
+
it 'plus should handle subqueries' do # albeit more slowly :)
|
272
|
+
@query = { plus: ['*create', refer_to: 'Anyone']}
|
273
|
+
is_expected.to eq(['Fruit+*type', 'Sign up+*type'])
|
274
|
+
end
|
185
275
|
end
|
186
276
|
|
187
|
-
describe
|
188
|
-
it
|
277
|
+
describe 'relative links' do
|
278
|
+
it 'should handle relative refer_to' do
|
279
|
+
@query = { refer_to: '_self', context: 'Z' }
|
280
|
+
is_expected.to eq(%w( A B ))
|
281
|
+
end
|
189
282
|
end
|
190
283
|
|
191
|
-
describe
|
192
|
-
it
|
193
|
-
Card::Auth.as_bot
|
194
|
-
Card.create :
|
284
|
+
describe 'permissions' do
|
285
|
+
it 'should not find cards not in group' do
|
286
|
+
Card::Auth.as_bot do
|
287
|
+
Card.create name: 'C+*self+*read', type: 'Pointer', content: '[[R1]]'
|
195
288
|
end
|
196
|
-
|
289
|
+
@query = { plus: 'A' }
|
290
|
+
is_expected.to eq(%w( B D E F ))
|
197
291
|
end
|
198
292
|
end
|
199
293
|
|
200
|
-
describe
|
201
|
-
it
|
202
|
-
|
294
|
+
describe 'basics' do
|
295
|
+
it 'should be case insensitive for name' do
|
296
|
+
@query = { name: 'a' }
|
297
|
+
is_expected.to eq(['A'])
|
203
298
|
end
|
204
299
|
|
205
|
-
it
|
206
|
-
|
300
|
+
it 'should find plus cards' do
|
301
|
+
@query = { plus: 'A' }
|
302
|
+
is_expected.to eq(A_JOINEES)
|
207
303
|
end
|
208
304
|
|
209
|
-
it
|
210
|
-
|
305
|
+
it 'should find connection cards' do
|
306
|
+
@query = { part: 'A' }
|
307
|
+
is_expected.to eq(%w( A+B A+C A+D A+E C+A D+A F+A ))
|
211
308
|
end
|
212
309
|
|
213
|
-
it
|
214
|
-
|
310
|
+
it 'should find left connection cards' do
|
311
|
+
@query = { left: 'A' }
|
312
|
+
is_expected.to eq(%w( A+B A+C A+D A+E ))
|
215
313
|
end
|
216
314
|
|
217
|
-
it
|
218
|
-
|
315
|
+
it 'should find right connection cards based on name' do
|
316
|
+
@query = { right: 'A' }
|
317
|
+
is_expected.to eq(%w( C+A D+A F+A ))
|
219
318
|
end
|
220
319
|
|
221
|
-
it
|
222
|
-
|
320
|
+
it 'should find right connection cards based on content' do
|
321
|
+
@query = { right: { content: 'Alpha [[Z]]' } }
|
322
|
+
is_expected.to eq(%w( C+A D+A F+A ))
|
223
323
|
end
|
224
324
|
|
225
|
-
|
325
|
+
it 'should return count' do
|
326
|
+
expect(Card.count_by_wql part: 'A').to eq(7)
|
327
|
+
end
|
226
328
|
end
|
227
329
|
|
228
|
-
describe
|
229
|
-
it
|
230
|
-
|
330
|
+
describe 'limit and offset' do
|
331
|
+
it 'should return limit' do
|
332
|
+
@query = { part: 'A', limit: 5 }
|
333
|
+
expect(subject.size).to eq(5)
|
231
334
|
end
|
232
335
|
|
233
|
-
it
|
234
|
-
|
336
|
+
it 'should not break if offset but no limit' do
|
337
|
+
@query = { part: 'A', offset: 5 }
|
338
|
+
expect(subject.size).not_to eq(0)
|
235
339
|
end
|
236
340
|
|
341
|
+
it 'should not break count' do
|
342
|
+
query = { match: 'two', offset: 1 }
|
343
|
+
expect(Card.count_by_wql(query)).to eq(CARDS_MATCHING_TWO.length)
|
344
|
+
end
|
237
345
|
end
|
238
346
|
|
239
|
-
describe
|
240
|
-
user_cards =
|
347
|
+
describe 'type' do
|
348
|
+
user_cards = [
|
349
|
+
'Big Brother', 'Joe Admin', 'Joe Camel', 'Joe User', 'John',
|
350
|
+
'Narcissist', 'No Count', 'Optic fan', 'Sample User', 'Sara',
|
351
|
+
'Sunglasses fan', 'u1', 'u2', 'u3'
|
352
|
+
].sort
|
241
353
|
|
242
|
-
it
|
243
|
-
|
354
|
+
it 'should find cards of this type' do
|
355
|
+
@query = { type: '_self', context: 'User' }
|
356
|
+
is_expected.to eq(user_cards)
|
244
357
|
end
|
245
358
|
|
246
|
-
it
|
247
|
-
|
359
|
+
it 'should find User cards ' do
|
360
|
+
@query = { type: 'User' }
|
361
|
+
is_expected.to eq(user_cards)
|
248
362
|
end
|
249
363
|
|
250
|
-
it
|
251
|
-
|
364
|
+
it 'should handle casespace variants' do
|
365
|
+
@query = { type: 'users' }
|
366
|
+
is_expected.to eq(user_cards)
|
252
367
|
end
|
253
|
-
|
254
368
|
end
|
255
369
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
370
|
+
describe 'trash handling' do
|
371
|
+
it 'should not find cards in the trash' do
|
372
|
+
Card['A+B'].delete!
|
373
|
+
@query = { left: 'A' }
|
374
|
+
is_expected.to eq(['A+C', 'A+D', 'A+E'])
|
261
375
|
end
|
262
376
|
end
|
263
377
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
378
|
+
describe 'order' do
|
379
|
+
it 'should sort by create' do
|
380
|
+
Card.create! name: 'classic bootstrap skin head'
|
381
|
+
# classic skin head is created more recently than classic skin,
|
382
|
+
# which is in the seed data
|
383
|
+
@query = { sort: 'create', name: [:match, 'classic bootstrap skin'] }
|
384
|
+
is_expected.to eq(
|
385
|
+
['classic bootstrap skin', 'classic bootstrap skin head']
|
386
|
+
)
|
273
387
|
end
|
274
388
|
|
275
|
-
it
|
276
|
-
|
277
|
-
|
278
|
-
#Card.create! :name => 'the alphabet'
|
279
|
-
#Card::Query.new( :name=>["in", "B", "C", "the alphabet"], :sort=>"name").run.map(&:name).should == ["the alphabet", "B", "C"]
|
389
|
+
it 'should sort by name' do
|
390
|
+
@query = { name: %w( in B Z A Y C X ), sort: 'name', dir: 'desc' }
|
391
|
+
is_expected.to eq(%w( Z Y X C B A ))
|
280
392
|
end
|
281
393
|
|
282
|
-
it
|
283
|
-
|
394
|
+
it 'should sort by content' do
|
395
|
+
@query = { name: %w( in Z T A ), sort: 'content' }
|
396
|
+
is_expected.to eq(%w( A Z T ))
|
284
397
|
end
|
285
398
|
|
286
|
-
it
|
287
|
-
|
399
|
+
it 'should play nice with match' do
|
400
|
+
@query = { match: 'Z', type: 'Basic', sort: 'content' }
|
401
|
+
is_expected.to eq(%w( A B Z ))
|
288
402
|
end
|
289
403
|
|
290
|
-
it
|
404
|
+
it 'should sort by plus card content' do
|
291
405
|
Card::Auth.as_bot do
|
292
406
|
c = Card.fetch('Setting+*self+*table of contents')
|
293
407
|
c.content = '10'
|
294
408
|
c.save
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
409
|
+
Card.create! name: 'Basic+*type+*table of contents', content: '3'
|
410
|
+
|
411
|
+
@query = {
|
412
|
+
right_plus: '*table of contents',
|
413
|
+
sort: { right: '*table_of_contents' },
|
414
|
+
sort_as: 'integer'
|
415
|
+
}
|
416
|
+
is_expected.to eq(%w( *all Basic+*type Setting+*self ))
|
300
417
|
end
|
301
418
|
end
|
302
419
|
|
303
|
-
it
|
420
|
+
it 'should sort by count' do
|
304
421
|
Card::Auth.as_bot do
|
305
|
-
|
306
|
-
|
422
|
+
@query = {
|
423
|
+
name: [:in, '*always', '*never', '*edited'],
|
424
|
+
sort: { right: '*follow', item: 'referred_to', return: 'count' }
|
425
|
+
}
|
426
|
+
is_expected.to eq(['*never', '*edited', '*always'])
|
307
427
|
end
|
308
428
|
end
|
309
429
|
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
430
|
+
# it 'should sort by update' do
|
431
|
+
# # do this on a restricted set so it won't change every time we
|
432
|
+
# # add a card..
|
433
|
+
# Card::Query.run(
|
434
|
+
# match: 'two', sort: 'update', dir: 'desc'
|
435
|
+
# ).map(&:name).should == ['One+Two+Three', 'One+Two','Two','Joe User']
|
436
|
+
# Card['Two'].update_attributes! content: 'new bar'
|
437
|
+
# Card::Query.run(
|
438
|
+
# match: 'two', sort: 'update', dir: 'desc'
|
439
|
+
# ).map(&:name).should == ['Two','One+Two+Three', 'One+Two','Joe User']
|
440
|
+
# end
|
318
441
|
end
|
319
442
|
|
320
|
-
describe
|
321
|
-
it
|
322
|
-
|
443
|
+
describe 'match' do
|
444
|
+
it 'should reach content and name via shortcut' do
|
445
|
+
@query = { match: 'two' }
|
446
|
+
is_expected.to eq(CARDS_MATCHING_TWO)
|
323
447
|
end
|
324
|
-
end
|
325
|
-
|
326
448
|
|
327
|
-
|
328
|
-
|
329
|
-
|
449
|
+
it 'should get only content when content is explicit' do
|
450
|
+
@query = { content: [:match, 'two'] }
|
451
|
+
is_expected.to eq(['Joe User'])
|
330
452
|
end
|
331
453
|
|
332
|
-
it
|
333
|
-
|
454
|
+
it 'should get only name when name is explicit' do
|
455
|
+
@query = { name: [:match, 'two'] }
|
456
|
+
is_expected.to eq(['One+Two', 'One+Two+Three', 'Two'])
|
334
457
|
end
|
458
|
+
end
|
335
459
|
|
336
|
-
|
337
|
-
|
460
|
+
describe 'and' do
|
461
|
+
it 'should act as a simple passthrough with operators' do
|
462
|
+
@query = { and: { match: 'two' } }
|
463
|
+
is_expected.to eq(CARDS_MATCHING_TWO)
|
338
464
|
end
|
339
|
-
end
|
340
465
|
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
expect(Card::Query.new(:and=>{}, :type=>"Cardtype E").run.first.name).to eq('type-e-card')
|
466
|
+
it 'should act as a simple passthrough with relationships' do
|
467
|
+
@query = { and: {}, type: 'Cardtype E' }
|
468
|
+
is_expected.to eq(['type-e-card'])
|
345
469
|
end
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
expect(results.length).to eq(2)
|
351
|
-
expect(results.map(&:name).sort).to eq(['A+C','Z'])
|
470
|
+
|
471
|
+
it 'should work within "or"' do
|
472
|
+
@query = { or: { name: 'Z', and: { left: 'A', right: 'C' } } }
|
473
|
+
is_expected.to eq(['A+C', 'Z'])
|
352
474
|
end
|
353
475
|
end
|
354
476
|
|
355
|
-
describe
|
356
|
-
it
|
357
|
-
|
358
|
-
|
359
|
-
expect(Card::Query.new(:or=>{:right_plus=>"A", :plus=>'B'}, :return=>'name').run.sort).to eq(%w{ A C D F })
|
477
|
+
describe 'any' do
|
478
|
+
it 'should work with :plus' do
|
479
|
+
@query = { plus: 'A', any: { name: 'B', match: 'K' } }
|
480
|
+
is_expected.to eq(['B'])
|
360
481
|
end
|
361
|
-
end
|
362
482
|
|
363
|
-
|
364
|
-
|
365
|
-
|
483
|
+
it 'should work with multiple plusses' do
|
484
|
+
@query = { or: { right_plus: 'A', plus: 'B' } }
|
485
|
+
is_expected.to eq(%w( A C D F ))
|
366
486
|
end
|
367
487
|
end
|
368
488
|
|
369
|
-
|
370
|
-
#=end
|
371
|
-
describe "found_by" do
|
489
|
+
describe 'found_by' do
|
372
490
|
before do
|
373
|
-
Card::Auth.
|
374
|
-
|
491
|
+
Card::Auth.as_bot
|
492
|
+
Card.create(
|
493
|
+
name: 'Simple Search', type: 'Search', content: '{"name":"A"}'
|
494
|
+
)
|
375
495
|
end
|
376
496
|
|
377
|
-
it
|
378
|
-
|
497
|
+
it 'should find cards returned by search of given name' do
|
498
|
+
@query = { found_by: 'Simple Search' }
|
499
|
+
is_expected.to eq(['A'])
|
379
500
|
end
|
380
|
-
|
381
|
-
|
501
|
+
|
502
|
+
it 'should find cards returned by virtual cards' do
|
503
|
+
image_cards = Card.search type: 'Image', return: :name, sort: :name
|
504
|
+
@query = { found_by: 'Image+*type+by name' }
|
505
|
+
is_expected.to eq(image_cards)
|
382
506
|
end
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
507
|
+
|
508
|
+
it 'should play nicely with other properties and relationships' do
|
509
|
+
explicit_query = { plus: { name: 'A' }, return: :name, sort: :name }
|
510
|
+
@query = { plus: { found_by: 'Simple Search' } }
|
511
|
+
is_expected.to eq(Card::Query.run(explicit_query))
|
387
512
|
end
|
388
|
-
|
389
|
-
|
513
|
+
|
514
|
+
it 'should play work with virtual cards' do
|
515
|
+
@query = { found_by: 'A+*self', plus: 'C' }
|
516
|
+
is_expected.to eq(['A'])
|
390
517
|
end
|
391
518
|
|
519
|
+
it 'should be able to handle _self' do
|
520
|
+
@query = {
|
521
|
+
context: 'Simple Search',
|
522
|
+
left: { found_by: '_self' },
|
523
|
+
right: 'B',
|
524
|
+
return: :name
|
525
|
+
}
|
526
|
+
is_expected.to eq(['A+B'])
|
527
|
+
end
|
392
528
|
end
|
393
529
|
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
describe "relative" do
|
399
|
-
it "should clean wql" do
|
400
|
-
wql = Card::Query.new( :part=>"_self",:context=>'A' )
|
401
|
-
expect(wql.query[:part]).to eq('A')
|
530
|
+
describe 'relative' do
|
531
|
+
it 'should clean wql' do
|
532
|
+
query = Card::Query.new(part: '_self', context: 'A')
|
533
|
+
expect(query.statement[:part]).to eq('A')
|
402
534
|
end
|
403
535
|
|
404
|
-
it
|
405
|
-
|
536
|
+
it 'should find connection cards' do
|
537
|
+
@query = { part: '_self', context: 'A' }
|
538
|
+
is_expected.to eq(%w( A+B A+C A+D A+E C+A D+A F+A ))
|
406
539
|
end
|
407
540
|
|
408
|
-
it
|
541
|
+
it 'should be able to use parts of nonexistent cards in search' do
|
409
542
|
expect(Card['B+A']).to be_nil
|
410
|
-
|
543
|
+
@query = { left: '_right', right: '_left', context: 'B+A' }
|
544
|
+
is_expected.to eq(['A+B'])
|
411
545
|
end
|
412
546
|
|
413
|
-
it
|
414
|
-
|
547
|
+
it 'should find plus cards for _self' do
|
548
|
+
@query = { plus: '_self', context: 'A' }
|
549
|
+
is_expected.to eq(A_JOINEES)
|
415
550
|
end
|
416
551
|
|
417
|
-
it
|
418
|
-
|
552
|
+
it 'should find plus cards for _left' do
|
553
|
+
@query = { plus: '_left', context: 'A+B' }
|
554
|
+
is_expected.to eq(A_JOINEES)
|
419
555
|
end
|
420
556
|
|
421
|
-
it
|
422
|
-
|
557
|
+
it 'should find plus cards for _right' do
|
558
|
+
@query = { plus: '_right', context: 'C+A' }
|
559
|
+
is_expected.to eq(A_JOINEES)
|
423
560
|
end
|
424
|
-
|
425
561
|
end
|
426
562
|
|
427
|
-
|
428
|
-
|
429
|
-
it "are generated by default" do
|
563
|
+
describe 'nested permissions' do
|
564
|
+
it 'are generated by default' do
|
430
565
|
perm_count = 0
|
431
|
-
Card::Query.new( { :
|
432
|
-
|
566
|
+
sql = Card::Query.new(left: { name: 'X' }).sql
|
567
|
+
sql.scan(/read_rule_id IN \([\d\,]+\)/) do
|
568
|
+
perm_count += 1
|
433
569
|
end
|
434
570
|
expect(perm_count).to eq(2)
|
435
571
|
end
|
436
|
-
|
437
|
-
# it "are not generated inside .without_nested_permissions block" do
|
438
|
-
# perm_count = 0
|
439
|
-
# Card::Query.without_nested_permissions do
|
440
|
-
# Card::Query.new( { :left=>{:name=>"X"}}).sql.scan( /read_rule_id IN \([\d\,]+\)/ ) do |m|
|
441
|
-
# perm_count+=1
|
442
|
-
# end
|
443
|
-
# end
|
444
|
-
# perm_count.should == 1
|
445
|
-
# end
|
446
572
|
end
|
447
|
-
|
448
|
-
#describe "return values" do
|
449
|
-
# # FIXME: should do other return thingies here
|
450
|
-
# it "returns name_content" do
|
451
|
-
# Card::Query.new( { :name => "A+B", :return => "name_content" } ).run.should == {
|
452
|
-
# "A+B" => "AlphaBeta"
|
453
|
-
# }
|
454
|
-
# end
|
455
|
-
#end
|
456
573
|
end
|