card 1.19.6 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/card.gemspec +8 -7
- data/config/initializers/01_core_extensions/array.rb +4 -0
- data/config/initializers/01_core_extensions/persistent_identifiers.rb +12 -0
- data/config/initializers/02_patches/better_errors.rb +56 -0
- data/config/initializers/core_extensions.rb +13 -18
- data/config/initializers/patches.rb +8 -0
- data/config/locales/de.yml +0 -2
- data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +22 -12
- data/db/migrate_core_cards/20161102202156_tweak_recaptcha_setting_cards.rb +17 -0
- data/db/migrate_core_cards/20161103154836_update_keys.rb +46 -0
- data/lib/card.rb +1 -8
- data/lib/card/act_manager.rb +4 -0
- data/lib/card/auth/permissions.rb +5 -3
- data/lib/card/cache.rb +1 -20
- data/lib/card/cache/persistent.rb +6 -0
- data/lib/card/content/chunk.rb +4 -3
- data/lib/card/content/diff.rb +2 -2
- data/lib/card/content/diff/result.rb +11 -0
- data/lib/card/env/success.rb +4 -0
- data/lib/card/error.rb +2 -0
- data/lib/card/format.rb +14 -17
- data/lib/card/format/content.rb +16 -8
- data/lib/card/format/error.rb +3 -5
- data/lib/card/format/names.rb +22 -16
- data/lib/card/format/nest.rb +67 -61
- data/lib/card/format/nest/fetch.rb +40 -33
- data/lib/card/format/nest/main.rb +39 -19
- data/lib/card/format/nest/subformat.rb +3 -16
- data/lib/card/format/nest/view.rb +23 -32
- data/lib/card/format/permission.rb +49 -34
- data/lib/card/format/registration.rb +12 -6
- data/lib/card/format/render.rb +62 -73
- data/lib/card/migration.rb +14 -10
- data/lib/card/migration/import.rb +20 -19
- data/lib/card/migration/import/import_data.rb +50 -59
- data/lib/card/migration/import/import_data/card_attributes.rb +56 -0
- data/lib/card/migration/import/import_data/card_content.rb +33 -0
- data/lib/card/migration/import/merger.rb +47 -0
- data/lib/card/mod/loader.rb +4 -4
- data/lib/card/model/save_helper.rb +49 -10
- data/lib/card/name.rb +16 -52
- data/lib/card/name/fields_and_traits.rb +67 -0
- data/lib/card/name/variants.rb +17 -0
- data/lib/card/query.rb +6 -2
- data/lib/card/query/attributes.rb +1 -1
- data/lib/card/query/interpretation.rb +3 -3
- data/lib/card/set/event.rb +2 -1
- data/lib/card/set/format.rb +18 -7
- data/lib/card/set_pattern.rb +17 -13
- data/lib/card/tasks/card.rake +1 -1
- data/lib/card/view.rb +55 -0
- data/lib/card/view/cache.rb +90 -0
- data/lib/card/view/fetch.rb +109 -0
- data/lib/card/view/options.rb +164 -0
- data/lib/card/view/stub.rb +30 -0
- data/lib/card/view/visibility.rb +95 -0
- data/lib/cardio.rb +3 -2
- data/lib/cardio/schema.rb +21 -8
- data/lib/generators/card.rb +16 -2
- data/lib/generators/card/format/format_generator.rb +10 -9
- data/lib/generators/card/migration/migration_generator.rb +10 -5
- data/lib/generators/card/set/USAGE +1 -1
- data/lib/generators/card/set/set_generator.rb +11 -9
- data/mod/account/set/right/account.rb +38 -40
- data/mod/account/set/right/token.rb +2 -1
- data/mod/account/set/self/account_links.rb +34 -54
- data/mod/account/set/self/signin.rb +107 -93
- data/mod/account/set/type/signup.rb +33 -32
- data/mod/account/set/type/user.rb +28 -21
- data/mod/account/spec/set/all/account_spec.rb +9 -9
- data/mod/account/spec/set/right/account_spec.rb +23 -14
- data/mod/account/spec/set/right/email_spec.rb +6 -6
- data/mod/account/spec/set/right/password_spec.rb +4 -4
- data/mod/account/spec/set/right/token_spec.rb +3 -3
- data/mod/account/spec/set/self/account_links_spec.rb +3 -3
- data/mod/account/spec/set/self/signin_spec.rb +2 -2
- data/mod/account/spec/set/type/signup_spec.rb +7 -8
- data/mod/ace_editor/set/abstract/ace_editor.rb +1 -4
- data/mod/admin/set/self/admin.rb +2 -2
- data/mod/admin/set/self/admin_info.rb +1 -1
- data/mod/admin/set/self/recaptcha_private_key.rb +3 -0
- data/mod/admin/set/self/recaptcha_proxy.rb +3 -0
- data/mod/admin/set/self/recaptcha_public_key.rb +3 -0
- data/mod/admin/set/self/trash.rb +4 -4
- data/mod/admin/spec/set/self/admin_spec.rb +4 -4
- data/mod/admin/spec/set/self/version_spec.rb +1 -1
- data/mod/basic_formats/set/all/all_css.rb +3 -3
- data/mod/basic_formats/set/all/all_csv.rb +6 -6
- data/mod/basic_formats/set/all/all_js.rb +4 -0
- data/mod/basic_formats/set/all/base.rb +40 -62
- data/mod/basic_formats/set/all/json.rb +34 -39
- data/mod/basic_formats/set/all/rss.rb +6 -6
- data/mod/basic_formats/set/all/text.rb +3 -2
- data/mod/basic_formats/set/self/01_head/javascript.rb +2 -2
- data/mod/basic_formats/set/self/head.rb +6 -10
- data/mod/basic_formats/spec/set/all/all_css_spec.rb +1 -1
- data/mod/basic_formats/spec/set/all/all_csv_spec.rb +1 -1
- data/mod/basic_formats/spec/set/all/base_spec.rb +8 -5
- data/mod/basic_formats/spec/set/all/json_spec.rb +2 -2
- data/mod/basic_formats/spec/set/all/rss_spec.rb +4 -4
- data/mod/basic_types/set/type/plain_text.rb +3 -5
- data/mod/basic_types/spec/set/type/plain_text_spec.rb +2 -2
- data/mod/bootstrap/lib/bootstrap.rb +16 -0
- data/mod/bootstrap/lib/bootstrap/basic_tags.rb +26 -0
- data/mod/bootstrap/lib/bootstrap/component.rb +133 -0
- data/mod/bootstrap/lib/bootstrap/component/form.rb +31 -0
- data/mod/bootstrap/lib/bootstrap/component/horizontal_form.rb +38 -0
- data/mod/bootstrap/lib/bootstrap/component/layout.rb +83 -0
- data/mod/bootstrap/lib/bootstrap/component/panel.rb +9 -0
- data/mod/bootstrap/lib/bootstrap/component_loader.rb +30 -0
- data/mod/bootstrap/lib/bootstrap/delegate.rb +16 -0
- data/mod/bootstrap/lib/bootstrapper.rb +16 -0
- data/mod/bootstrap/lib/stylesheets/bootstrap/_tables.scss +55 -52
- data/mod/bootstrap/lib/stylesheets/bootstrap/mixins/_table-row.scss +12 -12
- data/mod/bootstrap/lib/stylesheets/bootstrap_cards.scss +12 -0
- data/mod/bootstrap/set/all/bootstrap/accordion.rb +63 -0
- data/mod/bootstrap/set/all/bootstrap/helper.rb +7 -140
- data/mod/bootstrap/set/all/bootstrap/navbar.rb +74 -0
- data/mod/bootstrap/set/all/bootstrap/table.rb +76 -46
- data/mod/bootstrap/set/all/bootstrap/tabs.rb +58 -23
- data/mod/bootstrap/set/all/bootstrap/wrapper.rb +14 -8
- data/mod/bootstrap/set/all/rich_bootstrap.rb +5 -3
- data/mod/bootstrap/spec/set/all/bootstrap/bootstrap_builder_spec.rb +31 -0
- data/mod/bootstrap/spec/set/all/bootstrap/bootstrap_spec.rb +20 -0
- data/mod/bootstrap/spec/set/all/bootstrap/form_spec.rb +59 -1
- data/mod/bootstrap/spec/set/all/bootstrap/layout_spec.rb +104 -15
- data/mod/carrierwave/set/abstract/attachment.rb +4 -3
- data/mod/carrierwave/set/abstract/attachment/paths.rb +1 -1
- data/mod/carrierwave/set/abstract/attachment/storage_type.rb +5 -11
- data/mod/carrierwave/set/type/file.rb +39 -32
- data/mod/carrierwave/set/type/image.rb +59 -34
- data/mod/carrierwave/spec/set/type/image_spec.rb +3 -3
- data/mod/core/chunk/link.rb +5 -0
- data/mod/core/chunk/{include.rb → nest.rb} +8 -29
- data/mod/core/chunk/reference.rb +5 -6
- data/mod/core/chunk/view_stub.rb +42 -0
- data/mod/core/format/html_format.rb +23 -26
- data/mod/core/set/abstract/code_file.rb +1 -1
- data/mod/core/set/all/actify.rb +1 -1
- data/mod/core/set/all/active_card.rb +0 -1
- data/mod/core/set/all/{tracked_attributes.rb → assign_attributes.rb} +55 -24
- data/mod/core/set/all/collection.rb +136 -122
- data/mod/core/set/all/content.rb +8 -0
- data/mod/core/set/all/event.rb +5 -2
- data/mod/core/set/all/export.rb +7 -7
- data/mod/core/set/all/fetch.rb +90 -26
- data/mod/core/set/all/initialize.rb +17 -6
- data/mod/core/set/all/name.rb +2 -3
- data/mod/core/set/all/permissions.rb +19 -11
- data/mod/core/set/all/states.rb +12 -2
- data/mod/core/set/all/trash.rb +1 -1
- data/mod/core/set/all/type.rb +2 -0
- data/mod/core/set/all/utils.rb +4 -3
- data/mod/core/spec/chunk/literal_spec.rb +2 -2
- data/mod/core/spec/chunk/uri_spec.rb +17 -17
- data/mod/core/spec/format/html_format_spec.rb +11 -13
- data/mod/core/spec/set/all/attribute_tracking_spec.rb +2 -2
- data/mod/core/spec/set/all/collection_spec.rb +21 -24
- data/mod/core/spec/set/all/content_spec.rb +1 -1
- data/mod/core/spec/set/all/export_spec.rb +3 -3
- data/mod/core/spec/set/all/fetch_spec.rb +5 -5
- data/mod/core/spec/set/all/initialize_spec.rb +4 -4
- data/mod/core/spec/set/all/name_spec.rb +6 -6
- data/mod/core/spec/set/all/permissions_spec.rb +10 -10
- data/mod/core/spec/set/all/references_spec.rb +1 -1
- data/mod/core/spec/set/all/rules2_spec.rb +24 -24
- data/mod/core/spec/set/all/rules_spec.rb +1 -1
- data/mod/core/spec/set/all/templating_spec.rb +8 -8
- data/mod/core/spec/set/all/tracked_attributes_spec.rb +6 -6
- data/mod/core/spec/set/all/type_spec.rb +5 -5
- data/mod/developer/spec/set/all/event_viz_spec.rb +1 -1
- data/mod/developer/spec/set/right/debug_spec.rb +1 -1
- data/mod/email/set/all/email_html.rb +2 -2
- data/mod/email/set/all/notify.rb +8 -3
- data/mod/email/set/right/bcc.rb +3 -3
- data/mod/email/set/right/follow.rb +5 -5
- data/mod/email/set/right/following.rb +1 -1
- data/mod/email/set/self/follow_defaults.rb +27 -16
- data/mod/email/set/type/email_template.rb +1 -1
- data/mod/email/set/type_plus_right/user/follow.rb +10 -9
- data/mod/history/lib/card/act.rb +4 -0
- data/mod/history/lib/card/act/act_renderer.rb +194 -0
- data/mod/history/lib/card/act/act_renderer/absolute_act_renderer.rb +25 -0
- data/mod/history/lib/card/act/act_renderer/relative_act_renderer.rb +41 -0
- data/mod/history/lib/card/action.rb +1 -0
- data/mod/history/lib/card/action/action_renderer.rb +92 -0
- data/mod/history/lib/card/action/differ.rb +6 -1
- data/mod/history/set/all/act_view.rb +64 -0
- data/mod/history/set/all/action_view.rb +65 -0
- data/mod/history/set/all/content_history.rb +44 -37
- data/mod/history/set/all/history.rb +49 -263
- data/mod/machines/lib/stylesheets/style_cards.scss +30 -115
- data/mod/machines/set/abstract/script.rb +42 -7
- data/mod/machines/set/right/machine_input.rb +4 -0
- data/mod/machines/set/type/coffee_script.rb +8 -22
- data/mod/machines/set/type/css.rb +2 -2
- data/mod/machines/set/type/java_script.rb +4 -24
- data/mod/machines/set/type/scss.rb +1 -1
- data/mod/machines/spec/set/type/css_spec.rb +1 -1
- data/mod/machines/spec/set/type/scss_spec.rb +3 -3
- data/mod/machines/spec/set/type/skin_spec.rb +7 -7
- data/mod/pointer/set/abstract/01_pointer.rb +44 -46
- data/mod/pointer/set/abstract/01_pointer/edit.rb +13 -13
- data/mod/pointer/set/right/options.rb +4 -0
- data/mod/pointer/spec/set/type/pointer_spec.rb +7 -7
- data/mod/prosemirror_editor/set/abstract/prosemirror_editor.rb +3 -3
- data/mod/settings/set/abstract/permission.rb +25 -18
- data/mod/settings/set/right/add_help.rb +3 -3
- data/mod/settings/set/right/structure.rb +10 -16
- data/mod/settings/spec/set/right/comment_spec.rb +3 -3
- data/mod/settings/spec/set/right/create_spec.rb +1 -1
- data/mod/settings/spec/set/right/style_spec.rb +1 -1
- data/mod/settings/spec/set/type/setting_spec.rb +1 -1
- data/mod/solid_cache/set/abstract/solid_cache.rb +4 -4
- data/mod/solid_cache/set/right/solid_cache.rb +9 -10
- data/mod/standard/set/abstract/01_search_params.rb +41 -0
- data/mod/standard/set/abstract/search.rb +132 -0
- data/mod/standard/set/abstract/search/paging.rb +81 -0
- data/mod/standard/set/abstract/search/paging/paging_links.rb +90 -0
- data/mod/standard/set/abstract/wql_search.rb +67 -0
- data/mod/standard/set/all/error.rb +89 -82
- data/mod/standard/set/all/links.rb +1 -1
- data/mod/standard/set/all/rich_html/content.rb +125 -141
- data/mod/standard/set/all/rich_html/editing.rb +115 -178
- data/mod/standard/set/all/rich_html/form.rb +111 -131
- data/mod/standard/set/all/rich_html/header.rb +57 -39
- data/mod/standard/set/all/rich_html/menu.rb +94 -94
- data/mod/standard/set/all/rich_html/modal.rb +5 -10
- data/mod/standard/set/all/rich_html/new.rb +103 -0
- data/mod/standard/set/all/rich_html/toolbar.rb +54 -74
- data/mod/standard/set/all/rich_html/wrapper.rb +111 -138
- data/mod/standard/set/rstar/rules.rb +27 -38
- data/mod/standard/set/rstar/rules_editor.rb +298 -277
- data/mod/standard/set/self/navbox.rb +20 -15
- data/mod/standard/set/self/recent.rb +25 -17
- data/mod/standard/set/self/search.rb +25 -4
- data/mod/standard/set/type/cardtype.rb +11 -9
- data/mod/standard/set/type/date.rb +1 -1
- data/mod/standard/set/type/number.rb +1 -1
- data/mod/standard/set/type/phrase.rb +1 -1
- data/mod/standard/set/type/search_type.rb +17 -282
- data/mod/standard/set/type/session.rb +1 -1
- data/mod/standard/set/type/set.rb +155 -131
- data/mod/standard/set/type/toggle.rb +1 -1
- data/mod/standard/set/type/uri.rb +4 -4
- data/mod/standard/spec/chunk/include_spec.rb +13 -31
- data/mod/standard/spec/chunk/link_spec.rb +1 -1
- data/mod/standard/spec/set/all/error_spec.rb +1 -1
- data/mod/standard/spec/set/all/history_spec.rb +2 -2
- data/mod/standard/spec/set/all/rich_html/form_spec.rb +4 -4
- data/mod/standard/spec/set/all/rich_html/toolbar_spec.rb +22 -0
- data/mod/standard/spec/set/all/rich_html/wrapper_spec.rb +3 -2
- data/mod/standard/spec/set/right/when_created_spec.rb +1 -1
- data/mod/standard/spec/set/right/when_last_edited_spec.rb +1 -1
- data/mod/standard/spec/set/rstar/rules_spec.rb +2 -3
- data/mod/standard/spec/set/self/head_spec.rb +2 -2
- data/mod/standard/spec/set/self/navbox_spec.rb +1 -1
- data/mod/standard/spec/set/self/now_spec.rb +1 -1
- data/mod/standard/spec/set/type/date_spec.rb +1 -1
- data/mod/standard/spec/set/type/email_template_spec.rb +1 -1
- data/mod/standard/spec/set/type/layout_type_spec.rb +1 -1
- data/mod/standard/spec/set/type/number_spec.rb +1 -1
- data/mod/standard/spec/set/type/phrase_spec.rb +1 -1
- data/mod/standard/spec/set/type/search_type_spec.rb +2 -2
- data/mod/standard/spec/set/type/set_spec.rb +2 -2
- data/mod/standard/spec/set/type/toggle_spec.rb +2 -2
- data/mod/standard/spec/set/type/uri_spec.rb +3 -1
- data/mod/tinymce_editor/set/abstract/tinymce_editor.rb +1 -1
- data/spec/config/initializers/core_extensions_spec.rb +40 -10
- data/spec/lib/card/auth_spec.rb +8 -8
- data/spec/lib/card/cache_spec.rb +3 -3
- data/spec/lib/card/chunk_spec.rb +4 -4
- data/spec/lib/card/codename_spec.rb +2 -2
- data/spec/lib/card/content_spec.rb +23 -23
- data/spec/lib/card/diff_spec.rb +1 -1
- data/spec/lib/card/format_spec.rb +19 -24
- data/spec/lib/card/loader_spec.rb +4 -4
- data/spec/lib/card/name_spec.rb +16 -16
- data/spec/lib/card/query_spec.rb +80 -80
- data/spec/lib/card/reference_spec.rb +5 -5
- data/spec/lib/card/set_spec.rb +6 -6
- data/spec/lib/card/subcards_spec.rb +14 -0
- data/spec/lib/card/view_cache_spec.rb +5 -5
- data/spec/models/card/cardtype_spec.rb +15 -15
- data/spec/models/card/create_spec.rb +2 -2
- data/spec/models/card/trash_spec.rb +24 -24
- data/spec/models/card/type_transition_spec.rb +8 -8
- data/spec/models/card/validation_spec.rb +5 -5
- data/spec/models/card_spec.rb +14 -14
- data/spec/spec_helper.rb +6 -2
- data/spec/support/card_spec_helper.rb +21 -11
- data/spec/support/helper/card_helper.rb +11 -4
- metadata +73 -15
- data/lib/card/cache/view_cache.rb +0 -103
- data/mod/bootstrap/set/all/bootstrap/layout.rb +0 -58
- data/mod/core/set/all/view_cache.rb +0 -9
@@ -68,7 +68,7 @@ describe Card::Content::Chunk::Link do
|
|
68
68
|
href: "http://google.com", text: "http://google.com"
|
69
69
|
end
|
70
70
|
|
71
|
-
it "
|
71
|
+
it "escapes spaces in cardnames with %20 (not +)" do
|
72
72
|
assert_link '[[Marie "Mad Dog" Deatherage|Marie]]',
|
73
73
|
class: "wanted-card",
|
74
74
|
href: "/Marie_Mad_Dog_Deatherage" \
|
@@ -4,7 +4,7 @@ describe Card::Set::All::History do
|
|
4
4
|
# before do
|
5
5
|
# Card.create! name: 'my histoer card'
|
6
6
|
# end
|
7
|
-
it "
|
7
|
+
it "has a frame" do
|
8
8
|
history = render_card :history, name: "A"
|
9
9
|
assert_view_select history, 'div[class~="card-frame"]'
|
10
10
|
end
|
@@ -15,7 +15,7 @@ describe Card::Set::All::History do
|
|
15
15
|
first.format.render_action_summary
|
16
16
|
end
|
17
17
|
|
18
|
-
it "
|
18
|
+
it "has a summary" do
|
19
19
|
assert_view_select subject, 'del[class="diffdel diff-deleted"]',
|
20
20
|
text: "chicken"
|
21
21
|
assert_view_select subject, 'ins[class="diffins diff-added"]',
|
@@ -6,7 +6,7 @@ describe Card::Set::All::RichHtml::Form do
|
|
6
6
|
@card = Card["UserForm"] # no cards with this type
|
7
7
|
end
|
8
8
|
|
9
|
-
it "
|
9
|
+
it "gets type options from type_field renderer method" do
|
10
10
|
expect(@card.format.type_field).to match(/<option [^>]*selected/)
|
11
11
|
tf = @card.format.type_field(no_current_type: true)
|
12
12
|
expect(tf).not_to match(/<option [^>]*selected/)
|
@@ -16,7 +16,7 @@ describe Card::Set::All::RichHtml::Form do
|
|
16
16
|
expect(tf.scan(/<option /).length).to eq(29)
|
17
17
|
end
|
18
18
|
|
19
|
-
it "
|
19
|
+
it "gets type list" do
|
20
20
|
Card::Auth.as :anonymous do
|
21
21
|
tf = @card.format.type_field(no_current_type: true)
|
22
22
|
expect(tf).not_to match(/<option [^>]*selected/)
|
@@ -29,14 +29,14 @@ describe Card::Set::All::RichHtml::Form do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
context "type and header" do
|
32
|
-
it "
|
32
|
+
it "renders type without no-edit class when no cards of type" do
|
33
33
|
card = Card["UserForm"] # no cards with this type
|
34
34
|
expect(card.format.render_type)
|
35
35
|
.to match(/<a[^>]* class="([^"]*)?\bcardtype\b[^"]*"/)
|
36
36
|
expect(card.format.render_type)
|
37
37
|
.not_to match(/<a[^>]* class="([^"]*)?\bno-edit\b[^"]*"/)
|
38
38
|
end
|
39
|
-
it "
|
39
|
+
it "renders type header with no-edit class when cards of type exist" do
|
40
40
|
no_edit_card = Card["cardtype a"]
|
41
41
|
expect(no_edit_card.format.render_type)
|
42
42
|
.to match(/<a[^>]* class="([^"]*)?\bcardtype\b[^"]*"/)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
describe Card::Set::All::RichHtml::Toolbar do
|
2
|
+
context "show toolbar" do
|
3
|
+
subject do
|
4
|
+
render_content "{{A|edit}}"
|
5
|
+
end
|
6
|
+
it "renders toolbar" do
|
7
|
+
is_expected.to have_tag "div", with: { class: "SELF-a edit-view" } do
|
8
|
+
with_tag "nav", with: { class: "toolbar" }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
context "hidden toolbar" do
|
13
|
+
subject do
|
14
|
+
render_content "{{A|edit; hide: toolbar}}"
|
15
|
+
end
|
16
|
+
it "hides toolbar" do
|
17
|
+
is_expected.to have_tag "div", with: { class: "SELF-a edit-view" } do
|
18
|
+
without_tag "nav", with: { class: "toolbar" }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -21,7 +21,7 @@ describe Card::Set::All::RichHtml::Wrapper do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "has the appropriate attributes on closed" do
|
24
|
-
v = @ocslot.render
|
24
|
+
v = @ocslot.render :closed
|
25
25
|
assert_view_select(
|
26
26
|
v, 'div[class="card-slot closed-view ALL TYPE-basic SELF-a"]'
|
27
27
|
) do
|
@@ -29,7 +29,8 @@ describe Card::Set::All::RichHtml::Wrapper do
|
|
29
29
|
assert_select 'div[class="card-header panel-heading"]' do
|
30
30
|
assert_select 'div[class="card-header-title panel-title"]'
|
31
31
|
end
|
32
|
-
assert_select 'div[class~="
|
32
|
+
assert_select 'div[class~="card-body card-content"]'
|
33
|
+
assert_select 'div[class~="closed-content"]'
|
33
34
|
end
|
34
35
|
end
|
35
36
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
3
|
describe Card::Set::Rstar::Rules do
|
4
|
-
it "
|
4
|
+
it "renders setting view for a right set" do
|
5
5
|
r = Card["*read+*right"].format.render_open
|
6
6
|
expect(r).not_to match(/error/i)
|
7
7
|
expect(r).not_to match("No Card!")
|
@@ -12,12 +12,11 @@ describe Card::Set::Rstar::Rules do
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
it "
|
15
|
+
it "renders setting view for a *input rule" do
|
16
16
|
Card::Auth.as_bot do
|
17
17
|
r = Card.fetch("*read+*right+*input", new: {}).format.render_open_rule
|
18
18
|
expect(r).not_to match(/error/i)
|
19
19
|
expect(r).not_to match("No Card!")
|
20
|
-
# warn "r = #{r}"
|
21
20
|
assert_view_select r, 'tr[class="card-slot open-rule edit-rule"]' do
|
22
21
|
assert_select 'input[id="success_id"][name=?][type="hidden"]'\
|
23
22
|
'[value="*read+*right+*input"]', "success[id]"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
3
|
describe Card::Set::Self::Head do
|
4
|
-
it "
|
4
|
+
it "has a javascript tag" do
|
5
5
|
assert_view_select render_card(:raw, name: "*head"),
|
6
6
|
'script[type="text/javascript"]'
|
7
7
|
end
|
@@ -10,7 +10,7 @@ describe Card::Set::Self::Head do
|
|
10
10
|
before do
|
11
11
|
@tiny_mce = Card[:tiny_mce]
|
12
12
|
end
|
13
|
-
it "
|
13
|
+
it "handles tinyMCE configuration errors" do
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -185,7 +185,7 @@ describe Card::Set::Type::EmailTemplate do
|
|
185
185
|
Card.create! name: "subject search+*right+*structure",
|
186
186
|
content: %({"referred_to_by":"_left+subject"}),
|
187
187
|
type: "Search"
|
188
|
-
update_field "*subject", content: "{{+subject search|core
|
188
|
+
update_field "*subject", content: "{{+subject search|core|core}}"
|
189
189
|
expect(subject[:subject]).to eq("a very nutty thang")
|
190
190
|
end
|
191
191
|
|
@@ -3,11 +3,11 @@
|
|
3
3
|
describe Card::Set::Type::SearchType do
|
4
4
|
it "wraps search items with correct view class" do
|
5
5
|
Card.create type: "Search", name: "Asearch", content: %({"type":"User"})
|
6
|
-
c = render_content("{{Asearch|core
|
6
|
+
c = render_content("{{Asearch|core|name}}")
|
7
7
|
expect(c).to match("search-result-item item-name")
|
8
8
|
expect(render_content("{{Asearch|core}}")
|
9
9
|
.scan("search-result-item item-closed").size).to eq(14)
|
10
|
-
expect(render_content("{{Asearch|core
|
10
|
+
expect(render_content("{{Asearch|core|open}}")
|
11
11
|
.scan("search-result-item item-open").size).to eq(14)
|
12
12
|
expect(render_content("{{Asearch|core|titled}}")
|
13
13
|
.scan("search-result-item item-titled").size).to eq(14)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
describe Card::Set::Type::Set do
|
4
4
|
describe :junction_only? do
|
5
|
-
it "
|
5
|
+
it "identifies sets that only apply to plus cards" do
|
6
6
|
expect(Card.fetch("*all").junction_only?).to be_falsey
|
7
7
|
expect(Card.fetch("*all plus").junction_only?).to be_truthy
|
8
8
|
expect(Card.fetch("Book+*type").junction_only?).to be_falsey
|
@@ -13,7 +13,7 @@ describe Card::Set::Type::Set do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe :inheritable? do
|
16
|
-
it "
|
16
|
+
it "identifies sets that can inherit rules" do
|
17
17
|
expect(Card.fetch("A+*self").inheritable?).to be_falsey
|
18
18
|
expect(Card.fetch("A+B+*self").inheritable?).to be_truthy
|
19
19
|
expect(Card.fetch("Book+*to+*type plus right").inheritable?).to be_truthy
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
3
|
describe Card::Set::Type::Toggle do
|
4
|
-
it "
|
4
|
+
it "has special editor" do
|
5
5
|
assert_view_select render_editor("Toggle"), 'input[type="checkbox"]'
|
6
6
|
end
|
7
7
|
|
8
|
-
it "
|
8
|
+
it "has yes/no as processed content" do
|
9
9
|
expect(render_card(:core, type: "Toggle", content: "0")).to eq("no")
|
10
10
|
expect(render_card(:closed_content, type: "Toggle", content: "1"))
|
11
11
|
.to eq("yes")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
3
|
describe Card::Set::Type::Uri do
|
4
|
-
it "
|
4
|
+
it "has special editor" do
|
5
5
|
assert_view_select render_editor("Uri"),
|
6
6
|
'input[type="text"][class~="card-content"]'
|
7
7
|
end
|
@@ -20,6 +20,8 @@ describe Card::Set::Type::Uri do
|
|
20
20
|
it "renders core view links with title arg" do
|
21
21
|
card = Card.create(type: "URI", name: "A URI card",
|
22
22
|
content: "http://wagn.org/Home")
|
23
|
+
|
24
|
+
|
23
25
|
assert_view_select(
|
24
26
|
card.format.render("core", title: "My Title"),
|
25
27
|
'a[class="external-link"][href="http://wagn.org/Home"]'
|
@@ -1,17 +1,47 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
|
-
describe
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
describe CoreExtensions do
|
4
|
+
context Hash do
|
5
|
+
describe "#new_nested" do
|
6
|
+
it "creates nested hashes" do
|
7
|
+
nested_hash = Hash.new_nested Hash, Hash
|
8
|
+
expect(nested_hash[:a]).to be_instance_of Hash
|
9
|
+
expect(nested_hash[:a][:b]).to be_instance_of Hash
|
10
|
+
expect(nested_hash[:d][:c]).to be_instance_of Hash
|
11
|
+
end
|
12
|
+
|
13
|
+
it "creates set in hash" do
|
14
|
+
nested_hash = Hash.new_nested ::Set
|
15
|
+
expect(nested_hash[:a]).to be_instance_of ::Set
|
16
|
+
end
|
10
17
|
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context CoreExtensions::PersistentIdentifier do
|
21
|
+
describe "#cardname" do
|
22
|
+
subject { :wagn_bot.cardname }
|
23
|
+
it "converts into a cardname" do
|
24
|
+
is_expected.to be_instance_of Card::Name
|
25
|
+
expect(subject.s).to eq "Wagn Bot"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "#card" do
|
30
|
+
context "called on Integer" do
|
31
|
+
subject { Card::LogoID.card }
|
32
|
+
it "converts into a card" do
|
33
|
+
is_expected.to be_instance_of Card
|
34
|
+
expect(subject.id).to eq Card::LogoID
|
35
|
+
end
|
36
|
+
end
|
11
37
|
|
12
|
-
|
13
|
-
|
14
|
-
|
38
|
+
context "called on Symbol" do
|
39
|
+
subject { :logo.card }
|
40
|
+
it "converts into a card" do
|
41
|
+
is_expected.to be_instance_of Card
|
42
|
+
expect(subject.key).to eq(:logo.cardname.key)
|
43
|
+
end
|
44
|
+
end
|
15
45
|
end
|
16
46
|
end
|
17
47
|
end
|
data/spec/lib/card/auth_spec.rb
CHANGED
@@ -6,32 +6,32 @@ describe Card::Auth do
|
|
6
6
|
@joeuserid = Card["Joe User"].id
|
7
7
|
end
|
8
8
|
|
9
|
-
it "
|
9
|
+
it "authenticates user" do
|
10
10
|
authenticated = Card::Auth.authenticate "joe@user.com", "joe_pass"
|
11
11
|
expect(authenticated.left_id).to eq(@joeuserid)
|
12
12
|
end
|
13
13
|
|
14
|
-
it "
|
14
|
+
it "authenticates user despite whitespace" do
|
15
15
|
authenticated = Card::Auth.authenticate " joe@user.com ", " joe_pass "
|
16
16
|
expect(authenticated.left_id).to eq(@joeuserid)
|
17
17
|
end
|
18
18
|
|
19
|
-
it "
|
19
|
+
it "authenticates user with weird email capitalization" do
|
20
20
|
authenticated = Card::Auth.authenticate "JOE@user.com", "joe_pass"
|
21
21
|
expect(authenticated.left_id).to eq(@joeuserid)
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
24
|
+
it "sets current directly from email" do
|
25
25
|
Card::Auth.current= "joe@user.com"
|
26
26
|
expect(Card::Auth.current_id).to eq(@joeuserid)
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
29
|
+
it "sets current directly from id when mark is id" do
|
30
30
|
Card::Auth.current= @joeuserid
|
31
31
|
expect(Card::Auth.current_id).to eq(@joeuserid)
|
32
32
|
end
|
33
33
|
|
34
|
-
it "
|
34
|
+
it "sets current directly from id when mark is id" do
|
35
35
|
Card::Auth.current= @joeuserid
|
36
36
|
expect(Card::Auth.current_id).to eq(@joeuserid)
|
37
37
|
end
|
@@ -45,12 +45,12 @@ describe Card::Auth do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
it "
|
48
|
+
it "sets current from token" do
|
49
49
|
Card::Auth.set_current_from_token @token
|
50
50
|
expect(Card::Auth.current_id).to eq(@joeadmin.id)
|
51
51
|
end
|
52
52
|
|
53
|
-
it "
|
53
|
+
it "sets arbitrary current from token on authorized account" do
|
54
54
|
Card::Auth.set_current_from_token @token, @joeuserid
|
55
55
|
expect(Card::Auth.current_id).to eq(@joeuserid)
|
56
56
|
end
|
data/spec/lib/card/cache_spec.rb
CHANGED
@@ -7,7 +7,7 @@ describe Card::Cache do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
describe "#basic operations" do
|
10
|
-
it "
|
10
|
+
it "works" do
|
11
11
|
@cache.write("a", "foo")
|
12
12
|
expect(@cache.read("a")).to eq("foo")
|
13
13
|
@cache.fetch("b") { "bar" }
|
@@ -90,7 +90,7 @@ describe Card::Cache do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
describe "#basic operations with special symbols" do
|
93
|
-
it "
|
93
|
+
it "works" do
|
94
94
|
@cache.write('%\\/*:?"<>|', "foo")
|
95
95
|
cache2 = Card::Cache.new store: @hard, prefix: "prefix"
|
96
96
|
expect(cache2.read('%\\/*:?"<>|')).to eq("foo")
|
@@ -99,7 +99,7 @@ describe Card::Cache do
|
|
99
99
|
end
|
100
100
|
|
101
101
|
describe "#basic operations with non-latin symbols" do
|
102
|
-
it "
|
102
|
+
it "works" do
|
103
103
|
@cache.write("(汉语漢語 Hànyǔ; 华语華語 Huáyǔ; 中文 Zhōngwén", "foo")
|
104
104
|
@cache.write("русский", "foo")
|
105
105
|
cache3 = Card::Cache.new store: @hard, prefix: "prefix"
|