clwiki 2.4.0 → 3.0.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 (239) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +19 -9
  3. data/app/controllers/cl_wiki/application_controller.rb +29 -1
  4. data/app/controllers/cl_wiki/page_controller.rb +52 -38
  5. data/app/controllers/cl_wiki/sessions_controller.rb +30 -0
  6. data/app/helpers/cl_wiki/application_helper.rb +3 -1
  7. data/app/models/cl_wiki/user.rb +89 -0
  8. data/app/views/cl_wiki/page/edit.html.erb +5 -1
  9. data/app/views/cl_wiki/page/recent.html.erb +1 -1
  10. data/app/views/cl_wiki/page/recent.rss.builder +10 -8
  11. data/app/views/cl_wiki/sessions/new.html.erb +10 -0
  12. data/config/clwiki.yml +16 -30
  13. data/config/initializers/clwiki.rb +4 -3
  14. data/config/routes.rb +9 -0
  15. data/lib/cl_wiki.rb +5 -1
  16. data/lib/cl_wiki/configuration.rb +28 -137
  17. data/lib/cl_wiki/engine.rb +3 -1
  18. data/lib/cl_wiki/file.rb +140 -117
  19. data/lib/cl_wiki/format/format.blockquote.rb +8 -6
  20. data/lib/cl_wiki/format/format.graphviz.digraph.rb +8 -7
  21. data/lib/cl_wiki/format/format.opml.rb +11 -9
  22. data/lib/cl_wiki/format/format.pre.blockquote.rb +8 -6
  23. data/lib/cl_wiki/format/format.simpletable.rb +10 -8
  24. data/lib/cl_wiki/memory_index.rb +102 -0
  25. data/lib/cl_wiki/page.rb +129 -257
  26. data/lib/cl_wiki/public_user.rb +9 -0
  27. data/lib/cl_wiki/user_base.rb +25 -0
  28. data/lib/cl_wiki/version.rb +3 -1
  29. data/lib/cl_wiki_lib.rb +9 -0
  30. data/lib/tasks/index.rake +4 -4
  31. data/test/dummy/app/assets/config/manifest.js +3 -0
  32. data/test/dummy/config/application.rb +1 -0
  33. data/test/dummy/config/environments/development.rb +2 -0
  34. data/test/dummy/config/initializers/clwiki.rb +3 -0
  35. data/test/dummy/config/routes.rb +3 -0
  36. data/test/dummy/log/development.log +5909 -0
  37. data/test/dummy/log/test.log +33349 -0
  38. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/-8/-8X-3n5w3EAS5uiBS2GQxjMlqD43Qout1GsSJUU6e4k.cache +1 -0
  39. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/-P/-Pa1BPD1Ps1OvnKPyrGE4MiUEnlzMEccXN8CzzxSRjM.cache +1 -0
  40. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/0k/0ktSefuSiZXp-1v5uXwST57lRoAF2HvHzclO4Gtftgo.cache +0 -0
  41. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/1V/1VmPI9-8O9Y8OP-JxSXl7-yNRMZHqapeh2drmkXiRGE.cache +1 -0
  42. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/2W/2WKPDryRtGzZO6Uedw4RNjnI5M9YVH-IbFg5GvLvTTQ.cache +0 -0
  43. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/3G/3GuA3P7RM10Vv7NgdH65pwfAH7gMHlJ_xBUO74i-ZjM.cache +0 -0
  44. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/3S/3SzCkB81tc9XbtFdEYxCeR3If141gvhEnHchU_C6hHs.cache +1 -0
  45. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/41/41dY2GtQJAt3CmkQn8IDa9B3clQaUT6XymanCfFZR2o.cache +0 -0
  46. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/46/46WEPovJzlkEgsdG0aV08HiNsRkf0L8Txt1SWLi4atg.cache +1 -0
  47. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/4I/4Ir0PJhTRUd9iGlSu6n2AREP-_amedFe4-1fKwB2wvg.cache +1 -0
  48. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/5L/5LXSsjTcB5Un8FHlrhi6AOjxwgzWoXeWBhU_hi1gdcg.cache +1 -0
  49. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/67/67V_0cxwrU68Onen7N2Lb9bTd1jLulH06F9zh1VgZ0U.cache +1 -0
  50. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/6A/6AXD3XLczHK8MPb5e10-7sLcS45ZrP7Iwgyo9xle0nU.cache +0 -0
  51. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/6D/6D8TdXG6KyMkGDvPbv87qUCDz9_6gRZbNAohojB484w.cache +1 -0
  52. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/7L/7LVfTxjfHpOSp2FeG-uhloqIUqIZ7uE3nT40dqhoqY8.cache +2 -0
  53. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/7b/7bceaEE3qsyoVjeou6RR-V9w2Wgzraq0OI2erU4s9ew.cache +1 -0
  54. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/7h/7hRfgp9EsoD33qh0aNXeyg9qdGapPlUT6FmcL8xztY4.cache +0 -0
  55. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/8c/8cq-JtJ9Zwg4F0bFdkqaGHjdB7a9JBmfDO_sczTWycI.cache +1 -0
  56. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/8h/8hO7EIQ5iOa2rL6ZlP318Lrk0unB2CfhHCI0TrUr-Oo.cache +0 -0
  57. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/8x/8x0PXM3vatUzVGk-vKi80S7LXrGb6bE-3EzEj54VNak.cache +1 -0
  58. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/9v/9vfh8eoLcnq3s_rolIXPs15SPTQWGxJrrjpJ3PoABek.cache +1 -0
  59. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/9w/9w-0hdVYmxONDHQlpGn7DFzlRA3oXqpW4x3t9LBUU6M.cache +1 -0
  60. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/B3/B385Es3x0hpGSQNWzSjiDcExPuEV9m1dUZWlEp5zGbw.cache +0 -0
  61. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/BR/BRBOvy22uVEx9Z5Aal_0BfPilVYEQl6AYXG2u8yBqBg.cache +0 -0
  62. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/BX/BXdNycvZI2UN7cgqvk6P4MQCc1PH2bTwa9i9vP-s-jk.cache +0 -0
  63. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/CO/CO-z80mMyQGRy-BwknxOV5bI2IFbcMMNc05j7v8Nqso.cache +0 -0
  64. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Cg/CgPqTXtSkCxEox0z95JfY89MndA2GhTTQK39fjKk6QU.cache +1 -0
  65. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Ct/CtQeoxqXfctXd_NvChnCVaJ_cCjNuXJMv3LBXhswU6A.cache +0 -0
  66. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Dc/DcZ_YfpX7rLYFw-u7jSJCRp_z0iIyB7XKOcwm1cQexk.cache +0 -0
  67. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Ex/Exqg59Ton1SZt_QH4hMa7wUFOAuIQnCan8B9578NzIg.cache +0 -0
  68. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/F5/F5c-QANC5X3kApAecuyiMZEme0NT_UUB6SjxKvb0ALg.cache +1 -0
  69. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Fd/FdwPBPhLtL4s8RSPhJ53YoYoFdRkNxANV_zQYw-KsVc.cache +1 -0
  70. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/GK/GKrbCoxDofzkQCmA17lE84OT6RW_6NKm7jwyZ4n2T6s.cache +0 -0
  71. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Gh/GhVuWwPtbWpQY_Ny4MyilnH9iUqCPxTDzOonAXM4od8.cache +1 -0
  72. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Gv/GvQrSgGYXiR-rgsPHFZq1oJ5zCkDK54muqIw6KW2GyA.cache +0 -0
  73. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Gw/Gwhhfk9vS7QWmHsW90WtAt0_Rp_7AIM-ZcHmEqLf_Rg.cache +1 -0
  74. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/H5/H5Yxi2VJxpyMb-cbgwBNua8O2zZ03Jk4ByV6yhIzAsQ.cache +0 -0
  75. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/I0/I0OpFIfCc595P02GZa3LUD1uD-Payl41dWaW3oZSK7g.cache +1 -0
  76. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/IQ/IQoDS19BmJjvixXd16O_7P6DB-GRUEZgdNJexJ88fIc.cache +1 -0
  77. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/I_/I_zDBUxxL4b2Wk9_qqVs56Abw1jGccc4FgvKwuscswQ.cache +1 -0
  78. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Ig/IgcuJMmmdeYrq2F3D721tC7ficyRm92HIrLkim5DCxQ.cache +1 -0
  79. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/JI/JITjXC3hXUPgOQhDYsVjhPNjtTISt0j5uz2bjfoiSHI.cache +1 -0
  80. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/KL/KL75rsyvMJSIkYkXRijxh8cs7V1wtfLPjuodISQK5vc.cache +0 -0
  81. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Kw/KwqVMeMNxvnaSP-a-H5nkYyxloW_xoqR5JhEnqJ9puQ.cache +1 -0
  82. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/L1/L1KghIbeezpqVDyhAbCDc4pG11ElC5JpUl319-ZlZn8.cache +0 -0
  83. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Lh/LhI7QMLwiVavmyvwYzdc_t_V9OATXaBO8aCB2swJFCk.cache +1 -0
  84. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Lh/LhqYyoCtzXpfZq6UOhmZuZLSaAwZRX44sHfwPvPqezc.cache +2 -0
  85. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Lo/Lovn2yBpV04WnAQwZeM3hLL015H5syYBH2ufgIc6qCM.cache +1 -0
  86. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Lz/LznMZWa43whMHpqnPRsbUfREY3y_fiXQKaiKVEYW4fw.cache +0 -0
  87. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/MC/MC7GYdrSShtV64GB3hoINaYL3vCRZKq9KvwcwrJAdQo.cache +1 -0
  88. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/MU/MU6iF1YPAQqpVK_kVAtiJPtbHaYpYdOcO0g5bJ9exj8.cache +0 -0
  89. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Md/MdIg3XLcnbFsMXC-6xslVtmBvWH7Q21BSt9l5pm305o.cache +0 -0
  90. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Mw/Mwfi5Xeky61jhIuc6ooo4439CHOyz1hS48_taMRSlKM.cache +1 -0
  91. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Ni/Ni5yuK9FFnhLe5HciROve12UIYstBdESWm0LfdcuVVs.cache +1 -0
  92. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Nz/Nz3hkLq4WlqgoHg_ChdHSXbP7fVmCWCTw0lH0jkMmDg.cache +0 -0
  93. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/O3/O38OvSNrhXKbxauuC8GOBBnKrt2-rPaDmfyrXScgHcA.cache +1 -0
  94. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/OS/OSm-zAlxXS63lBjvzJeSWfqq5d3D9fu-_nBVFWyQ4j0.cache +0 -0
  95. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Oa/Oazc9AJ4e_67dU0aArJeCNEeWJKMIFPtAJtxTJoUKcs.cache +1 -0
  96. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/PV/PVDpEMY_ha4kHETTb3QvjOBoBUP4PMjNDNcIAgmDy2I.cache +1 -0
  97. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Pl/PldDxSvU1o_UFPYTE0GJmUS9mHQXH88zEw5HN6GtlRE.cache +1 -0
  98. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Pu/PuU5S_LPnhAX43U1VVN3qP_sv0ph4stXSGo7I0e_jOw.cache +1 -0
  99. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/QJ/QJ6RPZNUkui_k3wTkb62zo8wczYY7q0B174GfSJjjWE.cache +2 -0
  100. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/QX/QXCyCL-Eeb3uHm9iOvs4anspZqeFbQnNyzDfIsXgzC8.cache +0 -0
  101. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/R1/R1F4Qf-kXTMH0fTLahalFTHtNBvgDfkOkrPyW8zeN_E.cache +0 -0
  102. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/R1/R1__Y-gz4zkDYrXWyCf6YTkvXO0RZlrpK6ynGGVuvnM.cache +0 -0
  103. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/R2/R2Xqb6eAeUW2xTaTaTjlkyUCirkb1qfYgW2CyY80VjM.cache +1 -0
  104. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/RM/RMXouh7GkRuhy8S6jnpxFD27HRVT0LEHj9iR53ps4o4.cache +1 -0
  105. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/RV/RVmt1mCn0tykR8xyBylvh-Hvi-Am87neA2IEkYHjg-g.cache +1 -0
  106. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Tg/TgTXCuKAEg1DI5zjHO8tGMGuQGC9BRt9vgDZj2FdSa8.cache +1 -0
  107. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/UI/UIyRfqj_T27DnyWJiZK9BdUGTIDTQ9M953ArtrYz5fM.cache +1 -0
  108. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/U_/U_F-o3fo7oUYyn0O5KBlt3jOF53X_-4UuZb-_alPZPk.cache +1 -0
  109. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/U_/U_KCsVrX_QoGJ_FpUpCNU3XMT36CThwu8_0HYj_2k4w.cache +1 -0
  110. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/U_/U_ie5WwVJPItNZrqfbIrnZpaRokYT5klrYU92QSugd8.cache +0 -0
  111. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Ub/Ub-oUCoAiliSW8ohVsmtsflc4nPeiBvcjzgNbPLYQRc.cache +0 -0
  112. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Ud/UdvIJcVNQ_08Vaoyx4KuRGNjazpB9-qjOtDMTud8R0Y.cache +1 -0
  113. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Uz/UzEG5I_EszWbaSVnk497D0KfuIzsgHoPLVQd7e3mlQg.cache +1 -0
  114. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/V-/V-F9X0mrPgfTELxk9xdYnb27trOmB6nBDL973YWeOfU.cache +0 -0
  115. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/VA/VAOOXmbiiPy1jqpQQCDVrhkByG3pdeJoZCOvVkp-XVY.cache +1 -0
  116. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/VV/VVIuIm_HUOaEdZfXt-CmFQZb3ycoiXeeI-FV7nwkr0Y.cache +1 -0
  117. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/VX/VXHQHhwOUBuWlKPY6smpXG1xjASw927lyjUKBXBh3e0.cache +0 -0
  118. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Vn/VnMqvZo9nqGF_5tt3gNbMyoG8jJVm0K0r1fANEBjfkw.cache +0 -0
  119. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/W1/W1YuEAoPMZTXfbxg_xWV9o2RP60SAKs5bhk7teKdL2g.cache +1 -0
  120. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/W2/W2ZyYMlYmyA7_1WcpiWhYUJa6wfPCZ5kZj_-Nuw31yM.cache +0 -0
  121. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Wg/WgwI9C5-mh_smtsTGVmH4y76T5ifM4M_hKL1fn-K8iw.cache +2 -0
  122. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/X5/X5GHIj6tnz-w7d-60OaYcbzJczzkTBtm24BOxzoSDdo.cache +1 -0
  123. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/X6/X6jU4SPOD_b1ks9tCApsvWRa7q8cBYCjw3gI6Dwvr34.cache +2 -0
  124. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/X8/X88lT-cwuuj8gqiNY83uVqXFgeLcaHMc9Xh2X4Iux6k.cache +0 -0
  125. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/XQ/XQ0aFc1cceisG4P8qUPhW8z1H3I71pMguVRRMgJ66cs.cache +5 -0
  126. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Xh/XhXLVYOEEwpzOBAWDdiCEpTMz7vC8wnlBHYHJkySh-0.cache +1 -0
  127. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/YB/YBJNyX7HNPq78obeHYRGnJKSVl9EtRPbcGD253-ia34.cache +0 -0
  128. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Yu/YupDX89OAJ6u3BHBW-UJgO3nDfi7hwlpf_JHlnM8b6k.cache +1 -0
  129. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/ZH/ZHN5sHdNMxUCl3Ese5T5_AzQbD9WHqpgBL4PBOrgXJY.cache +1 -0
  130. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/ZP/ZPRvYWthjzuQ0tqk5AdgQbeTUqhDboF8bvTtdrmg4Jo.cache +1 -0
  131. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/ZV/ZVu2Ed9wpdsPLKStP971oLEJBwgJQHLInXIiQkIWC04.cache +0 -0
  132. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Zb/ZbnyIl6znMAVquD2ZD5OYA9SPXmQJYWU7V8F2Hgp3Uc.cache +0 -0
  133. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Zj/ZjALwFkjfG3uebsyy_CeJp5VQMJLE03zxPxkNp-sZDA.cache +0 -0
  134. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/_F/_Fu404i1O4mKpjPluBsq-3FZQnyQvla_6jDnH03Lpw8.cache +2 -0
  135. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/a-/a-t90hz_PZnc6ImKhk-cIh_WBB9vi_rChKzLv4hMBqw.cache +1 -0
  136. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/a5/a5cnzGcRAu4dPakq4_DHH9GanK42Ov5O1F62oeJR4Zo.cache +1 -0
  137. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/aJ/aJK2kxoM9CsnZpxiFvP6RoP0sxHBiix9X1P6Mhy9Dcg.cache +2 -0
  138. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/aO/aOU10S2QEOBHcdKwGRfXqqHdYshmYD20LYiJIGMzIa0.cache +1 -0
  139. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/aZ/aZEdK7dgijyjIs26V_QbKsDgO5JxeYXiT0Sl28M0e-U.cache +0 -0
  140. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/aq/aqBnFJWuQ-xmdUL8_asWtElNRrMr0W60LVdDqpt43L8.cache +1 -0
  141. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/b5/b5KTv2Hrf5faN7X4XahT1s8L5t-EANtcFKrMEsGm3lw.cache +1 -0
  142. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/bF/bFemYCjG73k2_Ys77S7qNyW7CYcyw4bngyc0OGneI-s.cache +1 -0
  143. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/bG/bGdy8gJL8acOmxK8AbkYbxNuakf4LlMZ-zPBkyL0E-0.cache +1 -0
  144. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/bK/bKm8sxC3i0ycUMXr6pnD61MdwytUWfpNOJlBY6qJaWg.cache +1 -0
  145. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/dA/dA1M22RMQvVwb74tbFg-_237SferZuCI10s4R0zx8NI.cache +0 -0
  146. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/dF/dFOzXjFeRtB5bukRI9wGrh2O_GkOeBPnrJRMiv8_ZbM.cache +0 -0
  147. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/dw/dwbXKkD4yllXOeD4T7BKoGvLS26j9lxMkjMiIxfyt6E.cache +0 -0
  148. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/eT/eTgN8O1TgsFV61pclFzCmmJ9qT7MgyGvtQrmRtJoNeg.cache +0 -0
  149. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/eu/eu6Xg0psMCuHIWG0WjCo9wwNOlWs-Z5OH4SyGEmdTNQ.cache +1 -0
  150. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/fC/fC-TBNdh4rVupPn2ObyZeIx6OSlpBSBQZfIzywI6xx0.cache +0 -0
  151. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/fR/fRIbNtGTaNqdwIDyusrUmllglSGMNnqnw7VOLvf5D_k.cache +1 -0
  152. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/fq/fq7SFxQSEFZCuS7jQj0n-BQfbJ5mpLpmJQsd9mJVq68.cache +1 -0
  153. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/gG/gGBN3yxvq8azMjDv3hsSw_zLUj9KLuqHPDXZK8x8pFc.cache +0 -0
  154. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/gd/gd3J0EmNeiTh2GzxcAKItmtUnUay9NG4Sm2vkiLKvmA.cache +1 -0
  155. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/gj/gjXteWe57D8FaBOQUw29N_mwHCeTQW8oLjyv8fu3wNw.cache +3 -0
  156. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/gt/gtFeEhjHn0G9WhgiMKaNtXVgNYW9s_wBLE0VGegeAN8.cache +1 -0
  157. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/hA/hA4-M5cp310ZkSe59_BWszdgXy7mmYagSRCfelGBA9o.cache +1 -0
  158. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/iC/iC3FCadetljjEIeMWfeqqDoMxhJi6rI20BpiVxtvgS4.cache +1 -0
  159. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/iV/iV16_jyEayI_vLgHw3HFhtJAiVOCIlzFho0Yt7a4v_Y.cache +0 -0
  160. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/j6/j62KRIr4T81zq1Ujpg7AJRQdI0ry9HGKPt4nK6fRt1g.cache +1 -0
  161. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/jR/jRg0Zbr59-UMtrWO5t2VWNI3GqU7XWOUsE44dX5cPyk.cache +0 -0
  162. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/jj/jj9HUpCSrLEyONEZNLLkgJ8hJmxOCLpcVJeiBa0KDsE.cache +1 -0
  163. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/jq/jqnMk9arxuef2cdSQuxj3WOQuAfGKup3H2pjO7x1DOg.cache +0 -0
  164. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/k1/k14rvggyKI9dk-yVjn-Lk0p8qU360H_JuVG9aZ4q0OM.cache +1 -0
  165. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/kb/Kb8Z49kajAX1vyy5d4-gA8StHhQp5yOUs0wtdZ7m8Hc.cache +1 -0
  166. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/kb/kbEMkrgp2k0pezn_gFfMqA142QwoJYBKMj7cEkE-Hag.cache +1 -0
  167. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/lD/lDpZHp5gBhRdNHdj1TwWq1_LZ_a56lxeksxqaEs2efA.cache +1 -0
  168. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/mE/mEfGHxLvdPQrcbpjLw4q_wOPirMzrR4z58KgozQ1zNY.cache +1 -0
  169. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/mM/mMZ3DR5b7kx70JtEg-ImWOa_V1jnHcWgHqNqapxIMXk.cache +0 -0
  170. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/mX/mXCT6vriuTtwLaKGnTa5hwXSrwGtAmP6pV5lmjbHaYM.cache +0 -0
  171. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/mZ/mZjIy4zRS4hbS4vWHpdKd7jeZgLatEx_nlFqv_KSCrs.cache +0 -0
  172. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/mg/mge36-9r2gGuKcPoghbLDM72AV4gIVTl6gQDbk7hrkg.cache +1 -0
  173. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/nK/nKZaLuUqTl9pf5Nb1oVuabxd74q4oN8YTBeo6bNd-Vk.cache +0 -0
  174. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/nP/nPbHGaYfJSLZ2K3YTROe7T1RPqKoBQJwawQtZ_FN1-I.cache +0 -0
  175. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/o9/o9KyTznHG0ZIHDI7kTg1Jp78qaga7gJqouXSKdocEjA.cache +1 -0
  176. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/oB/oBupyQ9cW436mBji6Rp7TtHE6CX_r8iq2sCBo0LNbc8.cache +1 -0
  177. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/oN/oN3TypgxDDLqcxy0Funa4RVCYXS-7qn6D56wgBiUT2Q.cache +1 -0
  178. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/om/omGcA_eTFAFIH3RJaPOpEW3yz0074cob3hozQFLOAxk.cache +1 -0
  179. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/p0/p0WHrZZBaXbPaNj5XmQGTli4mi08Rv8DidQfwj28a6w.cache +0 -0
  180. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/pA/pAvUFBt71eJx7E7oQbIxrEZ8YcMo9kboyGxjk73ZWrI.cache +1 -0
  181. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/pB/pBwzUQUu-GcmLiQwn6KnbbDP0ipnVHzVaeArqdpqi98.cache +0 -0
  182. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/pC/pCePfKbmTQ6s2Tl7ki3oBput2ruhpCzpa6Vvejbb5xg.cache +1 -0
  183. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/q6/q6BYa32YJF11eGVapO4ouNl6gayPIsARgMavlzZmoi0.cache +0 -0
  184. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/qY/qY78GTTnufmP1eP2CE16x833zGfQ0F5EVCFtUTMQ7Mw.cache +1 -0
  185. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/qm/qmZZzCnL9PLIyZ0iBu6Alr69AUfHHI1fKdNRRgG04yg.cache +1 -0
  186. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/s5/s5yv3jYvjyKZJ8SMzpj94eMKEuX46lAWV1ApHF-6bsM.cache +1 -0
  187. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/sO/sOBPF_p4Te56V9vdLV0Ywn6djNbmdPSIzvgYNPnAXYc.cache +0 -0
  188. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/sv/sv0a_JAC4GSc_cK-2OUAzhFwm_K3qzSfDefwpcqOCk4.cache +1 -0
  189. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/sw/sw2EAksRkslJNoJJCTS2FPOfHWCYvsS86AxmRMPjens.cache +1 -0
  190. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/t1/t1cv6bP9cTAIs82lyIsnXGeAwB1KNVY5_5rgUvelr04.cache +0 -0
  191. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/tO/To1SPyNegqysLIqhSzrNQPh1VKKj19MespjJediCde4.cache +1 -0
  192. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/tO/tOPkZNrO9FRDhSlCf7VWOexxRq2CE2X4_6KjyxJkq2A.cache +0 -0
  193. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/tR/tRoxwnX8bACHK5pW9tIi4ILY4XuYTIpueH0fGr2t0rc.cache +1 -0
  194. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/t_/t_bP70PmOB70862dwKmCTkmZuzTqCreOzNYW4Yn2n6A.cache +1 -0
  195. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/uj/ujdE_ewC5UIxr6uw5F7YRfKKWiu8-15wzBlOjYHsnkQ.cache +1 -0
  196. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/ut/ut8uBMdgxX8_wfU0l6kGew6H8TLXAj74kFnaI252F3k.cache +1 -0
  197. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/ut/utQEOZtBKQK_bUUDeZX4Mgk00L4AOMVyq6zrKAoo1Xw.cache +0 -0
  198. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/vm/vmjBl9ZCF5hj4sG4e2nid94GcRQYmsOsu-_Q3Zlud5c.cache +0 -0
  199. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/vz/vzBoVc4GQWi4UFp-4dBJnzrhyUuokPV8SCOxsdpOht8.cache +0 -0
  200. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/wM/wMWxmf8BN_NAJRCyardukpfDMwts44Bz2a8doi-49Rg.cache +1 -0
  201. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/x7/x7KkTV3ibfIEysLB_ug5bfmnn2VLV_BldukPR3EoPBk.cache +0 -0
  202. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/x7/x7iSOdqAIVmVpn9ujTwJ_C7EqUgmMSri5vjjHdRIX10.cache +1 -0
  203. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/xY/xYdD9O1JRIfpVj9Kw_b3JTUBQZLI_dcy-bf9uXEp-jg.cache +0 -0
  204. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/xx/xxkulLgT-tkVeDC50gUXRGGMou47BUdlYOwgs0j5muY.cache +1 -0
  205. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/yn/yn_3aZZwyjcI0O6fwisZ7zvcu4Gq5bV31g3tHFxfQNg.cache +1 -0
  206. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/yq/yqwjyepbYY4ctoMOySWiOIWUYwzl_BczAmXqJ5DPvb0.cache +0 -0
  207. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/z9/z9HQmzff5j_6CFyk6eQ52nYt9cPLXsxDQY0Yep1Hz-0.cache +1 -0
  208. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/zM/zMvcc87IG1SRbqwUNtWQfHgeWr5XN36OU8vg-v3rUus.cache +0 -0
  209. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/zn/znjQpjNzh1iUAe9DljeFghnStRvqNIr1GuOTibVcEJQ.cache +0 -0
  210. data/test/dummy/tmp/testrep/BazQuux.txt +5 -0
  211. data/test/dummy/tmp/testrep/FooBar.txt +5 -0
  212. data/test/dummy/tmp/testrep/NewPage.txt +5 -0
  213. data/test/dummy/tmp/testrep/users/testy.json +1 -0
  214. data/test/dummy/tmp/wikirep/FrontPage.txt +5 -0
  215. data/test/dummy/tmp/wikirep/users/chrismo.json +1 -0
  216. data/test/dummy/wikirep/EncryptedPage.txt +0 -0
  217. data/test/dummy/wikirep/FrontPage.txt +11 -4
  218. data/test/dummy/wikirep/users/chrismo.json +1 -0
  219. data/test/helpers/wiki_helper_test.rb +2 -0
  220. data/test/lib/clwiki/clwiki_test_helper.rb +19 -2
  221. data/test/lib/clwiki/file_owner_test.rb +58 -0
  222. data/test/lib/clwiki/file_test.rb +85 -56
  223. data/test/lib/clwiki/memory_index_test.rb +61 -0
  224. data/test/lib/clwiki/page_test.rb +71 -148
  225. data/test/lib/clwiki/test_base.rb +19 -19
  226. data/test/test_helper.rb +7 -5
  227. metadata +398 -23
  228. data/lib/cl_wiki/find_in_file.rb +0 -33
  229. data/lib/cl_wiki/index.rb +0 -458
  230. data/lib/cl_wiki/tools/cron.reminders.rb +0 -241
  231. data/lib/cl_wiki/tools/movepages.rb +0 -27
  232. data/lib/cl_wiki/tools/pagestomove.txt +0 -56
  233. data/lib/cl_wiki/tools/rublog/clWiki.rb +0 -62
  234. data/lib/cl_wiki/tools/rublog/readme.txt +0 -2
  235. data/lib/cl_wiki/tools/singlepage.rb +0 -58
  236. data/lib/cl_wiki/tools/test/singlepagetest.rb +0 -9
  237. data/lib/cl_wiki/tools/thunderbird.rb +0 -23
  238. data/test/lib/clwiki/find_in_file_test.rb +0 -111
  239. data/test/lib/clwiki/index_test.rb +0 -32
