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
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
describe Card::Set::All::Content do
|
4
4
|
describe "save_content_draft" do
|
5
|
-
it "
|
5
|
+
it "stores a draft revision" do
|
6
6
|
@card = Card.create! name: "mango", content: "foo"
|
7
7
|
@card.save_content_draft("bar")
|
8
8
|
expect(@card.drafts.length).to eq 1
|
@@ -12,7 +12,7 @@ describe Card::Set::All::Export do
|
|
12
12
|
big_blind.format(:json).render_export
|
13
13
|
end
|
14
14
|
context "pointer card" do
|
15
|
-
it "
|
15
|
+
it "contains cards in the pointer card and its children" do
|
16
16
|
small_blind = Card.create! name: "Elbert Hubbard",
|
17
17
|
type_id: Card::BasicID,
|
18
18
|
content: "Do not take life too seriously."
|
@@ -76,7 +76,7 @@ describe Card::Set::All::Export do
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
context "Skin card" do
|
79
|
-
it "
|
79
|
+
it "contains cards in the pointer card and its children" do
|
80
80
|
Card::Auth.as_bot do
|
81
81
|
small_blind =
|
82
82
|
Card.create! name: "Elbert Hubbard",
|
@@ -99,7 +99,7 @@ describe Card::Set::All::Export do
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
context "search card" do
|
102
|
-
it "
|
102
|
+
it "contains cards from search card and its children" do
|
103
103
|
Card.create!(
|
104
104
|
name: "Elbert Hubbard",
|
105
105
|
type_id: Card::BasicID,
|
@@ -167,7 +167,7 @@ describe Card::Set::All::Fetch do
|
|
167
167
|
expect(card.raw_content).to eq("Formatted Content")
|
168
168
|
end
|
169
169
|
|
170
|
-
it "
|
170
|
+
it "recognizes pattern overrides" do
|
171
171
|
# ~~~ create right rule
|
172
172
|
Card.create!(name: "y+*right+*structure", content: "Right Content")
|
173
173
|
card = Card.fetch("a+y")
|
@@ -188,7 +188,7 @@ describe Card::Set::All::Fetch do
|
|
188
188
|
expect(card.raw_content).to eq("Right Content")
|
189
189
|
end
|
190
190
|
|
191
|
-
it "
|
191
|
+
it "does not hit the database for every fetch_virtual lookup" do
|
192
192
|
card_double = class_double("Card")
|
193
193
|
Card.create!(name: "y+*right+*structure", content: "Formatted Content")
|
194
194
|
Card.fetch("a+y")
|
@@ -196,7 +196,7 @@ describe Card::Set::All::Fetch do
|
|
196
196
|
Card.fetch("a+y")
|
197
197
|
end
|
198
198
|
|
199
|
-
it "
|
199
|
+
it "does not be a new_record after being saved" do
|
200
200
|
Card.create!(name: "growing up")
|
201
201
|
card = Card.fetch("growing up")
|
202
202
|
expect(card.new_record?).to be_falsey
|
@@ -252,14 +252,14 @@ describe Card::Set::All::Fetch do
|
|
252
252
|
content: '{"plus":"_self"}', type: "Search"
|
253
253
|
end
|
254
254
|
end
|
255
|
-
it "
|
255
|
+
it "finds cards with *right+*structure specified" do
|
256
256
|
c = Card.fetch("A+testsearch".to_name)
|
257
257
|
assert c.virtual?
|
258
258
|
expect(c.type_code).to eq(:search_type)
|
259
259
|
expect(c.raw_content).to eq('{"plus":"_self"}')
|
260
260
|
end
|
261
261
|
context "fetched virtual card with new args" do
|
262
|
-
it "
|
262
|
+
it "fetchs the virtual card with type set in patterns" do
|
263
263
|
Card.fetch "+testsearch", new: { name: "+testsearch",
|
264
264
|
supercard: Card["home"] }
|
265
265
|
|
@@ -59,19 +59,19 @@ describe Card::Set::All::Initialize do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
it "happens after new" do
|
62
|
-
expect(@c.respond_to?(:
|
62
|
+
expect(@c.respond_to?(:query)).to be_truthy
|
63
63
|
end
|
64
64
|
|
65
65
|
it "happens after save" do
|
66
|
-
expect(@c.respond_to?(:
|
66
|
+
expect(@c.respond_to?(:query)).to be_truthy
|
67
67
|
@c.save!
|
68
|
-
expect(@c.respond_to?(:
|
68
|
+
expect(@c.respond_to?(:query)).to be_truthy
|
69
69
|
end
|
70
70
|
|
71
71
|
it "happens after fetch" do
|
72
72
|
@c.save!
|
73
73
|
c = Card.fetch(@c.name)
|
74
|
-
expect(c.respond_to?(:
|
74
|
+
expect(c.respond_to?(:query)).to be_truthy
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -8,18 +8,18 @@ describe Card::Set::All::Name do
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
it "
|
11
|
+
it "handles cards without names" do
|
12
12
|
c = Card.create! type: "Book"
|
13
13
|
expect(c.name).to eq("b1")
|
14
14
|
end
|
15
15
|
|
16
|
-
it "
|
16
|
+
it "increments again if name already exists" do
|
17
17
|
_b1 = Card.create! type: "Book"
|
18
18
|
b2 = Card.create! type: "Book"
|
19
19
|
expect(b2.name).to eq("b2")
|
20
20
|
end
|
21
21
|
|
22
|
-
it "
|
22
|
+
it "handles trashed names" do
|
23
23
|
b1 = Card.create! type: "Book"
|
24
24
|
Card::Auth.as_bot { b1.delete }
|
25
25
|
b1 = Card.create! type: "Book"
|
@@ -32,12 +32,12 @@ describe Card::Set::All::Name do
|
|
32
32
|
@card = Card["a"]
|
33
33
|
end
|
34
34
|
|
35
|
-
it "
|
35
|
+
it "requires admin permission" do
|
36
36
|
@card.update_attributes codename: "structure"
|
37
37
|
expect(@card.errors[:codename].first).to match(/only admins/)
|
38
38
|
end
|
39
39
|
|
40
|
-
it "
|
40
|
+
it "checks uniqueness" do
|
41
41
|
Card::Auth.as_bot do
|
42
42
|
@card.update_attributes codename: "structure"
|
43
43
|
expect(@card.errors[:codename].first).to match(/already in use/)
|
@@ -46,7 +46,7 @@ describe Card::Set::All::Name do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
describe "repair_key" do
|
49
|
-
it "
|
49
|
+
it "fixes broken keys" do
|
50
50
|
a = Card["a"]
|
51
51
|
a.update_column "key", "broken_a"
|
52
52
|
a.expire
|
@@ -176,7 +176,7 @@ describe Card::Set::All::Permissions do
|
|
176
176
|
expect(c.read_rule_id).to eq(@perm_card.id)
|
177
177
|
end
|
178
178
|
|
179
|
-
it "
|
179
|
+
it "gets updated when relative settings change" do
|
180
180
|
Card::Auth.as_bot do
|
181
181
|
all_plus = Card.fetch "*all plus+*read", new: { content: "_left" }
|
182
182
|
all_plus.save
|
@@ -202,7 +202,7 @@ describe Card::Set::All::Permissions do
|
|
202
202
|
)
|
203
203
|
end
|
204
204
|
|
205
|
-
it "
|
205
|
+
it "insures that class overrides work with relative settings" do
|
206
206
|
Card::Auth.as_bot do
|
207
207
|
all_plus = Card.fetch "*all plus+*read", new: { content: "_left" }
|
208
208
|
all_plus.save
|
@@ -215,7 +215,7 @@ describe Card::Set::All::Permissions do
|
|
215
215
|
end
|
216
216
|
end
|
217
217
|
|
218
|
-
it "
|
218
|
+
it "works on virtual+virtual cards" do
|
219
219
|
c = Card.fetch("Number+*type+by name")
|
220
220
|
expect(c.ok?(:read)).to be_truthy
|
221
221
|
end
|
@@ -251,7 +251,7 @@ describe Card::Set::All::Permissions do
|
|
251
251
|
end
|
252
252
|
end
|
253
253
|
|
254
|
-
it "
|
254
|
+
it "is granted to admin if to anybody" do
|
255
255
|
Card::Auth.as_bot do
|
256
256
|
c1 = Card["c1"]
|
257
257
|
Card.create! name: "c1+*self+*comment", type: "Pointer",
|
@@ -454,7 +454,7 @@ describe Card::Set::All::Permissions do
|
|
454
454
|
end
|
455
455
|
end
|
456
456
|
|
457
|
-
it "
|
457
|
+
it "lets joe view new cards" do
|
458
458
|
expect(Card.new.ok?(:read)).to be_truthy
|
459
459
|
end
|
460
460
|
|
@@ -463,24 +463,24 @@ describe Card::Set::All::Permissions do
|
|
463
463
|
@c = Card.create! name: "sky blue"
|
464
464
|
end
|
465
465
|
|
466
|
-
it "
|
466
|
+
it "lets anonymous users view basic cards" do
|
467
467
|
Card::Auth.as :anonymous do
|
468
468
|
expect(@c.ok?(:read)).to be_truthy
|
469
469
|
end
|
470
470
|
end
|
471
471
|
|
472
|
-
it "
|
472
|
+
it "lets joe user basic cards" do
|
473
473
|
Card::Auth.as "joe_user" do
|
474
474
|
expect(@c.ok?(:read)).to be_truthy
|
475
475
|
end
|
476
476
|
end
|
477
477
|
end
|
478
478
|
|
479
|
-
it "
|
479
|
+
it "allows anyone signed in to create Basic Cards" do
|
480
480
|
expect(Card.new.ok?(:create)).to be_truthy
|
481
481
|
end
|
482
482
|
|
483
|
-
it "
|
483
|
+
it "does not allow someone not signed in to create Basic Cards" do
|
484
484
|
Card::Auth.as :anonymous do
|
485
485
|
expect(Card.new.ok?(:create)).not_to be_truthy
|
486
486
|
end
|
@@ -496,7 +496,7 @@ describe Card::Set::All::Permissions do
|
|
496
496
|
end
|
497
497
|
end
|
498
498
|
|
499
|
-
it "
|
499
|
+
it "handles delete as a setting" do
|
500
500
|
c = Card.new name: "whatever"
|
501
501
|
expect(c.who_can(:delete)).to eq([Card["joe_user"].id])
|
502
502
|
Card::Auth.as("joe_user") do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
3
|
describe Card::Set::All::References do
|
4
|
-
it "
|
4
|
+
it "replaces references should work on nests inside links" do
|
5
5
|
card = Card.create! name: "ref test", content: "[[test_card|test{{test}}]]"
|
6
6
|
assert_equal "[[test_card|test{{best}}]]",
|
7
7
|
card.replace_reference_syntax("test", "best")
|
@@ -18,20 +18,20 @@ describe Card do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
describe ".rule" do
|
21
|
-
it "
|
21
|
+
it "has a value of 2" do
|
22
22
|
expect(@rule_card.content).to eq("2")
|
23
23
|
expect(@c1.rule(:table_of_contents)).to eq("2")
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
describe "renders with/without toc" do
|
28
|
-
it "
|
28
|
+
it "does not render for 'Onne Heading'" do
|
29
29
|
expect(@c1.format.render_open_content).not_to match(/Table of Contents/)
|
30
30
|
end
|
31
|
-
it "
|
31
|
+
it "renders for 'Twwo Heading'" do
|
32
32
|
expect(@c2.format.render_open_content).to match(/Table of Contents/)
|
33
33
|
end
|
34
|
-
it "
|
34
|
+
it "renders for 'Three Heading'" do
|
35
35
|
expect(@c3.format.render_open_content).to match(/Table of Contents/)
|
36
36
|
end
|
37
37
|
end
|
@@ -51,14 +51,14 @@ describe Card do
|
|
51
51
|
sets = Card["Cardtype A"].related_sets.map { |s| s[0] }
|
52
52
|
expect(sets).to eq(["Cardtype A+*type", "Cardtype A+*right"])
|
53
53
|
end
|
54
|
-
# it "
|
54
|
+
# it "shows type plus right sets when they exist" do
|
55
55
|
# Card::Auth.as_bot do
|
56
56
|
# Card.create name: 'Basic+A+*type plus right', content: ''
|
57
57
|
# end
|
58
58
|
# sets = Card['A'].related_sets
|
59
59
|
# sets.should == ['A+*self', 'A+*right', 'Basic+A+*type plus right']
|
60
60
|
# end
|
61
|
-
# it "
|
61
|
+
# it "shows type plus right sets when they exist, and type" do
|
62
62
|
# Card::Auth.as_bot do
|
63
63
|
# Card.create name: 'Basic+Cardtype A+*type plus right', content: ''
|
64
64
|
# end
|
@@ -73,7 +73,7 @@ describe Card do
|
|
73
73
|
end
|
74
74
|
# # class methods
|
75
75
|
# describe ".default_rule" do
|
76
|
-
# it '
|
76
|
+
# it 'has default rule' do
|
77
77
|
# Card.default_rule(:table_of_contents).should == '0'
|
78
78
|
# end
|
79
79
|
# end
|
@@ -89,20 +89,20 @@ describe Card do
|
|
89
89
|
end
|
90
90
|
|
91
91
|
describe ".rule" do
|
92
|
-
it "
|
92
|
+
it "has a value of 1" do
|
93
93
|
expect(@rule_card.content).to eq("1")
|
94
94
|
expect(@c1.rule(:table_of_contents)).to eq("1")
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
98
|
describe "renders with/without toc" do
|
99
|
-
it "
|
99
|
+
it "does not render toc for 'Onne Heading'" do
|
100
100
|
expect(@c1.format.render_open_content).to match(/Table of Contents/)
|
101
101
|
end
|
102
|
-
it "
|
102
|
+
it "renders toc for 'Twwo Heading'" do
|
103
103
|
expect(@c2.format.render_open_content).to match(/Table of Contents/)
|
104
104
|
end
|
105
|
-
it "
|
105
|
+
it "does not render for 'Twwo Heading' when changed to 3" do
|
106
106
|
@rule_card.content = "3"
|
107
107
|
expect(@c2.rule(:table_of_contents)).to eq("3")
|
108
108
|
expect(@c2.format.render_open_content).not_to match(/Table of Contents/)
|
@@ -130,20 +130,20 @@ describe Card do
|
|
130
130
|
end
|
131
131
|
|
132
132
|
describe ".rule" do
|
133
|
-
it "
|
133
|
+
it "has a value of 0" do
|
134
134
|
expect(@c1.rule(:table_of_contents)).to eq("0")
|
135
135
|
expect(@rule_card.content).to eq("0")
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
139
|
describe "renders without toc" do
|
140
|
-
it "
|
140
|
+
it "does not render for 'Onne Heading'" do
|
141
141
|
expect(@c1.format.render_open_content).not_to match(/Table of Contents/)
|
142
142
|
end
|
143
|
-
it "
|
143
|
+
it "renders for 'Twwo Heading'" do
|
144
144
|
expect(@c2.format.render_open_content).not_to match(/Table of Contents/)
|
145
145
|
end
|
146
|
-
it "
|
146
|
+
it "renders for 'Three Heading'" do
|
147
147
|
expect(@c3.format.render_open_content).not_to match(/Table of Contents/)
|
148
148
|
end
|
149
149
|
end
|
@@ -161,7 +161,7 @@ describe Card do
|
|
161
161
|
|
162
162
|
# # class methods
|
163
163
|
# describe ".default_rule" do
|
164
|
-
# it '
|
164
|
+
# it 'has default rule' do
|
165
165
|
# Card.default_rule(:table_of_contents).should == '0'
|
166
166
|
# end
|
167
167
|
# end
|
@@ -190,7 +190,7 @@ describe Card do
|
|
190
190
|
end
|
191
191
|
end
|
192
192
|
end
|
193
|
-
it "
|
193
|
+
it "takes on new setting value" do
|
194
194
|
c = Card["toc1"]
|
195
195
|
expect(c.rule_card(:table_of_contents).name)
|
196
196
|
.to eq("CardtypeE+*type+*table of content")
|
@@ -198,14 +198,14 @@ describe Card do
|
|
198
198
|
end
|
199
199
|
|
200
200
|
describe "renders with/without toc" do
|
201
|
-
it "
|
201
|
+
it "does not render for 'Onne Heading'" do
|
202
202
|
expect(@c1.format.render_open_content).not_to match(/Table of Contents/)
|
203
203
|
end
|
204
|
-
it "
|
204
|
+
it "renders for 'Twwo Heading'" do
|
205
205
|
expect(@c2.rule(:table_of_contents)).to eq("2")
|
206
206
|
expect(@c2.format.render_open_content).to match(/Table of Contents/)
|
207
207
|
end
|
208
|
-
it "
|
208
|
+
it "renders for 'Three Heading'" do
|
209
209
|
expect(@c3.format.render_open_content).to match(/Table of Contents/)
|
210
210
|
end
|
211
211
|
end
|
@@ -225,20 +225,20 @@ describe Card do
|
|
225
225
|
end
|
226
226
|
|
227
227
|
describe ".rule" do
|
228
|
-
it "
|
228
|
+
it "has a value of 1" do
|
229
229
|
expect(@rule_card.content).to eq("1")
|
230
230
|
expect(@c1.rule(:table_of_contents)).to eq("1")
|
231
231
|
end
|
232
232
|
end
|
233
233
|
|
234
234
|
describe "renders with/without toc" do
|
235
|
-
it "
|
235
|
+
it "does not render toc for 'Onne Heading'" do
|
236
236
|
expect(@c1.format.render_open_content).to match(/Table of Contents/)
|
237
237
|
end
|
238
|
-
it "
|
238
|
+
it "renders toc for 'Twwo Heading'" do
|
239
239
|
expect(@c2.format.render_open_content).to match(/Table of Contents/)
|
240
240
|
end
|
241
|
-
it "
|
241
|
+
it "does not render for 'Twwo Heading' when changed to 3" do
|
242
242
|
@rule_card.content = "3"
|
243
243
|
expect(@c2.format.render_open_content).not_to match(/Table of Contents/)
|
244
244
|
end
|
@@ -6,7 +6,7 @@ describe Card::Set::All::Rules do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
describe "setting data setup" do
|
9
|
-
it "
|
9
|
+
it "makes Set of +*type" do
|
10
10
|
Card.create! name: "SpeciForm", type: "Cardtype"
|
11
11
|
expect(Card.create!(name: "SpeciForm+*type").type_code).to eq(:set)
|
12
12
|
end
|
@@ -26,11 +26,11 @@ describe Card::Set::All::Templating do
|
|
26
26
|
@jb = Card.create! name: "Jim+birthday"
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
29
|
+
it "has default content" do
|
30
30
|
expect(@jb.format._render_raw).to eq("Today!")
|
31
31
|
end
|
32
32
|
|
33
|
-
it "
|
33
|
+
it "changes type and content with template" do
|
34
34
|
Card::Auth.as_bot do
|
35
35
|
@bt.content = "Tomorrow"
|
36
36
|
@bt.type = "Phrase"
|
@@ -41,7 +41,7 @@ describe Card::Set::All::Templating do
|
|
41
41
|
expect(jb.type_id).to eq(Card::PhraseID)
|
42
42
|
end
|
43
43
|
|
44
|
-
it "
|
44
|
+
it "has type and content overridden by (new) type_plus_right set" do
|
45
45
|
Card::Auth.as_bot do
|
46
46
|
Card.create! name: "Basic+birthday+*type plus right+*structure",
|
47
47
|
type: "PlainText",
|
@@ -64,15 +64,15 @@ describe Card::Set::All::Templating do
|
|
64
64
|
@jb = Card.create! name: "Jim+birthday"
|
65
65
|
end
|
66
66
|
|
67
|
-
it "
|
67
|
+
it "has default cardtype" do
|
68
68
|
expect(@jb.type_code).to eq(:date)
|
69
69
|
end
|
70
70
|
|
71
|
-
it "
|
71
|
+
it "has default content" do
|
72
72
|
expect(Card["Jim+birthday"].content).to eq("Today!")
|
73
73
|
end
|
74
74
|
|
75
|
-
it "
|
75
|
+
it "applies to new cards" do
|
76
76
|
pb = Card.new name: "Pete+birthday"
|
77
77
|
expect(pb.raw_content).to eq("Today!")
|
78
78
|
expect(pb.content).to eq("Today!")
|
@@ -88,7 +88,7 @@ describe Card::Set::All::Templating do
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
it "
|
91
|
+
it "returns templated content even if content is passed in" do
|
92
92
|
new_date_card = Card.new type: "Date", content: ""
|
93
93
|
expect(new_date_card.format._render(:raw)).to eq("Tomorrow")
|
94
94
|
end
|
@@ -107,7 +107,7 @@ describe Card::Set::All::Templating do
|
|
107
107
|
expect(Card["Jim+birthday"].raw_content).to eq("Today")
|
108
108
|
end
|
109
109
|
|
110
|
-
it "
|
110
|
+
it "defers to normal content " \
|
111
111
|
"when *structure rule's content is (exactly) '_self'" do
|
112
112
|
Card::Auth.as_bot do
|
113
113
|
Card.create! name: "Jim+birthday+*self+*structure", content: "_self"
|