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.
Files changed (298) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/card.gemspec +8 -7
  4. data/config/initializers/01_core_extensions/array.rb +4 -0
  5. data/config/initializers/01_core_extensions/persistent_identifiers.rb +12 -0
  6. data/config/initializers/02_patches/better_errors.rb +56 -0
  7. data/config/initializers/core_extensions.rb +13 -18
  8. data/config/initializers/patches.rb +8 -0
  9. data/config/locales/de.yml +0 -2
  10. data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +22 -12
  11. data/db/migrate_core_cards/20161102202156_tweak_recaptcha_setting_cards.rb +17 -0
  12. data/db/migrate_core_cards/20161103154836_update_keys.rb +46 -0
  13. data/lib/card.rb +1 -8
  14. data/lib/card/act_manager.rb +4 -0
  15. data/lib/card/auth/permissions.rb +5 -3
  16. data/lib/card/cache.rb +1 -20
  17. data/lib/card/cache/persistent.rb +6 -0
  18. data/lib/card/content/chunk.rb +4 -3
  19. data/lib/card/content/diff.rb +2 -2
  20. data/lib/card/content/diff/result.rb +11 -0
  21. data/lib/card/env/success.rb +4 -0
  22. data/lib/card/error.rb +2 -0
  23. data/lib/card/format.rb +14 -17
  24. data/lib/card/format/content.rb +16 -8
  25. data/lib/card/format/error.rb +3 -5
  26. data/lib/card/format/names.rb +22 -16
  27. data/lib/card/format/nest.rb +67 -61
  28. data/lib/card/format/nest/fetch.rb +40 -33
  29. data/lib/card/format/nest/main.rb +39 -19
  30. data/lib/card/format/nest/subformat.rb +3 -16
  31. data/lib/card/format/nest/view.rb +23 -32
  32. data/lib/card/format/permission.rb +49 -34
  33. data/lib/card/format/registration.rb +12 -6
  34. data/lib/card/format/render.rb +62 -73
  35. data/lib/card/migration.rb +14 -10
  36. data/lib/card/migration/import.rb +20 -19
  37. data/lib/card/migration/import/import_data.rb +50 -59
  38. data/lib/card/migration/import/import_data/card_attributes.rb +56 -0
  39. data/lib/card/migration/import/import_data/card_content.rb +33 -0
  40. data/lib/card/migration/import/merger.rb +47 -0
  41. data/lib/card/mod/loader.rb +4 -4
  42. data/lib/card/model/save_helper.rb +49 -10
  43. data/lib/card/name.rb +16 -52
  44. data/lib/card/name/fields_and_traits.rb +67 -0
  45. data/lib/card/name/variants.rb +17 -0
  46. data/lib/card/query.rb +6 -2
  47. data/lib/card/query/attributes.rb +1 -1
  48. data/lib/card/query/interpretation.rb +3 -3
  49. data/lib/card/set/event.rb +2 -1
  50. data/lib/card/set/format.rb +18 -7
  51. data/lib/card/set_pattern.rb +17 -13
  52. data/lib/card/tasks/card.rake +1 -1
  53. data/lib/card/view.rb +55 -0
  54. data/lib/card/view/cache.rb +90 -0
  55. data/lib/card/view/fetch.rb +109 -0
  56. data/lib/card/view/options.rb +164 -0
  57. data/lib/card/view/stub.rb +30 -0
  58. data/lib/card/view/visibility.rb +95 -0
  59. data/lib/cardio.rb +3 -2
  60. data/lib/cardio/schema.rb +21 -8
  61. data/lib/generators/card.rb +16 -2
  62. data/lib/generators/card/format/format_generator.rb +10 -9
  63. data/lib/generators/card/migration/migration_generator.rb +10 -5
  64. data/lib/generators/card/set/USAGE +1 -1
  65. data/lib/generators/card/set/set_generator.rb +11 -9
  66. data/mod/account/set/right/account.rb +38 -40
  67. data/mod/account/set/right/token.rb +2 -1
  68. data/mod/account/set/self/account_links.rb +34 -54
  69. data/mod/account/set/self/signin.rb +107 -93
  70. data/mod/account/set/type/signup.rb +33 -32
  71. data/mod/account/set/type/user.rb +28 -21
  72. data/mod/account/spec/set/all/account_spec.rb +9 -9
  73. data/mod/account/spec/set/right/account_spec.rb +23 -14
  74. data/mod/account/spec/set/right/email_spec.rb +6 -6
  75. data/mod/account/spec/set/right/password_spec.rb +4 -4
  76. data/mod/account/spec/set/right/token_spec.rb +3 -3
  77. data/mod/account/spec/set/self/account_links_spec.rb +3 -3
  78. data/mod/account/spec/set/self/signin_spec.rb +2 -2
  79. data/mod/account/spec/set/type/signup_spec.rb +7 -8
  80. data/mod/ace_editor/set/abstract/ace_editor.rb +1 -4
  81. data/mod/admin/set/self/admin.rb +2 -2
  82. data/mod/admin/set/self/admin_info.rb +1 -1
  83. data/mod/admin/set/self/recaptcha_private_key.rb +3 -0
  84. data/mod/admin/set/self/recaptcha_proxy.rb +3 -0
  85. data/mod/admin/set/self/recaptcha_public_key.rb +3 -0
  86. data/mod/admin/set/self/trash.rb +4 -4
  87. data/mod/admin/spec/set/self/admin_spec.rb +4 -4
  88. data/mod/admin/spec/set/self/version_spec.rb +1 -1
  89. data/mod/basic_formats/set/all/all_css.rb +3 -3
  90. data/mod/basic_formats/set/all/all_csv.rb +6 -6
  91. data/mod/basic_formats/set/all/all_js.rb +4 -0
  92. data/mod/basic_formats/set/all/base.rb +40 -62
  93. data/mod/basic_formats/set/all/json.rb +34 -39
  94. data/mod/basic_formats/set/all/rss.rb +6 -6
  95. data/mod/basic_formats/set/all/text.rb +3 -2
  96. data/mod/basic_formats/set/self/01_head/javascript.rb +2 -2
  97. data/mod/basic_formats/set/self/head.rb +6 -10
  98. data/mod/basic_formats/spec/set/all/all_css_spec.rb +1 -1
  99. data/mod/basic_formats/spec/set/all/all_csv_spec.rb +1 -1
  100. data/mod/basic_formats/spec/set/all/base_spec.rb +8 -5
  101. data/mod/basic_formats/spec/set/all/json_spec.rb +2 -2
  102. data/mod/basic_formats/spec/set/all/rss_spec.rb +4 -4
  103. data/mod/basic_types/set/type/plain_text.rb +3 -5
  104. data/mod/basic_types/spec/set/type/plain_text_spec.rb +2 -2
  105. data/mod/bootstrap/lib/bootstrap.rb +16 -0
  106. data/mod/bootstrap/lib/bootstrap/basic_tags.rb +26 -0
  107. data/mod/bootstrap/lib/bootstrap/component.rb +133 -0
  108. data/mod/bootstrap/lib/bootstrap/component/form.rb +31 -0
  109. data/mod/bootstrap/lib/bootstrap/component/horizontal_form.rb +38 -0
  110. data/mod/bootstrap/lib/bootstrap/component/layout.rb +83 -0
  111. data/mod/bootstrap/lib/bootstrap/component/panel.rb +9 -0
  112. data/mod/bootstrap/lib/bootstrap/component_loader.rb +30 -0
  113. data/mod/bootstrap/lib/bootstrap/delegate.rb +16 -0
  114. data/mod/bootstrap/lib/bootstrapper.rb +16 -0
  115. data/mod/bootstrap/lib/stylesheets/bootstrap/_tables.scss +55 -52
  116. data/mod/bootstrap/lib/stylesheets/bootstrap/mixins/_table-row.scss +12 -12
  117. data/mod/bootstrap/lib/stylesheets/bootstrap_cards.scss +12 -0
  118. data/mod/bootstrap/set/all/bootstrap/accordion.rb +63 -0
  119. data/mod/bootstrap/set/all/bootstrap/helper.rb +7 -140
  120. data/mod/bootstrap/set/all/bootstrap/navbar.rb +74 -0
  121. data/mod/bootstrap/set/all/bootstrap/table.rb +76 -46
  122. data/mod/bootstrap/set/all/bootstrap/tabs.rb +58 -23
  123. data/mod/bootstrap/set/all/bootstrap/wrapper.rb +14 -8
  124. data/mod/bootstrap/set/all/rich_bootstrap.rb +5 -3
  125. data/mod/bootstrap/spec/set/all/bootstrap/bootstrap_builder_spec.rb +31 -0
  126. data/mod/bootstrap/spec/set/all/bootstrap/bootstrap_spec.rb +20 -0
  127. data/mod/bootstrap/spec/set/all/bootstrap/form_spec.rb +59 -1
  128. data/mod/bootstrap/spec/set/all/bootstrap/layout_spec.rb +104 -15
  129. data/mod/carrierwave/set/abstract/attachment.rb +4 -3
  130. data/mod/carrierwave/set/abstract/attachment/paths.rb +1 -1
  131. data/mod/carrierwave/set/abstract/attachment/storage_type.rb +5 -11
  132. data/mod/carrierwave/set/type/file.rb +39 -32
  133. data/mod/carrierwave/set/type/image.rb +59 -34
  134. data/mod/carrierwave/spec/set/type/image_spec.rb +3 -3
  135. data/mod/core/chunk/link.rb +5 -0
  136. data/mod/core/chunk/{include.rb → nest.rb} +8 -29
  137. data/mod/core/chunk/reference.rb +5 -6
  138. data/mod/core/chunk/view_stub.rb +42 -0
  139. data/mod/core/format/html_format.rb +23 -26
  140. data/mod/core/set/abstract/code_file.rb +1 -1
  141. data/mod/core/set/all/actify.rb +1 -1
  142. data/mod/core/set/all/active_card.rb +0 -1
  143. data/mod/core/set/all/{tracked_attributes.rb → assign_attributes.rb} +55 -24
  144. data/mod/core/set/all/collection.rb +136 -122
  145. data/mod/core/set/all/content.rb +8 -0
  146. data/mod/core/set/all/event.rb +5 -2
  147. data/mod/core/set/all/export.rb +7 -7
  148. data/mod/core/set/all/fetch.rb +90 -26
  149. data/mod/core/set/all/initialize.rb +17 -6
  150. data/mod/core/set/all/name.rb +2 -3
  151. data/mod/core/set/all/permissions.rb +19 -11
  152. data/mod/core/set/all/states.rb +12 -2
  153. data/mod/core/set/all/trash.rb +1 -1
  154. data/mod/core/set/all/type.rb +2 -0
  155. data/mod/core/set/all/utils.rb +4 -3
  156. data/mod/core/spec/chunk/literal_spec.rb +2 -2
  157. data/mod/core/spec/chunk/uri_spec.rb +17 -17
  158. data/mod/core/spec/format/html_format_spec.rb +11 -13
  159. data/mod/core/spec/set/all/attribute_tracking_spec.rb +2 -2
  160. data/mod/core/spec/set/all/collection_spec.rb +21 -24
  161. data/mod/core/spec/set/all/content_spec.rb +1 -1
  162. data/mod/core/spec/set/all/export_spec.rb +3 -3
  163. data/mod/core/spec/set/all/fetch_spec.rb +5 -5
  164. data/mod/core/spec/set/all/initialize_spec.rb +4 -4
  165. data/mod/core/spec/set/all/name_spec.rb +6 -6
  166. data/mod/core/spec/set/all/permissions_spec.rb +10 -10
  167. data/mod/core/spec/set/all/references_spec.rb +1 -1
  168. data/mod/core/spec/set/all/rules2_spec.rb +24 -24
  169. data/mod/core/spec/set/all/rules_spec.rb +1 -1
  170. data/mod/core/spec/set/all/templating_spec.rb +8 -8
  171. data/mod/core/spec/set/all/tracked_attributes_spec.rb +6 -6
  172. data/mod/core/spec/set/all/type_spec.rb +5 -5
  173. data/mod/developer/spec/set/all/event_viz_spec.rb +1 -1
  174. data/mod/developer/spec/set/right/debug_spec.rb +1 -1
  175. data/mod/email/set/all/email_html.rb +2 -2
  176. data/mod/email/set/all/notify.rb +8 -3
  177. data/mod/email/set/right/bcc.rb +3 -3
  178. data/mod/email/set/right/follow.rb +5 -5
  179. data/mod/email/set/right/following.rb +1 -1
  180. data/mod/email/set/self/follow_defaults.rb +27 -16
  181. data/mod/email/set/type/email_template.rb +1 -1
  182. data/mod/email/set/type_plus_right/user/follow.rb +10 -9
  183. data/mod/history/lib/card/act.rb +4 -0
  184. data/mod/history/lib/card/act/act_renderer.rb +194 -0
  185. data/mod/history/lib/card/act/act_renderer/absolute_act_renderer.rb +25 -0
  186. data/mod/history/lib/card/act/act_renderer/relative_act_renderer.rb +41 -0
  187. data/mod/history/lib/card/action.rb +1 -0
  188. data/mod/history/lib/card/action/action_renderer.rb +92 -0
  189. data/mod/history/lib/card/action/differ.rb +6 -1
  190. data/mod/history/set/all/act_view.rb +64 -0
  191. data/mod/history/set/all/action_view.rb +65 -0
  192. data/mod/history/set/all/content_history.rb +44 -37
  193. data/mod/history/set/all/history.rb +49 -263
  194. data/mod/machines/lib/stylesheets/style_cards.scss +30 -115
  195. data/mod/machines/set/abstract/script.rb +42 -7
  196. data/mod/machines/set/right/machine_input.rb +4 -0
  197. data/mod/machines/set/type/coffee_script.rb +8 -22
  198. data/mod/machines/set/type/css.rb +2 -2
  199. data/mod/machines/set/type/java_script.rb +4 -24
  200. data/mod/machines/set/type/scss.rb +1 -1
  201. data/mod/machines/spec/set/type/css_spec.rb +1 -1
  202. data/mod/machines/spec/set/type/scss_spec.rb +3 -3
  203. data/mod/machines/spec/set/type/skin_spec.rb +7 -7
  204. data/mod/pointer/set/abstract/01_pointer.rb +44 -46
  205. data/mod/pointer/set/abstract/01_pointer/edit.rb +13 -13
  206. data/mod/pointer/set/right/options.rb +4 -0
  207. data/mod/pointer/spec/set/type/pointer_spec.rb +7 -7
  208. data/mod/prosemirror_editor/set/abstract/prosemirror_editor.rb +3 -3
  209. data/mod/settings/set/abstract/permission.rb +25 -18
  210. data/mod/settings/set/right/add_help.rb +3 -3
  211. data/mod/settings/set/right/structure.rb +10 -16
  212. data/mod/settings/spec/set/right/comment_spec.rb +3 -3
  213. data/mod/settings/spec/set/right/create_spec.rb +1 -1
  214. data/mod/settings/spec/set/right/style_spec.rb +1 -1
  215. data/mod/settings/spec/set/type/setting_spec.rb +1 -1
  216. data/mod/solid_cache/set/abstract/solid_cache.rb +4 -4
  217. data/mod/solid_cache/set/right/solid_cache.rb +9 -10
  218. data/mod/standard/set/abstract/01_search_params.rb +41 -0
  219. data/mod/standard/set/abstract/search.rb +132 -0
  220. data/mod/standard/set/abstract/search/paging.rb +81 -0
  221. data/mod/standard/set/abstract/search/paging/paging_links.rb +90 -0
  222. data/mod/standard/set/abstract/wql_search.rb +67 -0
  223. data/mod/standard/set/all/error.rb +89 -82
  224. data/mod/standard/set/all/links.rb +1 -1
  225. data/mod/standard/set/all/rich_html/content.rb +125 -141
  226. data/mod/standard/set/all/rich_html/editing.rb +115 -178
  227. data/mod/standard/set/all/rich_html/form.rb +111 -131
  228. data/mod/standard/set/all/rich_html/header.rb +57 -39
  229. data/mod/standard/set/all/rich_html/menu.rb +94 -94
  230. data/mod/standard/set/all/rich_html/modal.rb +5 -10
  231. data/mod/standard/set/all/rich_html/new.rb +103 -0
  232. data/mod/standard/set/all/rich_html/toolbar.rb +54 -74
  233. data/mod/standard/set/all/rich_html/wrapper.rb +111 -138
  234. data/mod/standard/set/rstar/rules.rb +27 -38
  235. data/mod/standard/set/rstar/rules_editor.rb +298 -277
  236. data/mod/standard/set/self/navbox.rb +20 -15
  237. data/mod/standard/set/self/recent.rb +25 -17
  238. data/mod/standard/set/self/search.rb +25 -4
  239. data/mod/standard/set/type/cardtype.rb +11 -9
  240. data/mod/standard/set/type/date.rb +1 -1
  241. data/mod/standard/set/type/number.rb +1 -1
  242. data/mod/standard/set/type/phrase.rb +1 -1
  243. data/mod/standard/set/type/search_type.rb +17 -282
  244. data/mod/standard/set/type/session.rb +1 -1
  245. data/mod/standard/set/type/set.rb +155 -131
  246. data/mod/standard/set/type/toggle.rb +1 -1
  247. data/mod/standard/set/type/uri.rb +4 -4
  248. data/mod/standard/spec/chunk/include_spec.rb +13 -31
  249. data/mod/standard/spec/chunk/link_spec.rb +1 -1
  250. data/mod/standard/spec/set/all/error_spec.rb +1 -1
  251. data/mod/standard/spec/set/all/history_spec.rb +2 -2
  252. data/mod/standard/spec/set/all/rich_html/form_spec.rb +4 -4
  253. data/mod/standard/spec/set/all/rich_html/toolbar_spec.rb +22 -0
  254. data/mod/standard/spec/set/all/rich_html/wrapper_spec.rb +3 -2
  255. data/mod/standard/spec/set/right/when_created_spec.rb +1 -1
  256. data/mod/standard/spec/set/right/when_last_edited_spec.rb +1 -1
  257. data/mod/standard/spec/set/rstar/rules_spec.rb +2 -3
  258. data/mod/standard/spec/set/self/head_spec.rb +2 -2
  259. data/mod/standard/spec/set/self/navbox_spec.rb +1 -1
  260. data/mod/standard/spec/set/self/now_spec.rb +1 -1
  261. data/mod/standard/spec/set/type/date_spec.rb +1 -1
  262. data/mod/standard/spec/set/type/email_template_spec.rb +1 -1
  263. data/mod/standard/spec/set/type/layout_type_spec.rb +1 -1
  264. data/mod/standard/spec/set/type/number_spec.rb +1 -1
  265. data/mod/standard/spec/set/type/phrase_spec.rb +1 -1
  266. data/mod/standard/spec/set/type/search_type_spec.rb +2 -2
  267. data/mod/standard/spec/set/type/set_spec.rb +2 -2
  268. data/mod/standard/spec/set/type/toggle_spec.rb +2 -2
  269. data/mod/standard/spec/set/type/uri_spec.rb +3 -1
  270. data/mod/tinymce_editor/set/abstract/tinymce_editor.rb +1 -1
  271. data/spec/config/initializers/core_extensions_spec.rb +40 -10
  272. data/spec/lib/card/auth_spec.rb +8 -8
  273. data/spec/lib/card/cache_spec.rb +3 -3
  274. data/spec/lib/card/chunk_spec.rb +4 -4
  275. data/spec/lib/card/codename_spec.rb +2 -2
  276. data/spec/lib/card/content_spec.rb +23 -23
  277. data/spec/lib/card/diff_spec.rb +1 -1
  278. data/spec/lib/card/format_spec.rb +19 -24
  279. data/spec/lib/card/loader_spec.rb +4 -4
  280. data/spec/lib/card/name_spec.rb +16 -16
  281. data/spec/lib/card/query_spec.rb +80 -80
  282. data/spec/lib/card/reference_spec.rb +5 -5
  283. data/spec/lib/card/set_spec.rb +6 -6
  284. data/spec/lib/card/subcards_spec.rb +14 -0
  285. data/spec/lib/card/view_cache_spec.rb +5 -5
  286. data/spec/models/card/cardtype_spec.rb +15 -15
  287. data/spec/models/card/create_spec.rb +2 -2
  288. data/spec/models/card/trash_spec.rb +24 -24
  289. data/spec/models/card/type_transition_spec.rb +8 -8
  290. data/spec/models/card/validation_spec.rb +5 -5
  291. data/spec/models/card_spec.rb +14 -14
  292. data/spec/spec_helper.rb +6 -2
  293. data/spec/support/card_spec_helper.rb +21 -11
  294. data/spec/support/helper/card_helper.rb +11 -4
  295. metadata +73 -15
  296. data/lib/card/cache/view_cache.rb +0 -103
  297. data/mod/bootstrap/set/all/bootstrap/layout.rb +0 -58
  298. data/mod/core/set/all/view_cache.rb +0 -9
