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
@@ -64,7 +64,7 @@ describe Card::Reference do
|
|
64
64
|
expect(Card["Ethan"].referers.map(&:name).include?("L")).not_to eq(nil)
|
65
65
|
end
|
66
66
|
|
67
|
-
it "
|
67
|
+
it "updates references on rename when requested" do
|
68
68
|
create! "watermelon", "mmmm"
|
69
69
|
create! "watermelon+seeds", "black"
|
70
70
|
lew = create!("Lew", "likes [[watermelon]] and [[watermelon+seeds|seeds]]")
|
@@ -77,7 +77,7 @@ describe Card::Reference do
|
|
77
77
|
expect(lew.reload.content).to eq(result)
|
78
78
|
end
|
79
79
|
|
80
|
-
it "
|
80
|
+
it "updates referers on rename when requested (case 2)" do
|
81
81
|
card = Card["Administrator Menu+*self+*read"]
|
82
82
|
old_refs = Card::Reference.where(referee_id: Card::AdministratorID)
|
83
83
|
|
@@ -89,14 +89,14 @@ describe Card::Reference do
|
|
89
89
|
expect(old_refs).to eq(new_refs)
|
90
90
|
end
|
91
91
|
|
92
|
-
it "
|
92
|
+
it "does not update references when not requested" do
|
93
93
|
watermelon = create! "watermelon", "mmmm"
|
94
94
|
watermelon_seeds = create! "watermelon+seeds", "black"
|
95
95
|
lew = create!("Lew", "likes [[watermelon]] and [[watermelon+seeds|seeds]]")
|
96
96
|
|
97
97
|
assert_equal [watermelon.id, watermelon_seeds.id],
|
98
98
|
lew.references_out.order(:id).map(&:referee_id),
|
99
|
-
"
|
99
|
+
"stores referee ids"
|
100
100
|
|
101
101
|
watermelon = Card["watermelon"]
|
102
102
|
watermelon.update_referers = false
|
@@ -191,7 +191,7 @@ describe Card::Reference do
|
|
191
191
|
expect(Card["search w refs"].content).to eq '{"name":"_+AAA"}'
|
192
192
|
end
|
193
193
|
|
194
|
-
it "
|
194
|
+
it "handles commented nest" do
|
195
195
|
c = Card.create name: "nest comment test", content: "{{## hi mom }}"
|
196
196
|
expect(c.errors.any?).to be_falsey
|
197
197
|
end
|
data/spec/lib/card/set_spec.rb
CHANGED
@@ -19,12 +19,12 @@
|
|
19
19
|
# expect(@account_card.role).to eq('request')
|
20
20
|
# end
|
21
21
|
#
|
22
|
-
# it "
|
22
|
+
# it "does not have a reader method for card_writer" do
|
23
23
|
# expect(@account_card.respond_to?( :write)).to be_falsey
|
24
24
|
# expect(@account_card.method( :write= )).to be
|
25
25
|
# end
|
26
26
|
#
|
27
|
-
# it "
|
27
|
+
# it "does not have a reader method for card_reader" do
|
28
28
|
# expect(@account_card.method( :read)).to be
|
29
29
|
# expect(@account_card.respond_to?( :read= )).to be_falsey
|
30
30
|
# end
|
@@ -52,14 +52,14 @@
|
|
52
52
|
# #let(:html_format_double) { Card::Format::HtmlFormat }
|
53
53
|
# let(:html_format_double) { double("Card::Format::HtmlFormat") }
|
54
54
|
#
|
55
|
-
# it "
|
55
|
+
# it "defines Formatter methods from modules" do
|
56
56
|
# expect(format_double).to respond_to(:render_navbox_self_core)
|
57
57
|
# expect(format_double.method(:render_navbox_self_core)).to be
|
58
58
|
# expect(format_double.method(:_render_right_right_raw)).to be
|
59
59
|
# expect(format_double.method(:render_type_search_core)).to be
|
60
60
|
# expect(format_double.method(:_final_type_search_raw)).to be
|
61
61
|
# end
|
62
|
-
# it "
|
62
|
+
# it "calls set render methods" do
|
63
63
|
# expect(card_self).to receive(:_final_self_navbox_core)
|
64
64
|
# card_self.format.render_core
|
65
65
|
# #expect(card_right.format.method(:_render_right_right_raw)).to be
|
@@ -70,13 +70,13 @@
|
|
70
70
|
# expect(card.method(:_final_type_search_raw)).to be
|
71
71
|
# card.format.render_core
|
72
72
|
# end
|
73
|
-
# it "
|
73
|
+
# it "defines Formatter methods from modules" do
|
74
74
|
# expect(html_format_double.method(:render_self_navbox_core)).to be
|
75
75
|
# expect(html_format_double.method(:_render_right_right_raw)).to be
|
76
76
|
# expect(html_format_double.method(:render_type_search_core)).to be
|
77
77
|
# expect(html_format_double.method(:_final_type_search_raw)).to be
|
78
78
|
# end
|
79
|
-
# it "
|
79
|
+
# it "defines Formatter methods from modules" do
|
80
80
|
# expect(card_self).to receive(:_final_self_navbox_titled)
|
81
81
|
# card_self.render_titled
|
82
82
|
# expect(card_right.method(:_render_right_right_edit)).to be
|
@@ -12,6 +12,13 @@ describe Card::Subcards do
|
|
12
12
|
expect(Card["card with subs+sub1"].content).to eq "this is sub1"
|
13
13
|
end
|
14
14
|
|
15
|
+
it "check name-key bug" do
|
16
|
+
Card::Auth.as_bot do
|
17
|
+
Card.create! name: "Matthias", subcards: {"+name" => "test"}
|
18
|
+
expect(Card.exists? "Matthias+name").to be_truthy
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
15
22
|
it "works with content string" do
|
16
23
|
Card::Auth.as_bot do
|
17
24
|
@card = Card.create!(
|
@@ -21,6 +28,13 @@ describe Card::Subcards do
|
|
21
28
|
expect(Card["card with subs+sub1"].content).to eq "this is sub1"
|
22
29
|
end
|
23
30
|
|
31
|
+
it "check unstable key bug" do
|
32
|
+
Card::Auth.as_bot do
|
33
|
+
Card.create! name: "Matthias", subcards: {"+name" => "test"}
|
34
|
+
expect(Card.exists? "Matthias+name").to be_truthy
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
24
38
|
it "works with +name key in args" do
|
25
39
|
Card::Auth.as_bot do
|
26
40
|
@card = Card.create!(
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
|
-
describe Card::
|
4
|
-
it "gets cleared by Card::Cache.reset_all" do
|
5
|
-
Card::
|
6
|
-
expect(Card::
|
3
|
+
describe Card::View do
|
4
|
+
it "cache gets cleared by Card::Cache.reset_all" do
|
5
|
+
Card::View.cache.write "testkey", 1
|
6
|
+
expect(Card::View.cache.exist? "testkey").to be_truthy
|
7
7
|
Card::Cache.reset_all
|
8
|
-
expect(Card::
|
8
|
+
expect(Card::View.cache.exist? "testkey").to be_falsey
|
9
9
|
end
|
10
10
|
end
|
@@ -7,7 +7,7 @@ class Card
|
|
7
7
|
end
|
8
8
|
|
9
9
|
describe "Card (Cardtype)" do
|
10
|
-
it "
|
10
|
+
it "does not allow cardtype remove when instances present" do
|
11
11
|
Card.create name: "City", type: "Cardtype"
|
12
12
|
city = Card.fetch("City")
|
13
13
|
c1 = Card.create name: "Sparta", type: "City"
|
@@ -68,11 +68,11 @@ describe Card, "created without permission" do
|
|
68
68
|
# FIXME: this one should pass. unfortunately when I tried to fix it it started looking like the clean solution
|
69
69
|
# was to rewrite most of the permissions section as simple validations and i decided not to go down that rabbit hole.
|
70
70
|
#
|
71
|
-
# it "
|
71
|
+
# it "does not be valid" do
|
72
72
|
# Card.new( name: 'foo', type: 'Cardtype').valid?.should_not be_true
|
73
73
|
# end
|
74
74
|
|
75
|
-
it "
|
75
|
+
it "does not create a new cardtype until saved" do
|
76
76
|
expect do
|
77
77
|
Card.new(name: "foo", type: "Cardtype")
|
78
78
|
end.not_to change(Card, :count)
|
@@ -84,18 +84,18 @@ describe Card, "Normal card with descendants" do
|
|
84
84
|
@a = Card["A"]
|
85
85
|
end
|
86
86
|
|
87
|
-
it "
|
87
|
+
it "confirms that it has descendants" do
|
88
88
|
expect(@a.descendants.length).to be > 0
|
89
89
|
end
|
90
90
|
|
91
|
-
it "
|
91
|
+
it "has its type changed" do
|
92
92
|
Card::Auth.as_bot do
|
93
93
|
@a.type_id = Card::PhraseID
|
94
94
|
@a.save!
|
95
95
|
expect(Card["A"].type_code).to eq(:phrase)
|
96
96
|
end
|
97
97
|
end
|
98
|
-
it "
|
98
|
+
it "still has its descendants after changing type" do
|
99
99
|
Card::Auth.as_bot do
|
100
100
|
assert type_id = Card.fetch_id("cardtype_e")
|
101
101
|
@a.type_id = type_id
|
@@ -112,7 +112,7 @@ describe Card, "New Cardtype" do
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
-
it "
|
115
|
+
it "has create permissions" do
|
116
116
|
expect(@ct.who_can(:create)).not_to be_nil
|
117
117
|
end
|
118
118
|
|
@@ -129,7 +129,7 @@ describe Card, "Wannabe Cardtype Card" do
|
|
129
129
|
@card.save!
|
130
130
|
end
|
131
131
|
end
|
132
|
-
it "
|
132
|
+
it "changes its type to a Cardtype" do
|
133
133
|
expect(Card["convertible"].type_code).to eq(:cardtype)
|
134
134
|
end
|
135
135
|
end
|
@@ -145,16 +145,16 @@ describe Card, "Joe User" do
|
|
145
145
|
@type_names = Card::Auth.createable_types
|
146
146
|
end
|
147
147
|
|
148
|
-
it "
|
148
|
+
it "does not have r3 permissions" do
|
149
149
|
expect(@ucard.fetch(new: {}, trait: :roles).item_names.member?(@r3.name)).to be_falsey
|
150
150
|
end
|
151
|
-
it "
|
151
|
+
it "ponders creating a card of Cardtype F, but find that he lacks create permissions" do
|
152
152
|
expect(Card.new(type: "Cardtype F").ok?(:create)).to be_falsey
|
153
153
|
end
|
154
|
-
it "
|
154
|
+
it "does not find Cardtype F on its list of createable cardtypes" do
|
155
155
|
expect(@type_names.member?("Cardtype F")).to be_falsey
|
156
156
|
end
|
157
|
-
it "
|
157
|
+
it "finds Basic on its list of createable cardtypes" do
|
158
158
|
expect(@type_names.member?("Basic")).to be_truthy
|
159
159
|
end
|
160
160
|
end
|
@@ -163,11 +163,11 @@ describe Card, "Cardtype with Existing Cards" do
|
|
163
163
|
before do
|
164
164
|
@ct = Card["Cardtype F"]
|
165
165
|
end
|
166
|
-
it "
|
166
|
+
it "has existing cards of that type" do
|
167
167
|
expect(Card.search(type: @ct.name)).not_to be_empty
|
168
168
|
end
|
169
169
|
|
170
|
-
it "
|
170
|
+
it "raises an error when you try to delete it" do
|
171
171
|
Card::Auth.as_bot do
|
172
172
|
@ct.delete
|
173
173
|
expect(@ct.errors[:cardtype]).not_to be_empty
|
@@ -176,7 +176,7 @@ describe Card, "Cardtype with Existing Cards" do
|
|
176
176
|
end
|
177
177
|
|
178
178
|
describe Card::Set::Type::Cardtype do
|
179
|
-
it "
|
179
|
+
it "handles changing away from Cardtype" do
|
180
180
|
Card::Auth.as_bot do
|
181
181
|
ctg = Card.create! name: "CardtypeG", type: "Cardtype"
|
182
182
|
ctg.type_id = Card::BasicID
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# FIXME: this shouldn't be here
|
4
4
|
describe Card::Set::Type::Cardtype, ".create with :codename" do
|
5
|
-
it "
|
5
|
+
it "works" do
|
6
6
|
card = Card.create! name: "Foo Type", codename: "foo",
|
7
7
|
type: "Cardtype"
|
8
8
|
expect(card.type_code).to eq(:cardtype)
|
@@ -16,7 +16,7 @@ describe Card, "created by Card.new" do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
it "
|
19
|
+
it "does not override explicit content with default content" do
|
20
20
|
Card::Auth.as_bot do
|
21
21
|
Card.create! name: "blue+*right+*default", content: "joe", type: "Pointer"
|
22
22
|
c = Card.new name: "Lady+blue", content: "[[Jimmy]]"
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require "card/action"
|
4
4
|
|
5
5
|
describe Card, "deleting card" do
|
6
|
-
it "
|
6
|
+
it "requires permission" do
|
7
7
|
a = Card["a"]
|
8
8
|
Card::Auth.as :anonymous do
|
9
9
|
expect(a.ok?(:delete)).to eq(false)
|
@@ -21,10 +21,10 @@ describe Card, "deleted card" do
|
|
21
21
|
@c.delete!
|
22
22
|
end
|
23
23
|
end
|
24
|
-
it "
|
24
|
+
it "is in the trash" do
|
25
25
|
expect(@c.trash).to be_truthy
|
26
26
|
end
|
27
|
-
it "
|
27
|
+
it "comes out of the trash when a plus card is created" do
|
28
28
|
Card::Auth.as_bot do
|
29
29
|
Card.create(name: "A+*acct")
|
30
30
|
c = Card["A"]
|
@@ -34,7 +34,7 @@ describe Card, "deleted card" do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe Card, "in trash" do
|
37
|
-
it "
|
37
|
+
it "is retrieved by fetch with new" do
|
38
38
|
Card.create(name: "Betty").delete
|
39
39
|
c = Card.fetch "Betty", new: {}
|
40
40
|
c.save
|
@@ -43,7 +43,7 @@ describe Card, "in trash" do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
describe Card, "plus cards" do
|
46
|
-
it "
|
46
|
+
it "is deleted when root is" do
|
47
47
|
Card::Auth.as "joe_admin" do
|
48
48
|
c = Card.create! name: "zz+top"
|
49
49
|
root = Card["zz"]
|
@@ -59,7 +59,7 @@ end
|
|
59
59
|
describe Card do
|
60
60
|
context "with revisions" do
|
61
61
|
before { Card::Auth.as_bot { @c = Card["Wagn Bot"] } }
|
62
|
-
it "
|
62
|
+
it "does not be removable" do
|
63
63
|
expect(@c.delete).not_to be_truthy
|
64
64
|
end
|
65
65
|
end
|
@@ -70,7 +70,7 @@ describe Card do
|
|
70
70
|
@c = Card.create! name: "User Must Die", type: "User"
|
71
71
|
end
|
72
72
|
end
|
73
|
-
it "
|
73
|
+
it "is removable" do
|
74
74
|
expect(@c.delete!).to be_truthy
|
75
75
|
end
|
76
76
|
end
|
@@ -83,7 +83,7 @@ end
|
|
83
83
|
# # this ugly setup makes it so A+Admin is the actual user with edits..
|
84
84
|
# Card["Wagn Bot"].update_attributes! name: "A+Wagn Bot"
|
85
85
|
# end
|
86
|
-
# it "
|
86
|
+
# it "does not be removable" do
|
87
87
|
# @a = Card['A']
|
88
88
|
# @a.delete.should_not be_true
|
89
89
|
# end
|
@@ -96,11 +96,11 @@ describe Card, "dependent removal" do
|
|
96
96
|
@c = Card.find_by_key "A+B+C".to_name.key
|
97
97
|
end
|
98
98
|
|
99
|
-
it "
|
99
|
+
it "is trash" do
|
100
100
|
expect(@c.trash).to be_truthy
|
101
101
|
end
|
102
102
|
|
103
|
-
it "
|
103
|
+
it "does not be findable by name" do
|
104
104
|
expect(Card["A+B+C"]).to eq(nil)
|
105
105
|
end
|
106
106
|
end
|
@@ -117,11 +117,11 @@ describe Card, "rename to trashed name" do
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
-
it "
|
120
|
+
it "renames b to a" do
|
121
121
|
expect(@b.name).to eq("A")
|
122
122
|
end
|
123
123
|
|
124
|
-
it "
|
124
|
+
it "renames a to a*trash" do
|
125
125
|
expect((c = Card.find(@a.id)).cardname.to_s).to eq("A*trash")
|
126
126
|
expect(c.name).to eq("A*trash")
|
127
127
|
expect(c.key).to eq("a*trash")
|
@@ -136,15 +136,15 @@ describe Card, "sent to trash" do
|
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
-
it "
|
139
|
+
it "is trash" do
|
140
140
|
expect(@c.trash).to eq(true)
|
141
141
|
end
|
142
142
|
|
143
|
-
it "
|
143
|
+
it "does not be findable by name" do
|
144
144
|
expect(Card["basicname"]).to eq(nil)
|
145
145
|
end
|
146
146
|
|
147
|
-
it "
|
147
|
+
it "still has actions" do
|
148
148
|
expect(@c.actions.count).to eq(2)
|
149
149
|
expect(@c.last_change_on(:db_content).value).to eq("basiccontent")
|
150
150
|
end
|
@@ -159,19 +159,19 @@ describe Card, "revived from trash" do
|
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
162
|
-
it "
|
162
|
+
it "does not be trash" do
|
163
163
|
expect(@c.trash).to eq(false)
|
164
164
|
end
|
165
165
|
|
166
|
-
it "
|
166
|
+
it "has 3 actions" do
|
167
167
|
expect(@c.actions.count).to eq(3)
|
168
168
|
end
|
169
169
|
|
170
|
-
it "
|
170
|
+
it "still has old content" do
|
171
171
|
expect(@c.nth_action(1).value :db_content).to eq("basiccontent")
|
172
172
|
end
|
173
173
|
|
174
|
-
it "
|
174
|
+
it "has the same content" do
|
175
175
|
expect(@c.content).to eq("revived content")
|
176
176
|
# Card.fetch(@c.name).content.should == 'revived content'
|
177
177
|
end
|
@@ -184,7 +184,7 @@ describe Card, "recreate trashed card via new" do
|
|
184
184
|
# end
|
185
185
|
|
186
186
|
# this test is known to be broken; we've worked around it for now
|
187
|
-
# it "
|
187
|
+
# it "deletes and recreate with a different cardtype" do
|
188
188
|
# @c.delete!
|
189
189
|
# @re_c = Card.new type: "Phrase", name: "BasicMe", content: "Banana"
|
190
190
|
# @re_c.save!
|
@@ -200,19 +200,19 @@ describe Card, "junction revival" do
|
|
200
200
|
end
|
201
201
|
end
|
202
202
|
|
203
|
-
it "
|
203
|
+
it "does not be trash" do
|
204
204
|
expect(@c.trash).to eq(false)
|
205
205
|
end
|
206
206
|
|
207
|
-
it "
|
207
|
+
it "has 3 actions" do
|
208
208
|
expect(@c.actions.count).to eq(3)
|
209
209
|
end
|
210
210
|
|
211
|
-
it "
|
211
|
+
it "still has old action" do
|
212
212
|
expect(@c.nth_action(1).value :db_content).to eq("basiccontent")
|
213
213
|
end
|
214
214
|
|
215
|
-
it "
|
215
|
+
it "has old content" do
|
216
216
|
expect(@c.db_content).to eq("revived content")
|
217
217
|
end
|
218
218
|
end
|
@@ -61,7 +61,7 @@ describe Card, "with role" do
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
it "
|
64
|
+
it "has a role type" do
|
65
65
|
expect(@role.type_id).to eq(Card::RoleID)
|
66
66
|
end
|
67
67
|
end
|
@@ -73,27 +73,27 @@ describe Card, "with account" do
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
it "
|
76
|
+
it "does not have errors" do
|
77
77
|
expect(@joe.errors.empty?).to eq(true)
|
78
78
|
end
|
79
79
|
|
80
|
-
it "
|
80
|
+
it "allows type changes" do
|
81
81
|
expect(@joe.type_code).to eq(:basic)
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
describe Card, "type transition approve create" do
|
86
|
-
it "
|
86
|
+
it "has cardtype b create role r1" do
|
87
87
|
expect((c = Card.fetch("Cardtype B+*type+*create")).content).to eq("[[r1]]")
|
88
88
|
expect(c.type_code).to eq(:pointer)
|
89
89
|
end
|
90
90
|
|
91
|
-
it "
|
91
|
+
it "has errors" do
|
92
92
|
c = change_card_to_type "basicname", "cardtype_b"
|
93
93
|
expect(c.errors[:permission_denied]).not_to be_empty
|
94
94
|
end
|
95
95
|
|
96
|
-
it "
|
96
|
+
it "is the original type" do
|
97
97
|
-> { change_card_to_type "basicname", "cardtype_b" }
|
98
98
|
expect(Card["basicname"].type_code).to eq(:basic)
|
99
99
|
end
|
@@ -104,7 +104,7 @@ describe Card, "type transition delete callback" do
|
|
104
104
|
@c = change_card_to_type("type-e-card", :basic)
|
105
105
|
end
|
106
106
|
|
107
|
-
it "
|
107
|
+
it "changes type of the card" do
|
108
108
|
expect(Card["type-e-card"].type_code).to eq(:basic)
|
109
109
|
end
|
110
110
|
end
|
@@ -118,7 +118,7 @@ describe Card, "type transition create callback" do
|
|
118
118
|
@c = change_card_to_type("basicname", :cardtype_f)
|
119
119
|
end
|
120
120
|
|
121
|
-
it "
|
121
|
+
it "changes type of card" do
|
122
122
|
expect(Card["basicname"].type_code).to eq(:cardtype_f)
|
123
123
|
end
|
124
124
|
end
|