@@ -0,0 +1 @@
1
+ "%A��G �{h t�l�m�V���NE���f���
@@ -0,0 +1 @@
1
+ I"}app/assets/config/manifest.js?type=application/javascript&id=c185c2d67a408263950db37e2f40d29e4a4a4ef04dcfd599774b455fba0b788d:ET
@@ -0,0 +1 @@
1
+ I"�/Users/chrismo/modev/clwiki/app/assets/stylesheets/cl_wiki/application.css?type=application/css-sourcemap+json&id=b10dfcd8d20b581a407e709919f26b8ace23408349cbd1e3de5964bedb4774b5:ET
@@ -0,0 +1 @@
1
+ "%/{CB�\��NX�j�r�\��W�ͨ e[.i�
@@ -0,0 +1,5 @@
1
+ mtime: 2020-01-24 00:14:24 -0600
2
+ owner: testy
3
+
4
+
5
+ Describe BazQuux here.
@@ -0,0 +1,5 @@
1
+ mtime: 2020-01-24 00:14:24 -0600
2
+ owner: testy
3
+
4
+
5
+ Describe FooBar here.
@@ -0,0 +1,5 @@
1
+ mtime: 2020-01-12 00:30:57 -0600
2
+ owner: testy
3
+
4
+
5
+ Describe NewPage here.
@@ -0,0 +1 @@
1
+ {"username":"testy","password_digest":"$2a$04$Y1GNZ7KYtFnV8CcMcxPV3uVzRNwDbyBr4GSmG/ZwrgxX4I5rCKIvO"}
@@ -0,0 +1,5 @@
1
+ mtime: 2020-01-23 23:40:04 -0600
2
+ owner: chrismo
3
+
4
+
5
+ Describe FrontPage here.
@@ -0,0 +1 @@
1
+ {"username":"chrismo","password_digest":"$2a$12$QQD1dTnd5dFNCWRxLqJyBumrR2HmGPr44V4Z5cC0JhKYEtVKY.T3K"}
@@ -1,6 +1,7 @@
1
- mtime: 2013-01-26 23:22:47 -0600
2
-
3
-
1
+ mtime: 2020-01-09 00:15:40 -0600
2
+ owner: chrismo
3
+
4
+
4
5
  content aabbcc
