proclaim 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (265) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +6 -0
  3. data/Gemfile +14 -0
  4. data/LICENSE +674 -0
  5. data/README.md +137 -0
  6. data/Rakefile +65 -0
  7. data/VERSION +1 -0
  8. data/app/assets/images/ajax_loader.gif +0 -0
  9. data/app/assets/javascripts/proclaim.js +18 -0
  10. data/app/assets/javascripts/proclaim/comments_handler.js.coffee +192 -0
  11. data/app/assets/javascripts/proclaim/editor.js.coffee +50 -0
  12. data/app/assets/javascripts/proclaim/images.js.coffee +3 -0
  13. data/app/assets/javascripts/proclaim/subscriptions.js.coffee +3 -0
  14. data/app/assets/stylesheets/proclaim.css.scss +28 -0
  15. data/app/assets/stylesheets/proclaim/comments.css.scss +14 -0
  16. data/app/assets/stylesheets/proclaim/images.scss +3 -0
  17. data/app/assets/stylesheets/proclaim/posts.css.scss +77 -0
  18. data/app/assets/stylesheets/proclaim/subscriptions.css.scss +3 -0
  19. data/app/controllers/proclaim/application_controller.rb +44 -0
  20. data/app/controllers/proclaim/comments_controller.rb +128 -0
  21. data/app/controllers/proclaim/images_controller.rb +108 -0
  22. data/app/controllers/proclaim/posts_controller.rb +131 -0
  23. data/app/controllers/proclaim/subscriptions_controller.rb +67 -0
  24. data/app/helpers/proclaim/application_helper.rb +34 -0
  25. data/app/helpers/proclaim/comments_helper.rb +4 -0
  26. data/app/helpers/proclaim/images_helper.rb +4 -0
  27. data/app/helpers/proclaim/posts_helper.rb +4 -0
  28. data/app/helpers/proclaim/subscriptions_helper.rb +4 -0
  29. data/app/mailers/proclaim/subscription_mailer.rb +43 -0
  30. data/app/models/proclaim/comment.rb +35 -0
  31. data/app/models/proclaim/image.rb +19 -0
  32. data/app/models/proclaim/post.rb +133 -0
  33. data/app/models/proclaim/subscription.rb +63 -0
  34. data/app/policies/application_policy.rb +53 -0
  35. data/app/policies/proclaim/comment_policy.rb +27 -0
  36. data/app/policies/proclaim/image_policy.rb +29 -0
  37. data/app/policies/proclaim/post_policy.rb +38 -0
  38. data/app/policies/proclaim/subscription_policy.rb +32 -0
  39. data/app/uploaders/proclaim/image_uploader.rb +82 -0
  40. data/app/views/layouts/proclaim/subscription_mailer.html.erb +133 -0
  41. data/app/views/proclaim/comments/_comment.html.erb +33 -0
  42. data/app/views/proclaim/comments/_form.html.erb +51 -0
  43. data/app/views/proclaim/posts/_form.html.erb +67 -0
  44. data/app/views/proclaim/posts/edit.html.erb +3 -0
  45. data/app/views/proclaim/posts/index.html.erb +30 -0
  46. data/app/views/proclaim/posts/new.html.erb +3 -0
  47. data/app/views/proclaim/posts/show.html.erb +46 -0
  48. data/app/views/proclaim/subscription_mailer/new_comment_notification_email.html.erb +11 -0
  49. data/app/views/proclaim/subscription_mailer/new_post_notification_email.html.erb +15 -0
  50. data/app/views/proclaim/subscription_mailer/welcome_email.html.erb +25 -0
  51. data/app/views/proclaim/subscriptions/_form.html.erb +32 -0
  52. data/app/views/proclaim/subscriptions/new.html.erb +8 -0
  53. data/app/views/proclaim/subscriptions/subscribed.html.erb +7 -0
  54. data/app/views/proclaim/subscriptions/unsubscribe.html.erb +7 -0
  55. data/app/views/proclaim/subscriptions/unsubscribed.html.erb +3 -0
  56. data/config/routes.rb +18 -0
  57. data/db/migrate/20141108222616_create_proclaim_posts.rb +15 -0
  58. data/db/migrate/20141114235359_create_proclaim_comments.rb +15 -0
  59. data/db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb +26 -0
  60. data/db/migrate/20141210234057_create_proclaim_subscriptions.rb +17 -0
  61. data/db/migrate/20141222224905_create_proclaim_images.rb +12 -0
  62. data/lib/generators/proclaim/install_generator.rb +23 -0
  63. data/lib/generators/proclaim/templates/README +27 -0
  64. data/lib/generators/proclaim/templates/initialize_proclaim.rb +22 -0
  65. data/lib/generators/proclaim/views_generator.rb +24 -0
  66. data/lib/proclaim.rb +22 -0
  67. data/lib/proclaim/engine.rb +39 -0
  68. data/lib/proclaim/version.rb +3 -0
  69. data/lib/tasks/proclaim_tasks.rake +4 -0
  70. data/proclaim.gemspec +46 -0
  71. data/test/controllers/proclaim/comments_controller_test.rb +228 -0
  72. data/test/controllers/proclaim/images_controller_test.rb +123 -0
  73. data/test/controllers/proclaim/posts_controller_test.rb +303 -0
  74. data/test/controllers/proclaim/subscriptions_controller_test.rb +93 -0
  75. data/test/dummy/README.rdoc +28 -0
  76. data/test/dummy/Rakefile +6 -0
  77. data/test/dummy/app/assets/javascripts/application.js +14 -0
  78. data/test/dummy/app/assets/stylesheets/application.css +16 -0
  79. data/test/dummy/app/controllers/application_controller.rb +15 -0
  80. data/test/dummy/app/helpers/application_helper.rb +28 -0
  81. data/test/dummy/app/models/user.rb +7 -0
  82. data/test/dummy/app/views/layouts/application.html.erb +16 -0
  83. data/test/dummy/bin/bundle +3 -0
  84. data/test/dummy/bin/rails +4 -0
  85. data/test/dummy/bin/rake +4 -0
  86. data/test/dummy/config.ru +4 -0
  87. data/test/dummy/config/application.rb +24 -0
  88. data/test/dummy/config/boot.rb +5 -0
  89. data/test/dummy/config/database.yml +25 -0
  90. data/test/dummy/config/environment.rb +5 -0
  91. data/test/dummy/config/environments/development.rb +45 -0
  92. data/test/dummy/config/environments/production.rb +80 -0
  93. data/test/dummy/config/environments/test.rb +49 -0
  94. data/test/dummy/config/initializers/assets.rb +8 -0
  95. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  96. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  97. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  98. data/test/dummy/config/initializers/inflections.rb +16 -0
  99. data/test/dummy/config/initializers/mime_types.rb +4 -0
  100. data/test/dummy/config/initializers/session_store.rb +3 -0
  101. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  102. data/test/dummy/config/locales/en.yml +23 -0
  103. data/test/dummy/config/routes.rb +5 -0
  104. data/test/dummy/config/secrets.yml +22 -0
  105. data/test/dummy/db/migrate/20141117214323_create_users.rb +10 -0
  106. data/test/dummy/db/schema.rb +75 -0
  107. data/test/dummy/log/development.log +131 -0
  108. data/test/dummy/log/test.log +25961 -0
  109. data/test/dummy/public/404.html +67 -0
  110. data/test/dummy/public/422.html +67 -0
  111. data/test/dummy/public/500.html +66 -0
  112. data/test/dummy/public/favicon.ico +0 -0
  113. data/test/dummy/tmp/cache/assets/test/sass/0b69f7cc441d56def3a51688e6a7a8474dc476d1/proclaim.css.scssc +0 -0
  114. data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/comments.css.scssc +0 -0
  115. data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/images.scssc +0 -0
  116. data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/posts.css.scssc +0 -0
  117. data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/subscriptions.css.scssc +0 -0
  118. data/test/dummy/tmp/cache/assets/test/sprockets/04adcece63bc645379e6de797e7998f8 +0 -0
  119. data/test/dummy/tmp/cache/assets/test/sprockets/06620fc450f0a9b4a482a7bc08387711 +0 -0
  120. data/test/dummy/tmp/cache/assets/test/sprockets/076dd0d567a92c34163b3b98af1d48ba +0 -0
  121. data/test/dummy/tmp/cache/assets/test/sprockets/09fc2eadf6d6062b2cc135a44e4e73db +0 -0
  122. data/test/dummy/tmp/cache/assets/test/sprockets/09fe8c62e8ae706e01058b4b4d056c8e +0 -0
  123. data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  124. data/test/dummy/tmp/cache/assets/test/sprockets/142fd040033525acb73ad2ccf1406aea +0 -0
  125. data/test/dummy/tmp/cache/assets/test/sprockets/1762aeeaf38da3b8d989a5b66b088004 +0 -0
  126. data/test/dummy/tmp/cache/assets/test/sprockets/194ac1a695334e303516614579b3926d +0 -0
  127. data/test/dummy/tmp/cache/assets/test/sprockets/197ea008934db3e7ea8045302d206b92 +0 -0
  128. data/test/dummy/tmp/cache/assets/test/sprockets/19eba2635fec0895379c3e38f81ada84 +0 -0
  129. data/test/dummy/tmp/cache/assets/test/sprockets/1c2ebe72fcd7ff1379a561552ca30f85 +0 -0
  130. data/test/dummy/tmp/cache/assets/test/sprockets/1f42c80faacb651f670ec2b0998e49dc +0 -0
  131. data/test/dummy/tmp/cache/assets/test/sprockets/2243230e778a749ecbf0415a52e75be0 +0 -0
  132. data/test/dummy/tmp/cache/assets/test/sprockets/23ad87e715c70312aa61dde4fbb4bfe1 +0 -0
  133. data/test/dummy/tmp/cache/assets/test/sprockets/245b8735db4ea90bcaa91c011a1f447e +0 -0
  134. data/test/dummy/tmp/cache/assets/test/sprockets/26a42dac0cec64483f4126d2de4b0c9e +0 -0
  135. data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  136. data/test/dummy/tmp/cache/assets/test/sprockets/30151c8f6d93717f06fa12774612ddf4 +0 -0
  137. data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  138. data/test/dummy/tmp/cache/assets/test/sprockets/3c623d200214a5334aaf170537db087f +0 -0
  139. data/test/dummy/tmp/cache/assets/test/sprockets/3ec36650a50759fd4b75794cb253936f +0 -0
  140. data/test/dummy/tmp/cache/assets/test/sprockets/40431cdcc10c75ba1f275ecfe42623d3 +0 -0
  141. data/test/dummy/tmp/cache/assets/test/sprockets/4226218a4b06608115b21063353370ea +0 -0
  142. data/test/dummy/tmp/cache/assets/test/sprockets/437901953eb8707af6c27ca59cf65d91 +0 -0
  143. data/test/dummy/tmp/cache/assets/test/sprockets/461885b8ad31ef6a94c9a4f2e332b7eb +0 -0
  144. data/test/dummy/tmp/cache/assets/test/sprockets/4792f46317cda92ccd5b278ec61f9ac5 +0 -0
  145. data/test/dummy/tmp/cache/assets/test/sprockets/4dcb3434b91b1c62f897a1741c6d398b +0 -0
  146. data/test/dummy/tmp/cache/assets/test/sprockets/5101cda93cf70f0fc0837713be587780 +0 -0
  147. data/test/dummy/tmp/cache/assets/test/sprockets/52d8c61de0703e0d7cf97d0f7b0cca7a +0 -0
  148. data/test/dummy/tmp/cache/assets/test/sprockets/57f3d19a9bd484ac68c46f962a8684b2 +0 -0
  149. data/test/dummy/tmp/cache/assets/test/sprockets/587e7c1332c8d8b69746dd85164e2cef +0 -0
  150. data/test/dummy/tmp/cache/assets/test/sprockets/5934d5d0d1ac6657842708e85c73cf51 +0 -0
  151. data/test/dummy/tmp/cache/assets/test/sprockets/5af081799d7da2f04ead6a516c6015ad +0 -0
  152. data/test/dummy/tmp/cache/assets/test/sprockets/69ee5af8d9a655898a67bc538ca1c7e7 +0 -0
  153. data/test/dummy/tmp/cache/assets/test/sprockets/6d1c56259648b0383bc438c875a448c3 +0 -0
  154. data/test/dummy/tmp/cache/assets/test/sprockets/6e7de35055967df848aa490830043e51 +0 -0
  155. data/test/dummy/tmp/cache/assets/test/sprockets/70bc59560ee544af7bb2f727247db307 +0 -0
  156. data/test/dummy/tmp/cache/assets/test/sprockets/728cb566999910549092ff0a98e2853b +0 -0
  157. data/test/dummy/tmp/cache/assets/test/sprockets/72b5f0d35e9d69b744a156edad98f983 +0 -0
  158. data/test/dummy/tmp/cache/assets/test/sprockets/72ffa34d552e3fd02f28a6f845a5ac5b +0 -0
  159. data/test/dummy/tmp/cache/assets/test/sprockets/7369d324e84bc872c42b3e717ff4ad6c +0 -0
  160. data/test/dummy/tmp/cache/assets/test/sprockets/749a8b0e45b11df748a256dd04ceb1f7 +0 -0
  161. data/test/dummy/tmp/cache/assets/test/sprockets/77fb9f62552d9b786f9407ef11cc9a09 +0 -0
  162. data/test/dummy/tmp/cache/assets/test/sprockets/797823842565e01fc989ad8df0bd4254 +0 -0
  163. data/test/dummy/tmp/cache/assets/test/sprockets/7c139afa2296ac17483520109aecd449 +0 -0
  164. data/test/dummy/tmp/cache/assets/test/sprockets/7fb99e2b35af65c4f58bfb92dd4185b4 +0 -0
  165. data/test/dummy/tmp/cache/assets/test/sprockets/819de31c63b704f9ddf4865587a91d41 +0 -0
  166. data/test/dummy/tmp/cache/assets/test/sprockets/8604b464bf846e5223da37ef2f29b524 +0 -0
  167. data/test/dummy/tmp/cache/assets/test/sprockets/88fc815613b473e98e9307b1d423918d +0 -0
  168. data/test/dummy/tmp/cache/assets/test/sprockets/8bc4341aa4060b8646e8134722cf3b11 +0 -0
  169. data/test/dummy/tmp/cache/assets/test/sprockets/8cf8fd5ff8eae12211a88f971af30236 +0 -0
  170. data/test/dummy/tmp/cache/assets/test/sprockets/8da3b4a9f17aafff49eb263bdb758f44 +0 -0
  171. data/test/dummy/tmp/cache/assets/test/sprockets/9168e513bae02f041dbb806d6dbe94ac +0 -0
  172. data/test/dummy/tmp/cache/assets/test/sprockets/920c1322be1212a54b7c4f2751d5e7bf +0 -0
  173. data/test/dummy/tmp/cache/assets/test/sprockets/92205679a36afd387a2ba5c585a5a62c +0 -0
  174. data/test/dummy/tmp/cache/assets/test/sprockets/940566ebcae2d4e5c56a881ab66f2cf0 +0 -0
  175. data/test/dummy/tmp/cache/assets/test/sprockets/976967e07e2944a7ecc7403667f1f96b +0 -0
  176. data/test/dummy/tmp/cache/assets/test/sprockets/99bdde70cefa71745279232be575f14e +0 -0
  177. data/test/dummy/tmp/cache/assets/test/sprockets/9a8e402a7e32063e46647403b43553a5 +0 -0
  178. data/test/dummy/tmp/cache/assets/test/sprockets/9b09ad72f8cc33503878b01c713d92d0 +0 -0
  179. data/test/dummy/tmp/cache/assets/test/sprockets/a20dbdfebf37fe50e832a6273c972553 +0 -0
  180. data/test/dummy/tmp/cache/assets/test/sprockets/a3c6189fad6cb9ae955f6d5a43a61d51 +0 -0
  181. data/test/dummy/tmp/cache/assets/test/sprockets/abb54e11ff057a3e22a5a97d27cc4fa3 +0 -0
  182. data/test/dummy/tmp/cache/assets/test/sprockets/ad18e3875541d4298b1df133d494b93f +0 -0
  183. data/test/dummy/tmp/cache/assets/test/sprockets/b9b7c575c22943d49734d52381c5ee16 +0 -0
  184. data/test/dummy/tmp/cache/assets/test/sprockets/ba269a52f100d3d6cffda81e82e1ed49 +0 -0
  185. data/test/dummy/tmp/cache/assets/test/sprockets/bc7a0846b4881b0832d41de2b1724dba +0 -0
  186. data/test/dummy/tmp/cache/assets/test/sprockets/bcb2df87f9611d3cc3ef8a5575e54fb8 +0 -0
  187. data/test/dummy/tmp/cache/assets/test/sprockets/bcf33791d3286af3ba2cdf6a6756c89e +0 -0
  188. data/test/dummy/tmp/cache/assets/test/sprockets/be32d0a530ce861537d6abfa41333df9 +0 -0
  189. data/test/dummy/tmp/cache/assets/test/sprockets/c8270a6f07dccc5f00e6b2b43f10efd2 +0 -0
  190. data/test/dummy/tmp/cache/assets/test/sprockets/cd82cd410a50bffcfb6e21e3c49a85c9 +0 -0
  191. data/test/dummy/tmp/cache/assets/test/sprockets/ce4ccaa06bdee6426486224bc7e54187 +0 -0
  192. data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  193. data/test/dummy/tmp/cache/assets/test/sprockets/d0bdb8592e4eed80aa2341e37f20dbc9 +0 -0
  194. data/test/dummy/tmp/cache/assets/test/sprockets/d4b784b16fa1b1dfcca6590689a8c157 +0 -0
  195. data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  196. data/test/dummy/tmp/cache/assets/test/sprockets/d968bd38a69bbf5c0065e2df3d30cfd3 +0 -0
  197. data/test/dummy/tmp/cache/assets/test/sprockets/daa4d4b8a5ce46d6c4ecf031e0c61cfe +0 -0
  198. data/test/dummy/tmp/cache/assets/test/sprockets/dc2effd195334219a7e4acfdc7ec7974 +0 -0
  199. data/test/dummy/tmp/cache/assets/test/sprockets/de36ab6c3b1a9b62a586d98373dd569c +0 -0
  200. data/test/dummy/tmp/cache/assets/test/sprockets/e3aec457d5c753090d6521f2bb2d91b6 +0 -0
  201. data/test/dummy/tmp/cache/assets/test/sprockets/e8d6158b1fed2f574242b55856a3953d +0 -0
  202. data/test/dummy/tmp/cache/assets/test/sprockets/ea82f6aececcf81eef3e2e15a9225e66 +0 -0
  203. data/test/dummy/tmp/cache/assets/test/sprockets/ed9f5c17f71ec75de10b1bb029ebd7a2 +0 -0
  204. data/test/dummy/tmp/cache/assets/test/sprockets/f2984adaeaa5322e3a040705c6d40622 +0 -0
  205. data/test/dummy/tmp/cache/assets/test/sprockets/f62fd0cf9f5e7e077ec9c4daeccb06ae +0 -0
  206. data/test/dummy/tmp/cache/assets/test/sprockets/f78ea69bdbba5738c052e9eb04e6c208 +0 -0
  207. data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  208. data/test/dummy/tmp/cache/assets/test/sprockets/f864e553f706456dbdf168319970ec2e +0 -0
  209. data/test/dummy/tmp/cache/assets/test/sprockets/fb0f641bfcbb0101c040da9ff736447b +0 -0
  210. data/test/dummy/tmp/cache/assets/test/sprockets/fe426a44cf23cf82032091cbffff898c +0 -0
  211. data/test/dummy/tmp/cache/assets/test/sprockets/ff732ea47a86c449582b2a81ef2930da +0 -0
  212. data/test/dummy/tmp/cache/assets/test/sprockets/ffc4980851addaacf12abeebfa63e07f +0 -0
  213. data/test/dummy/tmp/generators/config/initializers/proclaim.rb +22 -0
  214. data/test/factories/proclaim/comment.rb +11 -0
  215. data/test/factories/proclaim/image.rb +6 -0
  216. data/test/factories/proclaim/post.rb +14 -0
  217. data/test/factories/proclaim/subscription.rb +13 -0
  218. data/test/factories/user.rb +6 -0
  219. data/test/helpers/proclaim/comments_helper_test.rb +6 -0
  220. data/test/helpers/proclaim/posts_helper_test.rb +6 -0
  221. data/test/helpers/proclaim/subscriptions_helper_test.rb +6 -0
  222. data/test/integration/with_javascript/comment_test.rb +353 -0
  223. data/test/integration/with_javascript/post_form_test.rb +179 -0
  224. data/test/integration/with_javascript/post_subscription_test.rb +273 -0
  225. data/test/integration/without_javascript/blog_subscription_test.rb +87 -0
  226. data/test/integration/without_javascript/post_test.rb +140 -0
  227. data/test/integration/without_javascript/subscription_email_test.rb +95 -0
  228. data/test/integration/without_javascript/unsubscribe_test.rb +32 -0
  229. data/test/mailers/previews/proclaim/subscription_mailer_preview.rb +22 -0
  230. data/test/mailers/proclaim/subscription_mailer_test.rb +87 -0
  231. data/test/models/proclaim/comment_test.rb +41 -0
  232. data/test/models/proclaim/image_test.rb +70 -0
  233. data/test/models/proclaim/post_test.rb +127 -0
  234. data/test/models/proclaim/subscription_test.rb +66 -0
  235. data/test/policies/proclaim/comment_policy_test.rb +71 -0
  236. data/test/policies/proclaim/post_policy_test.rb +87 -0
  237. data/test/policies/proclaim/subscription_policy_test.rb +91 -0
  238. data/test/proclaim_test.rb +7 -0
  239. data/test/support/images/test.jpg +0 -0
  240. data/test/support/pages/posts/edit_page.rb +5 -0
  241. data/test/support/pages/posts/show_page.rb +47 -0
  242. data/test/support/wait_for_ajax.rb +11 -0
  243. data/test/test_helper.rb +56 -0
  244. data/vendor/assets/images/link.png +0 -0
  245. data/vendor/assets/images/remove.png +0 -0
  246. data/vendor/assets/images/resize-bigger.png +0 -0
  247. data/vendor/assets/images/resize-smaller.png +0 -0
  248. data/vendor/assets/images/unlink.png +0 -0
  249. data/vendor/assets/javascripts/addons/medium-editor-insert-embeds.js +197 -0
  250. data/vendor/assets/javascripts/addons/medium-editor-insert-embeds.min.js +10 -0
  251. data/vendor/assets/javascripts/addons/medium-editor-insert-images.js +572 -0
  252. data/vendor/assets/javascripts/addons/medium-editor-insert-images.min.js +10 -0
  253. data/vendor/assets/javascripts/addons/medium-editor-insert-maps.js +50 -0
  254. data/vendor/assets/javascripts/addons/medium-editor-insert-maps.min.js +10 -0
  255. data/vendor/assets/javascripts/addons/medium-editor-insert-plugin.js +496 -0
  256. data/vendor/assets/javascripts/addons/medium-editor-insert-plugin.min.js +10 -0
  257. data/vendor/assets/javascripts/addons/medium-editor-insert-tables.js +132 -0
  258. data/vendor/assets/javascripts/addons/medium-editor-insert-tables.min.js +10 -0
  259. data/vendor/assets/javascripts/medium-editor-insert-plugin.all.js +1415 -0
  260. data/vendor/assets/javascripts/medium-editor-insert-plugin.all.min.js +10 -0
  261. data/vendor/assets/stylesheets/medium-editor-insert-plugin-frontend.css +55 -0
  262. data/vendor/assets/stylesheets/medium-editor-insert-plugin-frontend.min.css +10 -0
  263. data/vendor/assets/stylesheets/medium-editor-insert-plugin.css +277 -0
  264. data/vendor/assets/stylesheets/medium-editor-insert-plugin.min.css +10 -0
  265. metadata +791 -0