@@ -3,16 +3,16 @@ require "card/content/chunk"
3
3
 
4
4
  describe Card::Content::Chunk, "Chunk" do
5
5
  context "Class" do
6
- it "should populate prefix map on load" do
6
+ it "populates prefix map on load" do
7
7
  expect(Card::Content::Chunk.prefix_map_by_list[:default].keys.size)
8
8
  .to be > 0
9
9
  expect(Card::Content::Chunk.prefix_map_by_list[:default]["{"][:class])
10
- .to eq(Card::Content::Chunk::Include)
10
+ .to eq(Card::Content::Chunk::Nest)
11
11
  end
12
12
 
13
- it "should find Chunk classes using matched prefix" do
13
+ it "finds Chunk classes using matched prefix" do
14
14
  expect(Card::Content::Chunk.find_class_by_prefix("{{"))
15
- .to eq(Card::Content::Chunk::Include)
15
+ .to eq(Card::Content::Chunk::Nest)
16
16
  end
17
17
  end
18
18
  end
@@ -5,14 +5,14 @@ describe Card::Codename, "Codename" do
5
5
  @codename = :default
6
6
  end
7
7
 
8
- it "should be sane" do
8
+ it "is sane" do
9
9
  expect(Card[@codename].codename).to eq(@codename.to_s) # would prefer Symbol eventually