5
6
 
6
7
  ChrisMorris
@@ -11,4 +12,10 @@ PreTagsTest
11
12
 
12
13
  AboutClWiki
13
14
 
14
- partial page hit => FooBa
15
+ partial page hit => FooBa
16
+
17
+ partial page hit (single result) => DotTe
18
+
19
+ EncryptedPage
20
+
21
+ edit
@@ -0,0 +1 @@
1
+ {"username":"chrismo","password_digest":"$2a$12$QQD1dTnd5dFNCWRxLqJyBumrR2HmGPr44V4Z5cC0JhKYEtVKY.T3K"}
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
 
3
5
  class WikiHelperTest < ActionView::TestCase
@@ -1,5 +1,22 @@
1
- $LOAD_PATH << File.dirname(__FILE__) + '/../../../lib/cl_wiki'
1
+ # frozen_string_literal: true
2
2
 
3
- require_relative 'test_base'
3
+ require_relative '../../../lib/cl_wiki_lib'
4
+ require File.expand_path('test_base', __dir__)
4
5
 
5
6
  require 'minitest/autorun'
7
+
8
+ class EncryptingUser < ClWiki::UserBase
9
+ attr_reader :name
10
+
11
+ def initialize(name = 'encrypting test user')
12
+ @name = name
13
+ end
14
+
15
+ def can_encrypt?
16
+ true
17
+ end
18
+
19
+ def encryption_key
20
+ '0' * 64
21
+ end
22
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'clwiki_test_helper'
4
+
5
+ class FileOwnerTest < TestBase
6
+ def test_defaults_to_public_owner
7
+ file = ClWiki::File.new('PublicPage', @test_wiki_path)
8
+ assert file.owner.is_a? ClWiki::PublicUser
9
+ end
10
+
11
+ def test_public_owner_cannot_encrypt
12
+ file = ClWiki::File.new('PublicPage', @test_wiki_path)
13
+ assert_raises { file.encrypt_content! }
14
+ end
15
+
16
+ def test_real_user_can_encrypt
17
+ user = EncryptingUser.new
18
+ file = ClWiki::File.new('UserPage', @test_wiki_path, owner: user)
19
+ file.encrypt_content!
20
+ file.content = 'My Encrypted Content'
21
+
22
+ read_contents = ::File.read(file.full_path_and_name, mode: 'rb')
23
+ refute(/Encrypted/.match?(read_contents))
24
+
25
+ read_file = ClWiki::File.new('UserPage', @test_wiki_path, owner: user)
26
+ assert_equal 'My Encrypted Content', read_file.content
27
+ end
28
+
29
+ def test_different_owner_cannot_read
30
+ foo = EncryptingUser.new('foo')
31
+ bar = EncryptingUser.new('bar')
32
+
33
+ ClWiki::File.new('FooPage', @test_wiki_path, owner: foo)
34
+
35
+ assert_raises do
36
+ ClWiki::File.new('FooPage', @test_wiki_path, owner: bar)
37
+ end
38
+ end
39
+
40
+ def test_no_owner_metadata_defaults_to_public
41
+ create_legacy_file('LegacyPage.txt')
42
+ file = ClWiki::File.new('LegacyPage', @test_wiki_path)
43
+ assert_equal 'public', file.owner.name
44
+ end
45
+
46
+ def test_no_owner_metadata_but_encrypted_raises
47
+ # if there is no owner, BUT file is set to encrypt -
48
+ # well ... this would fail naturally ... right?
49
+ end
50
+
51
+ def test_public_page_not_encrypted_accessible_by_anyone
52
+ create_legacy_file('LegacyPage.txt')
53
+ user = EncryptingUser.new
54
+
55
+ file = ClWiki::File.new('LegacyPage', @test_wiki_path, owner: user)
56
+ assert_equal user.name, file.owner.name
57
+ end
58
+ end
@@ -1,93 +1,94 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'clwiki_test_helper'
2
- require 'file'
3
4
 