@@ -0,0 +1,179 @@
1
+ require 'test_helper'
2
+
3
+ class PostFormTest < ActionDispatch::IntegrationTest
4
+ include WaitForAjax
5
+ self.use_transactional_fixtures = false
6
+
7
+ setup do
8
+ ApplicationController.any_instance.stubs(:current_user).returns(nil)
9
+ ApplicationController.any_instance.stubs(:authenticate_user).returns(false)
10
+
11
+ DatabaseCleaner.strategy = :truncation
12
+ DatabaseCleaner.start
13
+
14
+ Capybara.current_driver = :selenium
15
+
16
+ @edit_page = EditPage.new
17
+ end
18
+
19
+ teardown do
20
+ DatabaseCleaner.clean
21
+ Capybara.use_default_driver
22
+
23
+ image = Proclaim::Image.new
24
+ FileUtils.rm_rf(File.join(Rails.public_path, image.image.cache_dir))
25
+ FileUtils.rm_rf(File.join(Rails.public_path, image.image.store_dir))
26
+ end
27
+
28
+ test "should create post" do
29
+ user = FactoryGirl.create(:user)
30
+ sign_in user
31
+
32
+ visit proclaim.new_post_path
33
+
34
+ within('#new_post') do
35
+ element = find('h1.editable')
36
+ element.click()
37
+ element.set("Post Title") # Set the title text
38
+ element = find('div.editable')
39
+ element.click() # Select the element
40
+ element.set("Paragraph 1\nParagraph 2") # Set the body text
41
+ end
42
+
43
+ assert_difference('Proclaim::Post.count') do
44
+ click_button "Create"
45
+ assert page.has_text? "Post Title"
46
+ assert page.has_text? "Paragraph 1\nParagraph 2"
47
+ wait_for_ajax
48
+ end
49
+ end
50
+
51
+ test "should delete cached image" do
52
+ user = FactoryGirl.create(:user)
53
+ sign_in user
54
+
55
+ image = FactoryGirl.build(:image, post: nil)
56
+ post = FactoryGirl.create(:post, body: @edit_page.medium_inserted_image_html(image))
57
+
58
+ cache_file_path = File.join(Rails.public_path, image.image.cache_dir, image.image.cache_name)
59
+ cache_path = File.dirname(cache_file_path)
60
+
61
+ assert File.exist?(cache_file_path), "File should have been cached: #{cache_file_path}"
62
+
63
+ visit proclaim.edit_post_path(post)
64
+
65
+ find("img[src='#{image.image.url}']").hover
66
+ find("a.mediumInsert-imageRemove").click
67
+
68
+ assert page.has_no_css?("img[src='#{image.image.url}']"), "Image should have been removed!"
69
+
70
+ wait_for_ajax
71
+
72
+ refute File.exist?(cache_file_path), "Should have removed cache file: #{cache_file_path}"
73
+ refute File.exist?(cache_path), "Should have removed cache path: #{cache_path}"
74
+ end
75
+
76
+ test "should delete saved image" do
77
+ user = FactoryGirl.create(:user)
78
+ sign_in user
79
+
80
+ image = FactoryGirl.create(:image)
81
+ image.post.body = "<p>test</p>" + @edit_page.medium_inserted_image_html(image)
82
+ image.post.save
83
+
84
+ save_path = File.join(Rails.public_path, image.image.store_dir)
85
+ saved_file_path = File.join(save_path, image.image_identifier)
86
+
87
+ assert File.exist?(saved_file_path), "File should be saved: #{saved_file_path}"
88
+
89
+ visit proclaim.edit_post_path(image.post)
90
+
91
+ find("img[src='#{image.image.url}']").hover
92
+ find("a.mediumInsert-imageRemove").click
93
+
94
+ assert page.has_no_css?("img[src='#{image.image.url}']"), "Image should have been removed!"
95
+
96
+ wait_for_ajax
97
+
98
+ assert File.exist?(saved_file_path), "File should still be saved: #{saved_file_path}"
99
+
100
+ click_button "Update Post"
101
+ assert page.has_no_css?("div#error_explanation"), "This update should have succeeded!"
102
+
103
+ assert page.has_no_css?("img[src='#{image.image.url}']"), "Image should still be removed!"
104
+
105
+ refute File.exist?(saved_file_path), "Should have removed file: #{saved_file_path}"
106
+ refute File.exist?(save_path), "Should have removed saved path: #{save_path}"
107
+ end
108
+
109
+ test "delete saved image but not save should still show image" do
110
+ user = FactoryGirl.create(:user)
111
+ sign_in user
112
+
113
+ image = FactoryGirl.create(:image)
114
+ image.post.body = @edit_page.medium_inserted_image_html(image)
115
+ image.post.save
116
+
117
+ save_path = File.join(Rails.public_path, image.image.store_dir)
118
+ saved_file_path = File.join(save_path, image.image_identifier)
119
+
120
+ assert File.exist?(saved_file_path), "File should be saved: #{saved_file_path}"
121
+
122
+ visit proclaim.edit_post_path(image.post)
123
+
124
+ find("img[src='#{image.image.url}']").hover
125
+ find("a.mediumInsert-imageRemove").click
126
+
127
+ assert page.has_no_css?("img[src='#{image.image.url}']"), "Image should have been removed!"
128
+
129
+ wait_for_ajax
130
+
131
+ assert File.exist?(saved_file_path), "File should still be saved: #{saved_file_path}"
132
+
133
+ # Don't save. Just visit the post's show page
134
+ visit proclaim.post_path(image.post)
135
+
136
+ assert page.has_css?("img[src='#{image.image.url}']"), "Image should still be present!"
137
+ assert File.exist?(saved_file_path), "File should still be saved: #{saved_file_path}"
138
+ end
139
+
140
+ test "should show error without title" do
141
+ user = FactoryGirl.create(:user)
142
+ sign_in user
143
+
144
+ visit proclaim.new_post_path
145
+
146
+ within('#new_post') do
147
+ # Don't fill in title
148
+ element = find('div.editable')
149
+ element.click() # Select the element
150
+ element.set("Paragraph 1\nParagraph 2") # Set the text
151
+ end
152
+
153
+ assert_no_difference('Proclaim::Post.count') do
154
+ click_button "Create"
155
+ assert page.has_css? "div#error_explanation"
156
+ wait_for_ajax
157
+ end
158
+ end
159
+
160
+ test "should show error without body" do
161
+ user = FactoryGirl.create(:user)
162
+ sign_in user
163
+
164
+ visit proclaim.new_post_path
165
+
166
+ within('#new_post') do
167
+ element = find('h1.editable')
168
+ element.click()
169
+ element.set("Post Title") # Set the title text
170
+ # Don't fill in the body
171
+ end
172
+
173
+ assert_no_difference('Proclaim::Post.count') do
174
+ click_button "Create"
175
+ assert page.has_css? "div#error_explanation"
176
+ wait_for_ajax
177
+ end
178
+ end
179
+ end
@@ -0,0 +1,273 @@
1
+ require 'test_helper'
2
+
3
+ class PostSubscriptionTest < ActionDispatch::IntegrationTest
4
+ include WaitForAjax
5
+ self.use_transactional_fixtures = false
6
+
7
+ setup do
8
+ ApplicationController.any_instance.stubs(:current_user).returns(nil)
9
+ ApplicationController.any_instance.stubs(:authenticate_user).returns(false)
10
+
11
+ DatabaseCleaner.strategy = :truncation
12
+ DatabaseCleaner.start
13
+
14
+ Capybara.current_driver = :selenium
15
+
16
+ ActionMailer::Base.deliveries.clear
17
+
18
+ @show_page = ShowPage.new
19
+ end
20
+
21
+ teardown do
22
+ DatabaseCleaner.clean
23
+ Capybara.use_default_driver
24
+ end
25
+
26
+ test "should be able to create new root comment with subscription while logged in" do
27
+ user = FactoryGirl.create(:user)
28
+ sign_in user
29
+
30
+ post = FactoryGirl.create(:published_post)
31
+
32
+ visit proclaim.post_path(post)
33
+
34
+ within('#new_comment') do
35
+ fill_in 'Author', with: "Comment Author"
36
+ fill_in 'Body', with: "Comment Body"
37
+ fill_in 'What is', with: @show_page.antispam_solution
38
+ check 'Notify me of other comments on this post'
39
+ fill_in 'Email', with: "example@example.com"
40
+ end
41
+
42
+ assert_difference('Proclaim::Subscription.count', 1, "A new subscription should have been added!") do
43
+ @show_page.new_comment_submit_button.click
44
+ wait_for_ajax
45
+ end
46
+
47
+ # Make sure a welcome email was sent
48
+ assert_equal ["example@example.com"], ActionMailer::Base.deliveries.last.to
49
+
50
+ post.reload # Refresh post to pull in new associations
51
+
52
+ assert 1, post.subscriptions.count
53
+ assert_equal "example@example.com", post.subscriptions.first.email
54
+ end
55
+
56
+ test "should be able to create new root comment with subscription while not logged in" do
57
+ post = FactoryGirl.create(:published_post)
58
+
59
+ visit proclaim.post_path(post)
60
+
61
+ within('#new_comment') do
62
+ fill_in 'Author', with: "Comment Author"
63
+ fill_in 'Body', with: "Comment Body"
64
+ fill_in 'What is', with: @show_page.antispam_solution
65
+ check 'Notify me of other comments on this post'
66
+ fill_in 'Email', with: "example@example.com"
67
+ end
68
+
69
+ assert_difference('Proclaim::Subscription.count', 1, "A new subscription should have been added!") do
70
+ @show_page.new_comment_submit_button.click
71
+ wait_for_ajax
72
+ end
73
+
74
+ # Make sure a welcome email was sent
75
+ assert_equal ["example@example.com"], ActionMailer::Base.deliveries.last.to
76
+
77
+ post.reload # Refresh post to pull in new associations
78
+
79
+ assert 1, post.subscriptions.count
80
+ assert_equal "example@example.com", post.subscriptions.first.email
81
+ end
82
+
83
+ test "should be able to create new reply with subscription while logged in" do
84
+ user = FactoryGirl.create(:user)
85
+ sign_in user
86
+
87
+ comment = FactoryGirl.create(:published_comment)
88
+
89
+ visit proclaim.post_path(comment.post)
90
+
91
+ click_link "Reply"
92
+ within("#reply_to_#{comment.id}_new_comment") do
93
+ fill_in 'Author', with: "Reply Author"
94
+ fill_in 'Body', with: "Reply Body"
95
+ fill_in 'What is', with: @show_page.antispam_solution(comment)
96
+ check 'Notify me of other comments on this post'
97
+ fill_in 'Email', with: "example@example.com"
98
+ end
99
+
100
+ assert_difference('Proclaim::Subscription.count', 1, "A new subscription should have been added!") do
101
+ @show_page.new_comment_submit_button(comment).click
102
+ wait_for_ajax
103
+ end
104
+
105
+ # Make sure a welcome email was sent
106
+ assert_equal ["example@example.com"], ActionMailer::Base.deliveries.last.to
107
+ comment.reload # Refresh comment to pull in new associations
108
+
109
+ assert 1, comment.post.subscriptions.count
110
+ assert_equal "example@example.com", comment.post.subscriptions.first.email
111
+ end
112
+
113
+ test "should be able to create new reply with subscription while not logged in" do
114
+ comment = FactoryGirl.create(:published_comment)
115
+
116
+ visit proclaim.post_path(comment.post)
117
+
118
+ click_link "Reply"
119
+ within("#reply_to_#{comment.id}_new_comment") do
120
+ fill_in 'Author', with: "Reply Author"
121
+ fill_in 'Body', with: "Reply Body"
122
+ fill_in 'What is', with: @show_page.antispam_solution(comment)
123
+ check 'Notify me of other comments on this post'
124
+ fill_in 'Email', with: "example@example.com"
125
+ end
126
+
127
+ assert_difference('Proclaim::Subscription.count', 1, "A new subscription should have been added!") do
128
+ @show_page.new_comment_submit_button(comment).click
129
+ wait_for_ajax
130
+ end
131
+
132
+ # Make sure a welcome email was sent
133
+ assert_equal ["example@example.com"], ActionMailer::Base.deliveries.last.to
134
+
135
+ comment.reload # Refresh comment to pull in new associations
136
+
137
+ assert 1, comment.post.subscriptions.count
138
+ assert_equal "example@example.com", comment.post.subscriptions.first.email
139
+ end
140
+
141
+ test "should not send new comment notification email containing own comment" do
142
+ post = FactoryGirl.create(:published_post)
143
+
144
+ visit proclaim.post_path(post)
145
+
146
+ within('#new_comment') do
147
+ fill_in 'Author', with: "Comment Author"
148
+ fill_in 'Body', with: "Comment Body"
149
+ fill_in 'What is', with: @show_page.antispam_solution
150
+ check 'Notify me of other comments on this post'
151
+ fill_in 'Email', with: "example@example.com"
152
+ end
153
+
154
+ assert_difference('Proclaim::Subscription.count', 1, "A new subscription should have been added!") do
155
+ @show_page.new_comment_submit_button.click
156
+ wait_for_ajax
157
+ end
158
+
159
+ # Make sure only a single email was sent
160
+ assert_equal 1, ActionMailer::Base.deliveries.count,
161
+ "Only a welcome email should have been sent!"
162
+ assert_match "Welcome", ActionMailer::Base.deliveries.last.subject
163
+ end
164
+
165
+ test "should not create new root comment with subscription if spammy" do
166
+ comment = FactoryGirl.create(:published_comment)
167
+
168
+ visit proclaim.post_path(comment.post)
169
+
170
+ within('#new_comment') do
171
+ fill_in 'Author', with: "Comment Author"
172
+ fill_in 'Body', with: "Comment Body"
173
+ fill_in 'What is', with: "wrong answer"
174
+ check 'Notify me of other comments on this post'
175
+ fill_in 'Email', with: "example@example.com"
176
+ end
177
+
178
+ assert_no_difference('Proclaim::Comment.count',
179
+ "A new comment should not have been added!") do
180
+ assert_no_difference('Proclaim::Subscription.count',
181
+ "A new subscription should not have been added!") do
182
+ @show_page.new_comment_submit_button.click
183
+ assert page.has_css?('div.error'), "Failed antispam question-- errors should show!"
184
+ wait_for_ajax
185
+ end
186
+ end
187
+
188
+ # Make sure no email was sent
189
+ assert_empty ActionMailer::Base.deliveries
190
+ end
191
+
192
+ test "should not create new reply with subscription if spammy" do
193
+ comment = FactoryGirl.create(:published_comment)
194
+
195
+ visit proclaim.post_path(comment.post)
196
+
197
+ click_link "Reply"
198
+ within("#reply_to_#{comment.id}_new_comment") do
199
+ fill_in 'Author', with: "Reply Author"
200
+ fill_in 'Body', with: "Reply Body"
201
+ fill_in 'What is', with: "wrong answer"
202
+ check 'Notify me of other comments on this post'
203
+ fill_in 'Email', with: "example@example.com"
204
+ end
205
+
206
+ assert_no_difference('Proclaim::Comment.count',
207
+ "A new comment should not have been added!") do
208
+ assert_no_difference('Proclaim::Subscription.count',
209
+ "A new subscription should not have been added!") do
210
+ @show_page.new_comment_submit_button(comment).click
211
+ assert page.has_css?('div.error'), "Failed antispam question-- errors should show!"
212
+ wait_for_ajax
213
+ end
214
+ end
215
+
216
+ # Make sure no email was sent
217
+ assert_empty ActionMailer::Base.deliveries
218
+ end
219
+
220
+ test "catch lack of email address" do
221
+ post = FactoryGirl.create(:published_post)
222
+ visit proclaim.post_path(post)
223
+
224
+ # Create a new comment and say "notify me," but don't provide email
225
+ within('#new_comment') do
226
+ fill_in 'Author', with: "Comment Author"
227
+ fill_in 'Body', with: "Comment Body"
228
+ fill_in 'What is', with: @show_page.antispam_solution
229
+ check 'Notify me of other comments on this post'
230
+ end
231
+
232
+ assert_no_difference('Proclaim::Comment.count',
233
+ "A new comment should not have been added!") do
234
+ assert_no_difference('Proclaim::Subscription.count',
235
+ "A new subscription should not have been added!") do
236
+ @show_page.new_comment_submit_button.click
237
+ assert page.has_css?('div.error')
238
+ wait_for_ajax
239
+ end
240
+ end
241
+
242
+ # Make sure no email was sent
243
+ assert_empty ActionMailer::Base.deliveries
244
+ end
245
+
246
+ test "catch bad email address" do
247
+ post = FactoryGirl.create(:published_post)
248
+
249
+ visit proclaim.post_path(post)
250
+
251
+ # Create a new comment and say "notify me," but provide invalid email
252
+ within('#new_comment') do
253
+ fill_in 'Author', with: "Comment Author"
254
+ fill_in 'Body', with: "Comment Body"
255
+ fill_in 'What is', with: @show_page.antispam_solution
256
+ check 'Notify me of other comments on this post'
257
+ fill_in 'Email', with: "bad_email"
258
+ end
259
+
260
+ assert_no_difference('Proclaim::Comment.count',
261
+ "A new comment should not have been added!") do
262
+ assert_no_difference('Proclaim::Subscription.count',
263
+ "A new subscription should not have been added!") do
264
+ @show_page.new_comment_submit_button.click
265
+ assert page.has_css?('div.error')
266
+ wait_for_ajax
267
+ end
268
+ end
269
+
270
+ # Make sure no email was sent
271
+ assert_empty ActionMailer::Base.deliveries
272
+ end
273
+ end