10
10
  card_id = Card::Codename[@codename]
11
11
  expect(card_id).to be_a_kind_of Integer
12
12
  expect(Card::Codename[card_id]).to eq(@codename)
13
13
  end
14
14
 
15
- it "should make cards indestructable" do
15
+ it "makes cards indestructable" do
16
16
  Card::Auth.as_bot do
17
17
  card = Card[@codename]
18
18
  card.delete
@@ -5,42 +5,42 @@ describe Card::Content do
5
5
  EXAMPLES = {
6
6
  nests: {
7
7
  content: "Some Literals: \\[{I'm not| a link]}, and " \
8
- '\\{{This Card|Is not Included}}' \
8
+ '\\{{This Card|Is not Nestd}}' \
9
9
  ", but " \
10
10
  "{{this is}}" \
11
11
  ", and some tail",
12
12
  rendered: ["Some Literals: \\[{I'm not| a link]}, and ",
13
- "<span>{</span>{This Card|Is not Included}}",
13
+ "<span>{</span>{This Card|Is not Nestd}}",
14
14
  ", but ",
15
- { options: { inc_name: "this is",
16
- inc_syntax: "this is" } },
15
+ { options: { nest_name: "this is",
16
+ nest_syntax: "this is" } },
17
17
  ", and some tail"],
18
- classes: [String, :EscapedLiteral, String, :Include, String]
18
+ classes: [String, :EscapedLiteral, String, :Nest, String]
19
19
  },
20
20
 
21
21
  links_and_nests: {
22
22
  content: "Some Links and includes: [[the card|the text]], " \
23
- "and {{This Card|Is Included}}{{this too}} " \
23
+ "and {{This Card|Is Nestd}}{{this too}} " \
24
24
  "and [[http://external.wagn.org/path|link text]]" \
25
- "{{Included|open}}",
25
+ "{{Nestd|open}}",
26
26
  rendered: ["Some Links and includes: ",
27
27
  '<a class="wanted-card" ' \
28
28
  'href="/the_card">' \
29
29
  "the text</a>",
30
30
  ", and ",
31
- { options: { view: "Is Included",
32
- inc_name: "This Card",
33
- inc_syntax: "This Card|Is Included" } },
34
- { options: { inc_name: "this too",
35
- inc_syntax: "this too" } },
31
+ { options: { view: "Is Nestd",
32
+ nest_name: "This Card",
33
+ nest_syntax: "This Card|Is Nestd" } },
34
+ { options: { nest_name: "this too",
35
+ nest_syntax: "this too" } },
36
36
  " and ",
37
37
  '<a target="_blank" class="external-link" ' \
38
38
  'href="http://external.wagn.org/path">link text</a>',
39
39
  { options: { view: "open",
40
- inc_name: "Included",
41
- inc_syntax: "Included|open" } }],
40
+ nest_name: "Nestd",
41
+ nest_syntax: "Nestd|open" } }],
42
42
  classes: [
43
- String, :Link, String, :Include, :Include, String, :Link, :Include
43
+ String, :Link, String, :Nest, :Nest, String, :Link, :Nest
44
44
  ]