4
- class TestClWikiFile < TestBase
5
+ class ClWikiFileTest < TestBase
5
6
  # refactor: shouldn't be dealing with page paths at this level, should be at
6
7
  # the ClWikiPage level
7
- def do_test_new_page(fullPageName)
8
- fullPageName = ClWiki::Util.convertToNativePath(fullPageName)
9
- fileName = File.expand_path(File.join(@test_wiki_path, fullPageName)) + '.txt'
10
- File.delete(fileName) if FileTest.exist?(fileName)
11
- wikiFile = ClWiki::File.new(fullPageName, @test_wiki_path)
12
- assert(FileTest.exist?(wikiFile.fullPathAndName))
13
- pagePath, pageName = File.split(fullPageName)
14
- assert(wikiFile.name == pageName)
15
- assert_equal(pagePath, wikiFile.pagePath)
16
- assert(wikiFile.wikiRootPath == @test_wiki_path)
17
- assert_equal(fileName, wikiFile.fullPathAndName)
18
- assert_equal(["Describe " + pageName + " here."], wikiFile.content)
19
- newWikiFile = ClWiki::File.new(fullPageName, @test_wiki_path)
20
- assert_equal(["Describe " + pageName + " here."], newWikiFile.content)
8
+ def do_test_new_page(full_page_name)
9
+ full_page_name = ClWiki::Util.convert_to_native_path(full_page_name)
10
+ file_name = File.expand_path(File.join(@test_wiki_path, full_page_name)) + '.txt'
11
+ File.delete(file_name) if FileTest.exist?(file_name)
12
+ wiki_file = ClWiki::File.new(full_page_name, @test_wiki_path)
13
+ assert(FileTest.exist?(wiki_file.full_path_and_name))
14
+ _, page_name = File.split(full_page_name)
15
+ assert(wiki_file.name == page_name)
16
+ assert_equal(file_name, wiki_file.full_path_and_name)
17
+ assert_equal("Describe #{page_name} here.", wiki_file.content)
18
+ new_wiki_file = ClWiki::File.new(full_page_name, @test_wiki_path)
19
+ assert_equal("Describe #{page_name} here.", new_wiki_file.content)
21
20
  end
