card 1.19.6 → 1.20.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -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 "should update references on rename when requested" do
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 "should update referers on rename when requested (case 2)" do
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 "should not update references when not requested" do
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
- "should store referee ids"
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 "should handle commented nest" do
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
@@ -19,12 +19,12 @@
19
19
  # expect(@account_card.role).to eq('request')
20
20
  # end
21
21
  #
22
- # it "shouldn't have a reader method for card_writer" do
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 "shouldn't have a reader method for card_reader" do
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 "should define Formatter methods from modules" do
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 "should call set render methods" do
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 "should define Formatter methods from modules" do
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 "should define Formatter methods from modules" do
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::Cache::ViewCache do
4
- it "gets cleared by Card::Cache.reset_all" do
5
- Card::Cache::ViewCache.cache.write "testkey", 1
6
- expect(Card::Cache::ViewCache.cache.exist? "testkey").to be_truthy
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::Cache::ViewCache.cache.exist? "testkey").to be_falsey
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 "should not allow cardtype remove when instances present" do
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 "should not be valid" do
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 "should not create a new cardtype until saved" do
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 "should confirm that it has descendants" do
87
+ it "confirms that it has descendants" do
88
88
  expect(@a.descendants.length).to be > 0
89
89
  end
90
90
 
91
- it "should successfully have its type changed" do
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 "should still have its descendants after changing type" do
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 "should have create permissions" do
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 "should successfully change its type to a Cardtype" do
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 "should not have r3 permissions" do
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 "should ponder creating a card of Cardtype F, but find that he lacks create permissions" do
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 "should not find Cardtype F on its list of createable cardtypes" do
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 "should find Basic on its list of createable cardtypes" do
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 "should have existing cards of that type" do
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 "should raise an error when you try to delete it" do
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 "should handle changing away from Cardtype" do
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 "should work" do
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 "should not override explicit content with default content" do
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 "should require permission" do
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 "should be in the trash" do
24
+ it "is in the trash" do
25
25
  expect(@c.trash).to be_truthy
26
26
  end
27
- it "should come out of the trash when a plus card is created" do
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 "should be retrieved by fetch with new" do
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 "should be deleted when root is" do
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 "should not be removable" do
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 "should be removable" do
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 "should not be removable" do
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 "should be trash" do
99
+ it "is trash" do
100
100
  expect(@c.trash).to be_truthy
101
101
  end
102
102
 
103
- it "should not be findable by name" do
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 "should rename b to a" do
120
+ it "renames b to a" do
121
121
  expect(@b.name).to eq("A")
122
122
  end
123
123
 
124
- it "should rename a to a*trash" do
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 "should be trash" do
139
+ it "is trash" do
140
140
  expect(@c.trash).to eq(true)
141
141
  end
142
142
 
143
- it "should not be findable by name" do
143
+ it "does not be findable by name" do
144
144
  expect(Card["basicname"]).to eq(nil)
145
145
  end
146
146
 
147
- it "should still have actions" do
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 "should not be trash" do
162
+ it "does not be trash" do
163
163
  expect(@c.trash).to eq(false)
164
164
  end
165
165
 
166
- it "should have 3 actions" do
166
+ it "has 3 actions" do
167
167
  expect(@c.actions.count).to eq(3)
168
168
  end
169
169
 
170
- it "should still have old content" do
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 "should have the same content" do
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 "should delete and recreate with a different cardtype" do
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 "should not be trash" do
203
+ it "does not be trash" do
204
204
  expect(@c.trash).to eq(false)
205
205
  end
206
206
 
207
- it "should have 3 actions" do
207
+ it "has 3 actions" do
208
208
  expect(@c.actions.count).to eq(3)
209
209
  end
210
210
 
211
- it "should still have old action" do
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 "should have old content" do
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 "should have a role type" do
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 "should not have errors" do
76
+ it "does not have errors" do
77
77
  expect(@joe.errors.empty?).to eq(true)
78
78
  end
79
79
 
80
- it "should allow type changes" do
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 "should have cardtype b create role r1" do
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 "should have errors" do
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 "should be the original type" do
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 "should change type of the card" do
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 "should change type of card" do
121
+ it "changes type of card" do
122
122
  expect(Card["basicname"].type_code).to eq(:cardtype_f)
123
123
  end
124
124
  end