45
45
  },
46
46
 
@@ -134,7 +134,7 @@ describe Card::Content do
134
134
 
135
135
  single_nest: {
136
136
  content: "{{one nest|size;large}}",
137
- classes: [:Include]
137
+ classes: [:Nest]
138
138
  },
139
139
 
140
140
  css: {
@@ -324,13 +324,13 @@ describe Card::Content do
324
324
 
325
325
  context "class" do
326
326
  describe "#clean!" do
327
- it "should not alter untagged content" do
327
+ it "does not alter untagged content" do
328
328
  UNTAGGED_CASES.each do |test_case|
329
329
  assert_equal test_case, Card::Content.clean!(test_case)
330
330
  end
331
331
  end
332
332
 
333
- it "should strip disallowed html class attributes" do
333
+ it "strips disallowed html class attributes" do
334
334
  assert_equal "<p>html<div>with</div> funky tags</p>",
335
335
  Card::Content.clean!(
336
336
  '<p>html<div class="boo">with</div>' \
@@ -340,7 +340,7 @@ describe Card::Content do
340
340
  Card::Content.clean!('<span class="banana">foo</span>')
341
341
  end
342
342
 
343
- it "should not strip permitted_classes" do
343
+ it "does not strip permitted_classes" do
344
344
  has_stripped1 = '<span class="w-spotlight">foo</span>'
345
345
  assert_equal has_stripped1,
346
346
  Card::Content.clean!(has_stripped1)
@@ -349,7 +349,7 @@ describe Card::Content do
349
349
  Card::Content.clean!(has_stripped2)
350
350
  end
351
351
 
352
- it "should strip permitted_classes " \
352
+ it "strips permitted_classes " \
353
353
  "but not permitted ones when both are present" do
354
354
  assert_equal '<span class="w-spotlight w-ok">foo</span>',
355
355
  Card::Content.clean!(
@@ -365,7 +365,7 @@ describe Card::Content do
365
365
  )
366
366
  end
367
367
 
368
- it "should allow permitted attributes" do
368
+ it "allows permitted attributes" do
369
369
  assert_equal '<img src="foo">', Card::Content.clean!('<img src="foo">')
370
370
  assert_equal "<img alt='foo'>", Card::Content.clean!("<img alt='foo'>")
371
371
  assert_equal '<img title="foo">',
@@ -377,12 +377,12 @@ describe Card::Content do
377
377
  Card::Content.clean!('<blockquote cite="foo">')
378
378
  end
379
379
 
380
- it "should not allow nonpermitted attributes" do
380
+ it "does not allow nonpermitted attributes" do
381
381
  assert_equal "<img>", Card::Content.clean!('<img size="25">')
382
382
  assert_equal "<p>", Card::Content.clean!('<p font="blah">')
383
383
  end
384
384
 
385
- it "should remove comments" do
385
+ it "removes comments" do
386
386
  assert_equal "yo", Card::Content.clean!("<!-- not me -->yo")
387
387
  assert_equal "joe",
388
388
  Card::Content.clean!("<!-- not me -->joe<!-- not me -->")
@@ -202,7 +202,7 @@ describe Card::Content::Diff do
202
202
  end
203
203
 
204
204
  it "removes square brackets" do
205
- expect(diff "[[Hello]]", "[[Hi]]").to eq(del("Hello") + ins("Hi"))
205
+ expect(diff "[[Hello]]", "[[Hi]]").to eq(del("Hello<br>") + ins("Hi<br>"))
206
206
  end
207
207
  end
208
208
  end
@@ -1,36 +1,31 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  describe Card::Format do
4
- describe "#show?" do
4
+ describe "#show_view?" do
5
5
  let(:format) { described_class.new Card.new }
6
6
 
7
- def show_menu? args
8
- format.show_view?(:menu, args)
7
+ def show_menu? args, default_viz=:show
8
+ args.merge! optional: true
9
+ format.with_voo(Card::View.new format, :nonview, args) do
10
+ format.show_view?(:menu, default_viz)
11
+ end
9
12
  end
10
- it "should respect defaults" do
11
- expect(show_menu?(default_visibility: :show)).to be_truthy
12
- expect(show_menu?(default_visibility: :hide)).to be_falsey
13
+ it "respects defaults" do
14
+ expect(show_menu?({}, :show)).to be_truthy
15
+ expect(show_menu?({}, :hide)).to be_falsey
13
16
  expect(show_menu?({})).to be_truthy
14
17
  end
15
18
 
16
- it "should respect developer default overrides" do
17
- expect(show_menu?(optional_menu: :show, default_visibility: :hide))
18
- .to be_truthy
19
- expect(show_menu?(optional_menu: :hide, default_visibility: :show))
20
- .to be_falsey
21
- expect(show_menu?(optional_menu: :hide)).to be_falsey
19
+ it "respects developer defaults" do
20
+ expect(show_menu?({ show: "menu" }, :hide)).to be_truthy
21
+ expect(show_menu?({ hide: "menu" }, :show)).to be_falsey
22
+ expect(show_menu?(hide: "menu")).to be_falsey
22
23
  end
23
24
 
24
- it "should handle args from nests" do
25
- expect(show_menu?(show: "menu", default_visibility: :hide)).to be_truthy
26
- expect(show_menu?(hide: "menu, paging", default_visibility: :show))
27
- .to be_falsey
28
- expect(show_menu?(show: "menu", optional_menu: :hide)).to be_truthy
29
- end
30
-
31
- it "should handle hard developer overrides" do
32
- expect(show_menu?(optional_menu: :always, hide: "menu")).to be_truthy
33
- expect(show_menu?(optional_menu: :never, show: "menu")).to be_falsey
25
+ it "handles args from nests" do
26
+ expect(show_menu?({ show: "menu" }, :hide)).to be_truthy
27
+ expect(show_menu?({ hide: "menu, paging" }, :show)).to be_falsey
28
+ expect(show_menu?({ show: "menu" }, :hide)).to be_truthy
34
29
  end
35
30
  end
36
31
 
@@ -56,7 +51,7 @@ describe Card::Format do
56
51
  "external with port: http://localhost:2020/path?cgi=foo+bar=baz after "
57
52
  end
58
53
 
59
- it "should format links" do
54
+ it "formats links" do
60
55
  cobj = Card::Content.new url_text1, text_format
61
56
  expect(cobj.to_s).to eq url_text1
62
57
  cobj = Card::Content.new url_text2, text_format
@@ -69,7 +64,7 @@ describe Card::Format do
69
64
  expect(cobj.to_s).to eq url_text5
70
65
  end
71
66
 
72
- it "should format html links" do
67
+ it "formats html links" do
73
68
  cobj = Card::Content.new url_text1, html_format
74
69
  expect(cobj.to_s).to eq(
75
70
  'with external free link <a target="_blank" class="external-link" ' \
@@ -5,7 +5,7 @@
5
5
  # # let(:pat_all_double) { proxy Card::Set::All }
6
6
  # # let(:format_double) { proxy Card::Format }
7
7
  # # let(:html_format_double) { proxy Card::Format::HtmlFormat }
8
- # # it "should auto-load Card class methods from lib/card and mods" do
8
+ # # it "autos-load Card class methods from lib/card and mods" do
9
9
  # # #xpect(Card).to receive(:load_mods)
10
10
  # # #
11
11
  # # card = Card[:all]
@@ -19,16 +19,16 @@
19
19
  # # # allow(Card).to receive(:file_path_sdfs)
20
20
  # # #expect(Card.instance_method(:file_path)).to be
21
21
  # # end
22
- # # it "should define Card methods from modules" do
22
+ # # it "defines Card methods from modules" do
23
23
  # # expect(Card.instance_method(:set_modules)).to be
24
24
  # # end
25
- # # it "should define Formatter methods from modules" do
25
+ # # it "defines Formatter methods from modules" do
26
26
  # # #expect(Card.instance_method(:render_core)).to be
27
27
  # # expect(Card.instance_method(:_render_raw)).to be
28
28
  # # expect(Card.instance_method(:render_core)).to be
29
29
  # # expect(Card.instance_method(:_render_raw)).to be
30
30
  # # end
31
- # # it "should define Formatter methods from modules" do
31
+ # # it "defines Formatter methods from modules" do
32
32
  # # expect(html_format_double.method(:render_core)).to be
33
33
  # # expect(html_format_double.method(:_render_raw)).to be
34
34
  # # expect(html_format_double.method(:render_core)).to be
@@ -2,64 +2,64 @@
2
2
 
3
3
  describe Card::Name do
4
4
  describe "#key" do
5
- it "should lowercase and underscore" do
5
+ it "lowercases and underscores" do
6
6
  expect("This Name".to_name.key).to eq("this_name")
7
7
  end
8
8
 
9
- it "should remove spaces" do
9
+ it "removes spaces" do
10
10
  expect("this Name".to_name.key).to eq("this_name")
11
11
  end
12
12
 
13
13
  describe "underscores" do
14
- it "should be treated like spaces" do
14
+ it "is treated like spaces" do
15
15
  expect("weird_ combo".to_name.key).to eq("weird combo".to_name.key)
16
16
  end
17
17
 
18
- it "should not impede pluralization checks" do
18
+ it "does not impede pluralization checks" do
19
19
  expect("Mamas_and_Papas".to_name.key).to(
20
20
  eq("Mamas and Papas".to_name.key)
21
21
  )
22
22
  end
23
23
 
24
- it "should be removed when before first word character" do
24
+ it "is removed when before first word character" do
25
25
  expect("_This Name".to_name.key).to eq("this_name")
26
26
  end
27
27
  end
28
28
 
29
- it "should singularize" do
29
+ it "singularizes" do
30
30
  expect("ethans".to_name.key).to eq("ethan")
31
31
  end
32
32
 
33
- it "should change CamelCase to snake case" do
33
+ it "changes CamelCase to snake case" do
34
34
  expect("ThisThing".to_name.key).to eq("this_thing")
35
35
  end
36
36
 
37
- it "should handle plus cards" do
37
+ it "handles plus cards" do
38
38
  expect("ThisThing+Ethans".to_name.key).to eq("this_thing+ethan")
39
39
  end
40
40
 
41
- it "should retain * for star cards" do
41
+ it "retains * for star cards" do
42
42
  expect("*right".to_name.key).to eq("*right")
43
43
  end
44
44
 
45
- it "should not singularize double s's" do
45
+ it "does not singularize double s's" do
46
46
  expect("grass".to_name.key).to eq("grass")
47
47
  end
48
48
 
49
- it "should not singularize letter 'S'" do
49
+ it "does not singularize letter 'S'" do
50
50
  expect("S".to_name.key).to eq("s")
51
51
  end
52
52
 
53
- it "should handle unicode characters" do
53
+ it "handles unicode characters" do
54
54
  expect("Mañana".to_name.key).to eq("mañana")
55
55
  end
56
56
 
57
- it "should handle weird initial characters" do
57
+ it "handles weird initial characters" do
58
58
  expect("__you motha @\#$".to_name.key).to eq("you_motha")
59
59
  expect("?!_you motha @\#$".to_name.key).to eq("you_motha")
60
60
  end
61
61
 
62
- it "should allow numbers" do
62
+ it "allows numbers" do
63
63
  expect("3way".to_name.key).to eq("3way")
64
64
  end
65
65
 
@@ -67,7 +67,7 @@ describe Card::Name do
67
67
  expect("cards hooks label foos".to_name.key).to eq("card_hook_label_foo")
68
68
  end
69
69
 
70
- it "should handle html entities" do
70
+ it "handles html entities" do
71
71
  # This no longer takes off the s, is singularize broken now?
72
72
  expect("Jean-fran&ccedil;ois Noubel".to_name.key).to(
73
73
  eq("jean_françoi_noubel")
@@ -80,7 +80,7 @@ describe Card::Name do
80
80
  "PB &amp; J", "Mañana"].map(&:to_name)
81
81
 
82
82
  cardnames.each do |cardname|
83
- it "should have the same key as the name" do
83
+ it "has the same key as the name" do
84
84
  k = cardname.key
85
85
  k2 = cardname.url_key
86
86
  # warn "cn tok #{cardname.inspect}, #{k.inspect}, #{k2.inspect}"
@@ -10,7 +10,7 @@ describe Card::Query do
10
10
  Card::Query.run @query.reverse_merge return: :name, sort: :name
11
11
  end
12
12
 
13
- it "should not alter original statement" do
13
+ it "does not alter original statement" do
14
14
  @query = { right_plus: { name: %w(in tag source) } }
15
15
  query_clone = @query.deep_clone
16
16
  subject # runs query
@@ -18,7 +18,7 @@ describe Card::Query do
18
18
  end
19
19
 
20
20
  describe "append" do
21
- it "should find real cards" do
21
+ it "finds real cards" do
22
22
  @query = {
23
23
  name: [:in, "C", "D", "F"],
24
24
  append: "A"
@@ -26,7 +26,7 @@ describe Card::Query do
26
26
  is_expected.to eq(%w(C+A D+A F+A))
27
27
  end
28
28
 
29
- it "should absolutize names" do
29
+ it "absolutizes names" do
30
30
  @query = {
31
31
  name: [:in, "C", "D", "F"],
32
32
  append: "_right",
@@ -35,7 +35,7 @@ describe Card::Query do
35
35
  is_expected.to eq(%w(C+A D+A F+A))
36
36
  end
37
37
 
38
- it "should find virtual cards" do
38
+ it "finds virtual cards" do
39
39
  @query = {
40
40
  name: [:in, "C", "D"],
41
41
  append: "*plus cards"
@@ -45,17 +45,17 @@ describe Card::Query do
45
45
  end
46
46
 
47
47
  describe "in" do
48
- it "should work for content options" do
48
+ it "works for content options" do
49
49
  @query = { in: %w(AlphaBeta Theta) }
50
50
  is_expected.to eq(%w(A+B T))
51
51
  end
52
52
 
53
- it "should find the same thing in full syntax" do
53
+ it "finds the same thing in full syntax" do
54
54
  @query = { content: [:in, "Theta", "AlphaBeta"] }
55
55
  is_expected.to eq(%w(A+B T))
56
56
  end
57
57
 
58
- it "should work on types" do
58
+ it "works on types" do
59
59
  @query = { type: [:in, "Cardtype E", "Cardtype F"] }
60
60
  is_expected.to eq(%w(type-e-card type-f-card))
61
61
  end
@@ -74,7 +74,7 @@ describe Card::Query do
74
74
  end
75
75
 
76
76
  describe "not" do
77
- it "should exclude cards matching not criteria" do
77
+ it "excludes cards matching not criteria" do
78
78
  Card::Auth.as_bot
79
79
  @query = { plus: "A", not: { plus: "A+B" } }
80
80
  is_expected.to eq(%w(B D E F))
@@ -82,64 +82,64 @@ describe Card::Query do
82
82
  end
83
83
 
84
84
  describe "multiple values" do
85
- it "should handle :all as the first element of an Array" do
85
+ it "handles :all as the first element of an Array" do
86
86
  @query = { member_of: [:all, { name: "r1" }, { key: "r2" }] }
87
87
  is_expected.to eq(%w(u1 u2))
88
88
  end
89
89
 
90
- it "should handle act like :all by default" do
90
+ it "handles act like :all by default" do
91
91
  @query = { member_of: [{ name: "r1" }, { key: "r2" }] }
92
92
  is_expected.to eq(%w(u1 u2))
93
93
  end
94
94
 
95
- it "should handle :any as the first element of an Array" do
95
+ it "handles :any as the first element of an Array" do
96
96
  @query = { member_of: [:any, { name: "r1" }, { key: "r2" }] }
97
97
  is_expected.to eq(%w(u1 u2 u3))
98
98
  end
99
99
 
100
- it "should handle :any as a relationship" do
100
+ it "handles :any as a relationship" do
101
101
  @query = { member_of: { any: [{ name: "r1" }, { key: "r2" }] } }
102
102
  is_expected.to eq(%w(u1 u2 u3))
103
103
  end
104
104
 
105
- it "should handle explicit conjunctions in plus_relational keys" do
105
+ it "handles explicit conjunctions in plus_relational keys" do
106
106
  @query = { right_plus: [:all, "e", "c"] }
107
107
  is_expected.to eq(%w(A))
108
108
  end
109
109
 
110
- it "should handle multiple values for right_part in compound relations" do
110
+ it "handles multiple values for right_part in compound relations" do
111
111
  @query = { right_plus: [["e", {}], "c"] }
112
112
  is_expected.to eq(%w(A)) # first element is array
113
113
  end
114
114
 
115
- it "should not interpret simple arrays as multi values for plus" do
115
+ it "does not interpret simple arrays as multi values for plus" do
116
116
  @query = { right_plus: %w(e c) }
117
117
  is_expected.to eq([]) # NOT interpreted as multi-value
118
118
  end
119
119
 
120
- it "should handle :and for references" do
120
+ it "handles :and for references" do
121
121
  @query = { refer_to: [:and, "a", "b"] }
122
122
  is_expected.to eq(%w(Y))
123
123
  end
124
124
 
125
- it "should handle :or for references" do
125
+ it "handles :or for references" do
126
126
  @query = { refer_to: [:or, "b", "z"] }
127
127
  is_expected.to eq(%w(A B Y))
128
128
  end
129
129
 
130
- it "should handle treat simple arrays like :all for references" do
130
+ it "handles treat simple arrays like :all for references" do
131
131
  @query = { refer_to: %w(A T) }
132
132
  is_expected.to eq(%w(X Y))
133
133
  end
134
134
  end
135
135
 
136
136
  describe "edited_by/editor_of" do
137
- it "should find card edited by joe using subquery" do
137
+ it "finds card edited by joe using subquery" do
138
138
  @query = { edited_by: { match: "Joe User" } }
139
139
  is_expected.to eq(%w(JoeLater JoeNow))
140
140
  end
141
141
 
142
- it "should find card edited by Wagn Bot" do
142
+ it "finds card edited by Wagn Bot" do
143
143
  # this is a weak test, since it gives the name, but different sorting
144
144
  # mechanisms in other db setups
145
145
  # was having it return *account in some cases and 'A' in others
@@ -147,12 +147,12 @@ describe Card::Query do
147
147
  is_expected.to eq(%w(A))
148
148
  end
149
149
 
150
- it 'should fail gracefully if user isn\'t there' do
150
+ it "fails gracefully if user isn't there" do
151
151
  @query = { edited_by: "Joe LUser" }
152
152
  is_expected.to eq([])
153
153
  end
154
154
 
155
- it "should not give duplicate results for multiple edits" do
155
+ it "does not give duplicate results for multiple edits" do
156
156
  c = Card["JoeNow"]
157
157
  c.content = "testagagin"
158
158
  c.save
@@ -162,7 +162,7 @@ describe Card::Query do
162
162
  is_expected.to eq(%w(JoeLater JoeNow))
163
163
  end
164
164
 
165
- it 'should find joe user among card\'s editors' do
165
+ it "finds joe user among card's editors" do
166
166
  @query = { editor_of: "JoeLater" }
167
167
  is_expected.to eq(["Joe User"])
168
168
  end
@@ -173,12 +173,12 @@ describe Card::Query do
173
173
  Card.create name: "Create Test", content: "sufficiently distinctive"
174
174
  end
175
175
 
176
- it "should find Joe User as the card's creator" do
176
+ it "finds Joe User as the card's creator" do
177
177
  @query = { creator_of: "Create Test" }
178
178
  is_expected.to eq(["Joe User"])
179
179
  end
180
180
 
181
- it "should find card created by Joe User" do
181
+ it "finds card created by Joe User" do
182
182
  @query = { created_by: "Joe User", eq: "sufficiently distinctive" }
183
183
  is_expected.to eq(["Create Test"])
184
184
  end
@@ -191,26 +191,26 @@ describe Card::Query do
191
191
  c.save!
192
192
  end
193
193
 
194
- it "should find Joe User as the card's last editor" do
194
+ it "finds Joe User as the card's last editor" do
195
195
  @query = { last_editor_of: "A" }
196
196
  is_expected.to eq(["Joe User"])
197
197
  end
198
198
 
199
- it "should find card created by Joe User" do
199
+ it "finds card created by Joe User" do
200
200
  @query = { last_edited_by: "Joe User", eq: "peculicious" }
201
201
  is_expected.to eq(["A"])
202
202
  end
203
203
  end
204
204
 
205
205
  describe "keyword" do
206
- it "should escape nonword characters" do
206
+ it "escapes nonword characters" do
207
207
  @query = { match: "two :(!" }
208
208
  is_expected.to eq(CARDS_MATCHING_TWO)
209
209
  end
210
210
  end
211
211
 
212
212
  describe "search count" do
213
- it "should return integer" do
213
+ it "returns integer" do
214
214
  search = Card.create!(
215
215
  name: "tmpsearch",
216
216
  type: "Search",
@@ -221,51 +221,51 @@ describe Card::Query do
221
221
  end
222
222
 
223
223
  describe "cgi_params" do
224
- it "should match content from cgi" do
224
+ it "matchs content from cgi" do
225
225
  @query = { match: "$keyword", vars: { keyword: "two" } }
226
226
  is_expected.to eq(CARDS_MATCHING_TWO)
227
227
  end
228
228
  end
229
229
 
230
230
  describe "content equality" do
231
- it "should match content explicitly" do
231
+ it "matchs content explicitly" do
232
232
  @query = { content: ["=", "I'm number two"] }
233
233
  is_expected.to eq(["Joe User"])
234
234
  end
235
235
 
236
- it "should match via shortcut" do
236
+ it "matchs via shortcut" do
237
237
  @query = { "=" => "I'm number two" }
238
238
  is_expected.to eq(["Joe User"])
239
239
  end
240
240
  end
241
241
 
242
242
  describe "links" do
243
- it "should handle refer_to" do
243
+ it "handles refer_to" do
244
244
  @query = { refer_to: "Z" }
245
245
  is_expected.to eq(%w(A B))
246
246
  end
247
247
 
248
- it "should handle link_to" do
248
+ it "handles link_to" do
249
249
  @query = { link_to: "Z" }
250
250
  is_expected.to eq(%w(A))
251
251
  end
252
252
 
253
- it "should handle include" do
253
+ it "handles include" do
254
254
  @query = { include: "Z" }
255
255
  is_expected.to eq(%w(B))
256
256
  end
257
257
 
258
- it "should handle linked_to_by" do
258
+ it "handles linked_to_by" do
259
259
  @query = { linked_to_by: "A" }
260
260
  is_expected.to eq(%w(Z))
261
261
  end
262
262
 
263
- it "should handle included_by" do
263
+ it "handles included_by" do
264
264
  @query = { included_by: "B" }
265
265
  is_expected.to eq(%w(Z))
266
266
  end
267
267
 
268
- it "should handle referred_to_by" do
268
+ it "handles referred_to_by" do
269
269
  @query = { referred_to_by: "X" }
270
270
  is_expected.to eq(%w(A A+B T))
271
271
  end
@@ -284,14 +284,14 @@ describe Card::Query do
284
284
  end
285
285
 
286
286
  describe "relative links" do
287
- it "should handle relative refer_to" do
287
+ it "handles relative refer_to" do
288
288
  @query = { refer_to: "_self", context: "Z" }
289
289
  is_expected.to eq(%w(A B))
290
290
  end
291
291
  end
292
292
 
293
293
  describe "permissions" do
294
- it "should not find cards not in group" do
294
+ it "does not find cards not in group" do
295
295
  Card::Auth.as_bot do
296
296
  Card.create name: "C+*self+*read", type: "Pointer", content: "[[R1]]"
297
297
  end
@@ -301,53 +301,53 @@ describe Card::Query do
301
301
  end
302
302
 
303
303
  describe "basics" do
304
- it "should be case insensitive for name" do
304
+ it "is case insensitive for name" do
305
305
  @query = { name: "a" }
306
306
  is_expected.to eq(["A"])
307
307
  end
308
308
 
309
- it "should find plus cards" do
309
+ it "finds plus cards" do
310
310
  @query = { plus: "A" }
311
311
  is_expected.to eq(A_JOINEES)
312
312
  end
313
313
 
314
- it "should find connection cards" do
314
+ it "finds connection cards" do
315
315
  @query = { part: "A" }
316
316
  is_expected.to eq(%w(A+B A+C A+D A+E C+A D+A F+A))
317
317
  end
318
318
 
319
- it "should find left connection cards" do
319
+ it "finds left connection cards" do
320
320
  @query = { left: "A" }
321
321
  is_expected.to eq(%w(A+B A+C A+D A+E))
322
322
  end
323
323
 
324
- it "should find right connection cards based on name" do
324
+ it "finds right connection cards based on name" do
325
325
  @query = { right: "A" }
326
326
  is_expected.to eq(%w(C+A D+A F+A))
327
327
  end
328
328
 
329
- it "should find right connection cards based on content" do
329
+ it "finds right connection cards based on content" do
330
330
  @query = { right: { content: "Alpha [[Z]]" } }
331
331
  is_expected.to eq(%w(C+A D+A F+A))
332
332
  end
333
333
 
334
- it "should return count" do
334
+ it "returns count" do
335
335
  expect(Card.count_by_wql part: "A").to eq(7)
336
336
  end
337
337
  end
338
338
 
339
339
  describe "limit and offset" do
340
- it "should return limit" do
340
+ it "returns limit" do
341
341
  @query = { part: "A", limit: 5 }
342
342
  expect(subject.size).to eq(5)
343
343
  end
344
344
 
345
- it "should not break if offset but no limit" do
345
+ it "does not break if offset but no limit" do
346
346
  @query = { part: "A", offset: 5 }
347
347
  expect(subject.size).not_to eq(0)
348
348
  end
349
349
 
350
- it "should not break count" do
350
+ it "does not break count" do
351
351
  query = { match: "two", offset: 1 }
352
352
  expect(Card.count_by_wql(query)).to eq(CARDS_MATCHING_TWO.length)
353
353
  end
@@ -360,24 +360,24 @@ describe Card::Query do
360
360
  "Sunglasses fan", "u1", "u2", "u3"
361
361
  ].sort
362
362
 
363
- it "should find cards of this type" do
363
+ it "finds cards of this type" do
364
364
  @query = { type: "_self", context: "User" }
365
365
  is_expected.to eq(user_cards)
366
366
  end
367
367
 
368
- it "should find User cards " do
368
+ it "finds User cards " do
369
369
  @query = { type: "User" }
370
370
  is_expected.to eq(user_cards)
371
371
  end
372
372
 
373
- it "should handle casespace variants" do
373
+ it "handles casespace variants" do
374
374
  @query = { type: "users" }
375
375
  is_expected.to eq(user_cards)
376
376
  end
377
377
  end
378
378
 
379
379
  describe "trash handling" do
380
- it "should not find cards in the trash" do
380
+ it "does not find cards in the trash" do
381
381
  Card["A+B"].delete!
382
382
  @query = { left: "A" }
383
383
  is_expected.to eq(["A+C", "A+D", "A+E"])
@@ -385,7 +385,7 @@ describe Card::Query do
385
385
  end
386
386
 
387
387
  describe "order" do
388
- it "should sort by create" do
388
+ it "sorts by create" do
389
389
  Card.create! name: "classic bootstrap skin head"
390
390
  # classic skin head is created more recently than classic skin,
391
391
  # which is in the seed data
@@ -395,22 +395,22 @@ describe Card::Query do
395
395
  )
396
396
  end
397
397
 
398
- it "should sort by name" do
398
+ it "sorts by name" do
399
399
  @query = { name: %w(in B Z A Y C X), sort: "name", dir: "desc" }
400
400
  is_expected.to eq(%w(Z Y X C B A))
401
401
  end
402
402
 
403
- it "should sort by content" do
403
+ it "sorts by content" do
404
404
  @query = { name: %w(in Z T A), sort: "content" }
405
405
  is_expected.to eq(%w(A Z T))
406
406
  end
407
407
 
408
- it "should play nice with match" do
408
+ it "plays nice with match" do
409
409
  @query = { match: "Z", type: "Basic", sort: "content" }
410
410
  is_expected.to eq(%w(A B Z))
411
411
  end
412
412
 
413
- it "should sort by plus card content" do
413
+ it "sorts by plus card content" do
414
414
  Card::Auth.as_bot do
415
415
  c = Card.fetch("Setting+*self+*table of contents")
416
416
  c.content = "10"
@@ -426,7 +426,7 @@ describe Card::Query do
426
426
  end
427
427
  end
428
428
 
429
- it "should sort by count" do
429
+ it "sorts by count" do
430
430
  Card::Auth.as_bot do
431
431
  @query = {
432
432
  name: [:in, "*always", "*never", "*edited"],
@@ -436,7 +436,7 @@ describe Card::Query do
436
436
  end
437
437
  end
438
438
 
439
- # it 'should sort by update' do
439
+ # it 'sorts by update' do
440
440
  # # do this on a restricted set so it won't change every time we
441
441
  # # add a card..
442
442
  # Card::Query.run(
@@ -450,47 +450,47 @@ describe Card::Query do
450
450
  end
451
451
 
452
452
  describe "match" do
453
- it "should reach content and name via shortcut" do
453
+ it "reachs content and name via shortcut" do
454
454
  @query = { match: "two" }
455
455
  is_expected.to eq(CARDS_MATCHING_TWO)
456
456
  end
457
457
 
458
- it "should get only content when content is explicit" do
458
+ it "gets only content when content is explicit" do
459
459
  @query = { content: [:match, "two"] }
460
460
  is_expected.to eq(["Joe User", "script: ace+*all+*script+*machine cache",
461
461
  "script: slot+*all+*script+*machine cache"])
462
462
  end
463
463
 
464
- it "should get only name when name is explicit" do
464
+ it "gets only name when name is explicit" do
465
465
  @query = { name: [:match, "two"] }
466
466
  is_expected.to eq(["One+Two", "One+Two+Three", "Two"])
467
467
  end
468
468
  end
469
469
 
470
470
  describe "and" do
471
- it "should act as a simple passthrough with operators" do
471
+ it "acts as a simple passthrough with operators" do
472
472
  @query = { and: { match: "two" } }
473
473
  is_expected.to eq(CARDS_MATCHING_TWO)
474
474
  end
475
475
 
476
- it "should act as a simple passthrough with relationships" do
476
+ it "acts as a simple passthrough with relationships" do
477
477
  @query = { and: {}, type: "Cardtype E" }
478
478
  is_expected.to eq(["type-e-card"])
479
479
  end
480
480
 
481
- it 'should work within "or"' do
481
+ it 'works within "or"' do
482
482
  @query = { or: { name: "Z", and: { left: "A", right: "C" } } }
483
483
  is_expected.to eq(["A+C", "Z"])
484
484
  end
485
485
  end
486
486
 
487
487
  describe "any" do
488
- it "should work with :plus" do
488
+ it "works with :plus" do
489
489
  @query = { plus: "A", any: { name: "B", match: "K" } }
490
490
  is_expected.to eq(["B"])
491
491
  end
492
492
 
493
- it "should work with multiple plusses" do
493
+ it "works with multiple plusses" do
494
494
  @query = { or: { right_plus: "A", plus: "B" } }
495
495
  is_expected.to eq(%w(A C D F))
496
496
  end
@@ -504,29 +504,29 @@ describe Card::Query do
504
504
  )
505
505
  end
506
506
 
507
- it "should find cards returned by search of given name" do
507
+ it "finds cards returned by search of given name" do
508
508
  @query = { found_by: "Simple Search" }
509
509
  is_expected.to eq(["A"])
510
510
  end
511
511
 
512
- it "should find cards returned by virtual cards" do
512
+ it "finds cards returned by virtual cards" do
513
513
  image_cards = Card.search type: "Image", return: :name, sort: :name
514
514
  @query = { found_by: "Image+*type+by name" }
515
515
  is_expected.to eq(image_cards)
516
516
  end
517
517
 
518
- it "should play nicely with other properties and relationships" do
518
+ it "plays nicely with other properties and relationships" do
519
519
  explicit_query = { plus: { name: "A" }, return: :name, sort: :name }
520
520
  @query = { plus: { found_by: "Simple Search" } }
521
521
  is_expected.to eq(Card::Query.run(explicit_query))
522
522
  end
523
523
 
524
- it "should play work with virtual cards" do
524
+ it "plays work with virtual cards" do
525
525
  @query = { found_by: "A+*self", plus: "C" }
526
526
  is_expected.to eq(["A"])
527
527
  end
528
528
 
529
- it "should be able to handle _self" do
529
+ it "is able to handle _self" do
530
530
  @query = {
531
531
  context: "Simple Search",
532
532
  left: { found_by: "_self" },
@@ -538,33 +538,33 @@ describe Card::Query do
538
538
  end
539
539
 
540
540
  describe "relative" do
541
- it "should clean wql" do
541
+ it "cleans wql" do
542
542
  query = Card::Query.new(part: "_self", context: "A")
543
543
  expect(query.statement[:part]).to eq("A")
544
544
  end
545
545
 
546
- it "should find connection cards" do
546
+ it "finds connection cards" do
547
547
  @query = { part: "_self", context: "A" }
548
548
  is_expected.to eq(%w(A+B A+C A+D A+E C+A D+A F+A))
549
549
  end
550
550
 
551
- it "should be able to use parts of nonexistent cards in search" do
551
+ it "is able to use parts of nonexistent cards in search" do
552
552
  expect(Card["B+A"]).to be_nil
553
553
  @query = { left: "_right", right: "_left", context: "B+A" }
554
554
  is_expected.to eq(["A+B"])
555
555
  end
556
556
 
557
- it "should find plus cards for _self" do
557
+ it "finds plus cards for _self" do
558
558
  @query = { plus: "_self", context: "A" }
559
559
  is_expected.to eq(A_JOINEES)
560
560
  end
561
561
 
562
- it "should find plus cards for _left" do
562
+ it "finds plus cards for _left" do
563
563
  @query = { plus: "_left", context: "A+B" }
564
564
  is_expected.to eq(A_JOINEES)
565
565
  end
566
566
 
567
- it "should find plus cards for _right" do
567
+ it "finds plus cards for _right" do
568
568
  @query = { plus: "_right", context: "C+A" }
569
569
  is_expected.to eq(A_JOINEES)
570
570
  end