22
21
 
23
22
  def test_new_root_page
24
23
  do_test_new_page('/NewPage')
25
24
  end
26
25
 
27
- def test_new_sub_page_forward_slash
28
- do_test_new_page('/NewPage/NewSubPage')
29
- end
30
-
31
- def test_new_sub_page_back_slash
32
- do_test_new_page("\\NewPage\\NewSubPage")
26
+ def test_file_delete
27
+ file = ClWiki::File.new('NewPage', @test_wiki_path)
28
+ assert file.file_exists?
29
+ file.delete
30
+ refute file.file_exists?
33
31
  end
34
32
 
35
33
  def test_update_page
36
- wikiFile = ClWiki::File.new("/UpdatePage", @test_wiki_path)
37
- assert_equal(["Describe UpdatePage here."], wikiFile.content)
34
+ wiki_file = ClWiki::File.new('/UpdatePage', @test_wiki_path)
35
+ assert_equal('Describe UpdatePage here.', wiki_file.content)
38
36
 
39
37
  # this test looks ridiculous, but ClWiki::File actually does a write to disk
40
38
  # and re-read from the file behind the scenes here.
41
39
  # refactor rename?
42
- wikiFile.content = "This is new content."
43
- assert_equal(["This is new content."], wikiFile.content)
40
+ wiki_file.content = 'This is new content.'
41
+ assert_equal('This is new content.', wiki_file.content)
44
42
  end
45
43
 
44
+ # rubocop:disable Lint/SuppressedException
46
45
  def test_multi_user_edit
47
46
  # this can happen if 2 people load a page, then both edit the page - the last one
48
47
  # to submit would stomp the first edit ... unless:
49
- wiki_file_a = ClWiki::File.new("/UpdatePage", @test_wiki_path)
50
- wiki_file_b = ClWiki::File.new("/UpdatePage", @test_wiki_path)
51
- assert_equal(["Describe UpdatePage here."], wiki_file_a.content)
52
- assert_equal(["Describe UpdatePage here."], wiki_file_b.content)
48
+ wiki_file_a = ClWiki::File.new('/UpdatePage', @test_wiki_path)
49
+ wiki_file_b = ClWiki::File.new('/UpdatePage', @test_wiki_path)
50
+ assert_equal('Describe UpdatePage here.', wiki_file_a.content)
51
+ assert_equal('Describe UpdatePage here.', wiki_file_b.content)
53
52
 
54
53
  sleep 2.5 # to ensure mtime changes. (lesser time sometimes doesn't work)
55
- wiki_file_a.content = "This is new A content."
54
+ wiki_file_a.content = 'This is new A content.'
56
55
  begin
57
- wiki_file_b.content = "This is new B content."
58
- assert(false, "Expected exception did not occur.")
56
+ wiki_file_b.content = 'This is new B content.'
57
+ assert(false, 'Expected exception did not occur.')
59
58
  rescue ClWiki::FileModifiedSinceRead
60
59
  # don do anythain, issa wha shoo 'appen
61
60
  end
62
61
 
63
- wiki_file_b.readFile
64
- assert_equal(["This is new A content."], wiki_file_b.content)
62
+ wiki_file_b.read_file
63
+ assert_equal('This is new A content.', wiki_file_b.content)
65
64
  end
65
+ # rubocop:enable Lint/SuppressedException
66
66
 
67
67
  def test_multi_user_edit_dst
68
68
  # running into a problem where I can't edit a page that was last edited outside
69
69
  # of DST when I'm in DST ... it raises ClWiki::FileModifiedSinceRead
70
- wiki_file = ClWiki::File.new("/UpdateDstPage", @test_wiki_path)
70
+ wiki_file = ClWiki::File.new('/UpdateDstPage', @test_wiki_path)
71
71
  def wiki_file.ding_mtime
72
72
  @metadata['mtime'] = Time.local(2011, 'jan', 1)
73
73
  end
74
74
  wiki_file.content = 'New content'
75
75
 
76
- wiki_file_read = ClWiki::File.new("/UpdateDstPage", @test_wiki_path)
76
+ wiki_file_read = ClWiki::File.new('/UpdateDstPage', @test_wiki_path)
77
77
  def wiki_file_read.ding_mtime
78
78
  @metadata['mtime'] = Time.local(2011, 'jun', 1)
79
79
  end
80
- wiki_file_read.content = "This is new A content."
81
- assert_equal(["This is new A content."], wiki_file_read.content)
80
+ wiki_file_read.content = 'This is new A content.'
81
+ assert_equal('This is new A content.', wiki_file_read.content)
82
82
  end
83
83
 
84
84
  def test_mtime_metadata
85
85
  # the mtime of the file can be optionally stored as meta data at the top of the file
86
- wiki_file = ClWiki::File.new("/PageWithMetaData", @test_wiki_path)
87
- file_lines = File.readlines(wiki_file.fullPathAndName)
86
+ wiki_file = ClWiki::File.new('/PageWithMetaData', @test_wiki_path)
87
+ file_lines = File.readlines(wiki_file.full_path_and_name)
88
88
  assert_match(/^mtime: .+$/, file_lines[0])
89
- assert_equal "\n", file_lines[1]
89
+ assert_match(/^owner: .+$/, file_lines[1])
90
90
  assert_equal "\n", file_lines[2]
91
+ assert_equal "\n", file_lines[3]
91
92
  end
92
93
 
93
94
  def test_compare_ignores_usec
@@ -101,24 +102,52 @@ class TestClWikiFile < TestBase
101
102
 
102
103
  def test_reads_no_metadata_file
103
104
  File.open(File.join(@test_wiki_path, 'LegacyPage.txt'), 'w') do |f|
104
- f.puts "First line"
105
+ f.puts 'First line'
105
106
  f.puts "\n\n"
106
- f.puts "After the big break"
107
+ f.puts 'After the big break'
107
108
  end
108
- wiki_file = ClWiki::File.new("/LegacyPage", @test_wiki_path)
109
- assert_equal "First line\n\n\nAfter the big break\n", wiki_file.content.join
110
- assert_equal({}, wiki_file.metadata)
109
+ wiki_file = ClWiki::File.new('/LegacyPage', @test_wiki_path)
110
+ assert_equal "First line\n\n\nAfter the big break\n", wiki_file.content
111
+ assert_equal({}, wiki_file.metadata.to_h)
111
112
  end
112
113
 
113
114
  def test_mid_mtime_not_parsed_as_metadata
114
- File.open(File.join(@test_wiki_path, 'LegacyPage.txt'), 'w') do |f|
115
- f.puts "a"
116
- f.puts "mtime: 2015-09-22"
117
- f.puts "\n\n"
118
- f.puts "b"
119
- end
120
- wiki_file = ClWiki::File.new("/LegacyPage", @test_wiki_path)
121
- assert_equal "a\nmtime: 2015-09-22\n\n\nb\n", wiki_file.content.join
122
- assert_equal({}, wiki_file.metadata)
115
+ contents = [
116
+ 'a',
117
+ 'mtime: 2015-09-22',
118
+ "\n",
119
+ 'b',
120
+ ].join("\n")
121
+ create_legacy_file('LegacyPage.txt', contents)
122
+
123
+ wiki_file = ClWiki::File.new('/LegacyPage', @test_wiki_path)
124
+ assert_equal "a\nmtime: 2015-09-22\n\n\nb\n", wiki_file.content
125
+ assert_equal({}, wiki_file.metadata.to_h)
126
+ end
127
+
128
+ def test_encrypted_contents
129
+ wiki_file = ClWiki::File.new('/EncryptedPage', @test_wiki_path, owner: EncryptingUser.new)
130
+ wiki_file.encrypt_content!
131
+ expected_content = "This is my\n<b>awesome</b>\ncontent!"
132
+ wiki_file.content = expected_content
133
+
134
+ refute_match(/awesome/, ::File.read(wiki_file.full_path_and_name, mode: 'rb'))
135
+
136
+ read_file = ClWiki::File.new('/EncryptedPage', @test_wiki_path, owner: EncryptingUser.new)
137
+ assert_equal expected_content, read_file.content
138
+ end
139
+
140
+ def test_decrypt_contents
141
+ wiki_file = ClWiki::File.new('/ToBeDecryptedPage', @test_wiki_path, owner: EncryptingUser.new)
142
+ wiki_file.encrypt_content!
143
+ expected_content = "This is my\n<b>awesome</b>\ncontent!"
144
+ wiki_file.content = expected_content
145
+
146
+ refute_match(/awesome/, ::File.read(wiki_file.full_path_and_name, mode: 'rb'))
147
+
148
+ wiki_file.do_not_encrypt_content!
149
+ wiki_file.content = expected_content
150
+
151
+ assert_match(/awesome/, ::File.read(wiki_file.full_path_and_name, mode: 'rb'))
123
152
  end
124
153
  end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'clwiki_test_helper'
4
+
5
+ class MemoryIndexTest < TestBase
6
+ def test_with_same_mod_timestamp
7
+ file_a = create_legacy_file('TestFileA.txt')
8
+ file_b = create_legacy_file('TestFileB.txt')
9
+ file_c = create_legacy_file('TestFileC.txt')
10
+ # couldn't find a way to set the mtime quickly, so just trusting
11
+ # the above code will run within the same second...
12
+ assert_in_delta(File.mtime(file_a), File.mtime(file_b), 1)
13
+ assert_in_delta(File.mtime(file_a), File.mtime(file_c), 1)
14
+ index = ClWiki::MemoryIndexer.new
15
+ recent = index.recent
16
+ assert_equal(%w[TestFileA TestFileB TestFileC], recent.sort)
17
+ end
18
+
19
+ def test_search
20
+ terms = %w[foo bar qux thud]
21
+ create_legacy_file('TestFileA.txt', terms[0..1])
22
+ create_legacy_file('TestFileB.txt', terms[1..2])
23
+ create_legacy_file('TestFileC.txt', terms[2..3])
24
+ index = ClWiki::MemoryIndexer.new
25
+ assert_equal %w[TestFileB TestFileC], index.search('qux').flatten
26
+ end
27
+
28
+ def test_search_titles_only
29
+ terms = %w[foo bar qux thud]
30
+ create_legacy_file('FooPage.txt', terms[0..1])
31
+ create_legacy_file('BarPage.txt', terms[1..2])
32
+ create_legacy_file('QuxPage.txt', terms[2..3])
33
+ index = ClWiki::MemoryIndexer.new
34
+ assert_equal %w[QuxPage], index.search('qu', titles_only: true)
35
+ assert_equal %w[BarPage QuxPage], index.search('qu', titles_only: false)
36
+ end
37
+
38
+ def test_page_exists
39
+ create_legacy_file('TestFileA.txt')
40
+ index = ClWiki::MemoryIndexer.new
41
+ assert index.page_exists?('TestFileA')
42
+ refute index.page_exists?('TestFileB')
43
+ end
44
+
45
+ def test_reindex
46
+ create_legacy_file('FileToReindex.txt', 'foo bar')
47
+ index = ClWiki::MemoryIndexer.new
48
+ file = ClWiki::File.new('FileToReindex', @test_wiki_path)
49
+ file.content = 'bar qux'
50
+ index.reindex_page('FileToReindex')
51
+ assert_equal %w[FileToReindex], index.search('qux').flatten
52
+ end
53
+
54
+ def test_recent_with_search
55
+ create_legacy_file('TestFileA.txt', 'foo')
56
+ create_legacy_file('TestFileB.txt', 'bar')
57
+ create_legacy_file('TestFileC.txt', 'qux')
58
+ index = ClWiki::MemoryIndexer.new
59
+ assert_equal %w[TestFileB], index.recent(3, text: 'bar')
60
+ end
61
+ end
@@ -1,115 +1,60 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'clwiki_test_helper'
2
- require 'page'
3
4
  require 'tmpdir'
4
5
 
5
6
  # stub this out for testing
6
7
  class ClWiki::Page
7
- @@page_exists = false
8
- @@page_globally_exists = false
8
+ @page_exists = false
9
+ @page_globally_exists = false
9
10
 
10
11
  def self.set_page_exists(value)
11
- @@page_exists = value
12
+ @page_exists = value
12
13
  end
13
14
 
14
- def self.page_exists?(pageFullName)
15
- @@page_exists
15
+ def self.page_exists?(_)
16
+ @page_exists
16
17
  end
17
18
  end
18
19
 
19
- class TestClWikiPage < TestBase
20
+ class PageTest < TestBase
20
21
  def test_wiki_page
21
- ClWiki::Page.new('/NewPage')
22
- end
23
-
24
- def do_test_convert_to_link(pageName, pagePath='/FrontPage')
25
- f = ClWiki::PageFormatter.new(nil, pagePath)
26
- # fullPageName = f.expand_path(pageName, pagePath)
27
- ClWiki::Page.set_page_exists(false)
28
- $wiki_conf.editable = true
29
- assert_equal(
30
- pageName + "<a href='#{pageName}/edit'>?</a>",
31
- f.convertToLink(pageName))
32
- $wiki_conf.editable = false
33
- assert_equal(
34
- pageName,
35
- f.convertToLink(pageName))
36
- ClWiki::Page.set_page_exists(true)
37
-
38
- # now that links serve up a separate link for each page in the
39
- # hierarchy, testing this is cumbersome - and there's already
40
- # tests for testFormatLinkPages which exercise this same thing
41
-
42
- # assert_equal(
43
- # "<a href=clwikicgi.rb?page=" + fullPageName + ">" + pageName + "</a>",
44
- # f.convertToLink(pageName))
45
- end
46
-
47
- def test_convert_to_link_main
48
- do_test_convert_to_link("TestPage")
49
- end
50
-
51
- def test_convert_to_link_sub_bs
52
- do_test_convert_to_link("TestPage\TestSubPage")
53
- end
54
-
55
- def test_convert_to_link_sub_fs
56
- do_test_convert_to_link("TestPage/TestSubPage")
57
- end
58
-
59
- def test_convert_to_link_bs_sub
60
- do_test_convert_to_link("\TestPage/TestSubPage")
61
- end
62
-
63
- def test_convert_to_link_fs_sub
64
- do_test_convert_to_link("/TestPage/TestSubPage")
65
- end
66
-
67
- def test_convert_to_link_fs_sub_sub
68
- do_test_convert_to_link("/TestPage/TestSubPage\NotherSubPage")
69
- end
70
-
71
- def test_convert_to_link_fs_sub_sub2
72
- do_test_convert_to_link("/TestPage/TestSubPage/NotherSubPage")
73
- end
74
-
75
- def test_convert_to_link_collapse_path
76
- do_test_convert_to_link("TestSubPage/NotherSubPage", "/TestPage/TestSubPage")
77
- do_test_convert_to_link("SubPage/NotherSubPage", "/TestPage/SubPage/SubPage")
22
+ ClWiki::Page.new('NewPage')
78
23
  end
79
24
 
80
25
  def test_gsub_words
81
26
  original =
82
- 'test page PageName ' +
83
- 'PageName/SubPage PageName\SubPage\SubPage ' +
84
- '/PageName/SubPage \PageName\SubPage\SubPage ' +
85
- 'test.thing test, <tagger> </tagger> oops>whoops ' +
86
- 'oops<thing>bleh hen<butter '
27
+ 'test page PageName ' \
28
+ 'PageName/SubPage PageName\SubPage\SubPage ' \
29
+ '/PageName/SubPage \PageName\SubPage\SubPage ' \
30
+ 'test.thing test, <tagger> </tagger> oops>whoops ' \
31
+ 'oops<thing>bleh hen<butter '
87
32
 
88
33
  expected_results =
89
- %w(test page PageName
90
- PageName SubPage PageName SubPage SubPage PageName SubPage PageName SubPage SubPage
91
- test thing test <tagger> </tagger> oops whoops
92
- oops <thing> bleh hen butter)
34
+ %w[test page PageName
35
+ PageName SubPage PageName SubPage SubPage PageName SubPage PageName SubPage SubPage
36
+ test thing test <tagger> </tagger> oops whoops
37
+ oops <thing> bleh hen butter]
93
38
 
94
- actual_results = Array.new
39
+ actual_results = []
95
40
  f = ClWiki::PageFormatter.new(original)
96
- f.gsubWords { |word| actual_results << word }
41
+ f.gsub_words { |word| actual_results << word }
97
42
  assert_equal(expected_results, actual_results)
98
43
  end
99
44
 
100
- def do_test_format_links(content, expected_content, page_exists=true)
45
+ def do_test_format_links(content, expected_content, page_exists = true)
101
46
  $wiki_conf.editable = true
102
47
  f = ClWiki::PageFormatter.new(content, nil)
103
48
  ClWiki::Page.set_page_exists(page_exists)
104
- assert_equal(expected_content, f.formatLinks, "content: #{content} page_exists: #{page_exists} editable")
49
+ assert_equal(expected_content, f.format_links, "content: #{content} page_exists: #{page_exists} editable")
105
50
 
106
51
  $wiki_conf.editable = false
107
52
  f = ClWiki::PageFormatter.new(content, nil)
108
53
  ClWiki::Page.set_page_exists(page_exists)
109
54
  if page_exists
110
- assert_equal(expected_content, f.formatLinks, "content: #{content} page_exists: #{page_exists} not editable")
55
+ assert_equal(expected_content, f.format_links, "content: #{content} page_exists: #{page_exists} not editable")
111
56
  else
112
- assert_equal(content, f.formatLinks, "content: #{content} page_exists: #{page_exists} not editable")
57
+ assert_equal(content, f.format_links, "content: #{content} page_exists: #{page_exists} not editable")
113
58
  end
114
59
  end
115
60
 
@@ -126,7 +71,7 @@ class TestClWikiPage < TestBase
126
71
  # are returned intact. IE 5 just ignores them.
127
72
  # In the future I need to code no wiki links within
128
73
  # brackets which means parsing them.
129
- do_test_format_links('<NoWikiLinks>TestPage</NoWikiLinks>', "TestPage")
74
+ do_test_format_links('<NoWikiLinks>TestPage</NoWikiLinks>', 'TestPage')
130
75
 
131
76
  # No WikiLinks within < >, to avoid problems with href
132
77
  do_test_format_links('<a href="www.NotAWikiPage.com">some link</a>', '<a href="www.NotAWikiPage.com">some link</a>')
@@ -139,24 +84,24 @@ class TestClWikiPage < TestBase
139
84
 
140
85
  def test_is_wiki_name
141
86
  f = ClWiki::PageFormatter.new
142
- assert(f.is_wiki_name?("WikiName"))
143
- assert(!f.is_wiki_name?("WikiName,"))
144
- assert(!f.is_wiki_name?("Wikiname"))
145
- assert(!f.is_wiki_name?("wIkiName"))
146
- assert(!f.is_wiki_name?("<h1>wikiName</h1><br>Other"))
147
- assert(!f.is_wiki_name?("<WikiName>"))
148
- assert(!f.is_wiki_name?("WIKI"))
149
- assert(f.is_wiki_name?('WikiName/SubWikiName'))
150
- assert(f.is_wiki_name?('WikiName\SubWikiName'))
151
- assert(f.is_wiki_name?('/WikiName/SubWikiName'))
152
- assert(!f.is_wiki_name?('./WikiName/SubWikiName'))
153
- assert(!f.is_wiki_name?('/.WikiName/SubWikiName'))
154
- assert(!f.is_wiki_name?('/Wiki.Name/SubWikiName'))
155
- assert(!f.is_wiki_name?('WikiName/Notwikiname'))
156
- assert(!f.is_wiki_name?('Notwikiname/WikiName'))
157
- assert(!f.is_wiki_name?('WikiName/WikiName/Notwikiname'))
158
- assert(!f.is_wiki_name?('/'))
159
- assert(!f.is_wiki_name?('//'))
87
+ assert(f.is_wiki_name?('WikiName'))
88
+ assert(f.is_wiki_name?('YoYo'))
89
+ refute(f.is_wiki_name?('Wikiname'))
90
+ refute(f.is_wiki_name?('wIkiName'))
91
+ refute(f.is_wiki_name?('<h1>wikiName</h1><br>Other'))
92
+ refute(f.is_wiki_name?('<WikiName>'))
93
+ refute(f.is_wiki_name?('WIKI'))
94
+ refute(f.is_wiki_name?('WikiName/SubWikiName'))
95
+ refute(f.is_wiki_name?('WikiName\SubWikiName'))
96
+ refute(f.is_wiki_name?('/WikiName/SubWikiName'))
97
+ refute(f.is_wiki_name?('./WikiName/SubWikiName'))
98
+ refute(f.is_wiki_name?('/.WikiName/SubWikiName'))
99
+ refute(f.is_wiki_name?('/Wiki.Name/SubWikiName'))
100
+ refute(f.is_wiki_name?('WikiName/Notwikiname'))
101
+ refute(f.is_wiki_name?('Notwikiname/WikiName'))
102
+ refute(f.is_wiki_name?('WikiName/WikiName/Notwikiname'))
103
+ refute(f.is_wiki_name?('/'))
104
+ refute(f.is_wiki_name?('//'))
160
105
  end
161
106
 
162
107
  def test_custom_formatter
@@ -167,10 +112,9 @@ class TestClWikiPage < TestBase
167
112
 
168
113
  def test_custom_formatter_path_config
169
114
  Dir.mktmpdir do |dir|
170
- begin
171
- $wiki_conf.custom_formatter_load_path << dir
172
- File.open(File.join(dir, 'format.reverser.rb'), 'w') do |f|
173
- f.print <<-RUBY
115
+ $wiki_conf.custom_formatter_load_path << dir
116
+ File.open(File.join(dir, 'format.reverser.rb'), 'w') do |f|
117
+ f.print <<-RUBY
174
118
  class ReverseText < ClWiki::CustomFormatter
175
119
  def ReverseText.match_re
176
120
  /.*/
@@ -184,62 +128,41 @@ class TestClWikiPage < TestBase
184
128
  end
185
129
 
186
130
  ClWiki::CustomFormatters.instance.register(ReverseText)
187
- RUBY
188
- end
189
- page = ClWiki::Page.new('RevPage')
190
- page.update_content("awesome", page.mtime)
191
- assert_match(/emosewa/, page.read_content(false))
192
- ensure
193
- ClWiki::CustomFormatters.instance.unregister(ReverseText)
194
- Object.send(:remove_const, :ReverseText)
195
- $wiki_conf.custom_formatter_load_path.delete(dir)
131
+ RUBY
196
132
  end
133
+ page = ClWiki::Page.new('RevPage')
134
+ page.update_content('awesome', page.mtime)
135
+ assert_match(/emosewa/, page.read_content(false))
136
+ ensure
137
+ ClWiki::CustomFormatters.instance.unregister(ReverseText)
138
+ Object.send(:remove_const, :ReverseText)
139
+ $wiki_conf.custom_formatter_load_path.delete(dir)
197
140
  end
198
141
  end
142
+
143
+ def test_encrypted_content
144
+ page = ClWiki::Page.new('NewEncryptedPage', wiki_path: @test_wiki_path, owner: EncryptingUser.new)
145
+ page.update_content('my new content', Time.now, true)
146
+ assert_match(/my new content/, page.read_content(false))
147
+ refute_match(/new content/, File.read(page.file_full_path_and_name, mode: 'rb'))
148
+ end
199
149
  end
200
150
 
201
151
  class TestClWikiPageFormatter < TestBase
202
152
  def test_only_html
203
153
  assert(ClWiki::PageFormatter.only_html('<tag>'))
204
- assert(!ClWiki::PageFormatter.only_html('<tag'))
205
- assert(!ClWiki::PageFormatter.only_html('tag>'))
206
- assert(!ClWiki::PageFormatter.only_html('tag'))
207
- assert(!ClWiki::PageFormatter.only_html(''))
208
- assert(!ClWiki::PageFormatter.only_html(' '))
154
+ refute(ClWiki::PageFormatter.only_html('<tag'))
155
+ refute(ClWiki::PageFormatter.only_html('tag>'))
156
+ refute(ClWiki::PageFormatter.only_html('tag'))
157
+ refute(ClWiki::PageFormatter.only_html(''))
158
+ refute(ClWiki::PageFormatter.only_html(' '))
209
159
  assert(ClWiki::PageFormatter.only_html(' < t a g > '))
210
- assert(!ClWiki::PageFormatter.only_html('<t>a<g>'))
160
+ refute(ClWiki::PageFormatter.only_html('<t>a<g>'))
211
161
 
212
162
  # if this passes, method is misnamed, now
213
- assert( ClWiki::PageFormatter.only_html('<h1>a</h1>'))
214
- assert( ClWiki::PageFormatter.only_html(' <h5> a </h5> '))
215
- assert( ClWiki::PageFormatter.only_html(' <h5> <a href> </h5> '))
216
- assert(!ClWiki::PageFormatter.only_html(' <h5> <a href> </h5> stuff '))
217
- end
218
- end
219
-
220
- class TestGlobalHitReducer < TestBase
221
- def test_global_hit_reducer
222
- # for global links, we want matches to be limited to exact matches.
223
- # If //RootPage/SubPage has seven children:
224
- #
225
- # //RootPage/SubPage/ChildOne
226
- # //RootPage/SubPage/ChildTwo
227
- # ...
228
- #
229
- # and the content is SubPage, we don't want a global link to the
230
- # find results of SubPage, but a direct link to //RootPage/SubPage.
231
- # If there's also a //OtherPage/SubPage, then the global link in this
232
- # case will still go to Find Results.
233
-
234
- hits = ['//RootPage/SubPage', '//RootPage/SubPage/ChildOne']
235
- reduced = ClWiki::GlobalHitReducer.reduce_to_exact_if_exists('SubPage', hits)
236
- assert_equal(['//RootPage/SubPage'], reduced)
237
-
238
- reduced = ClWiki::GlobalHitReducer.reduce_to_exact_if_exists('SubPa', hits)
239
- assert_equal(hits, reduced)
240
-
241
- hits = ['//RootPage/SubPage', '//OtherPage/SubPage']
242
- reduced = ClWiki::GlobalHitReducer.reduce_to_exact_if_exists('SubPage', hits)
243
- assert_equal(hits, reduced)
163
+ assert(ClWiki::PageFormatter.only_html('<h1>a</h1>'))
164
+ assert(ClWiki::PageFormatter.only_html(' <h5> a </h5> '))
165
+ assert(ClWiki::PageFormatter.only_html(' <h5> <a href> </h5> '))
166
+ refute(ClWiki::PageFormatter.only_html(' <h5> <a href> </h5> stuff '))
244
167
  end
245
168
  end