proclaim 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG +6 -0
- data/Gemfile +14 -0
- data/LICENSE +674 -0
- data/README.md +137 -0
- data/Rakefile +65 -0
- data/VERSION +1 -0
- data/app/assets/images/ajax_loader.gif +0 -0
- data/app/assets/javascripts/proclaim.js +18 -0
- data/app/assets/javascripts/proclaim/comments_handler.js.coffee +192 -0
- data/app/assets/javascripts/proclaim/editor.js.coffee +50 -0
- data/app/assets/javascripts/proclaim/images.js.coffee +3 -0
- data/app/assets/javascripts/proclaim/subscriptions.js.coffee +3 -0
- data/app/assets/stylesheets/proclaim.css.scss +28 -0
- data/app/assets/stylesheets/proclaim/comments.css.scss +14 -0
- data/app/assets/stylesheets/proclaim/images.scss +3 -0
- data/app/assets/stylesheets/proclaim/posts.css.scss +77 -0
- data/app/assets/stylesheets/proclaim/subscriptions.css.scss +3 -0
- data/app/controllers/proclaim/application_controller.rb +44 -0
- data/app/controllers/proclaim/comments_controller.rb +128 -0
- data/app/controllers/proclaim/images_controller.rb +108 -0
- data/app/controllers/proclaim/posts_controller.rb +131 -0
- data/app/controllers/proclaim/subscriptions_controller.rb +67 -0
- data/app/helpers/proclaim/application_helper.rb +34 -0
- data/app/helpers/proclaim/comments_helper.rb +4 -0
- data/app/helpers/proclaim/images_helper.rb +4 -0
- data/app/helpers/proclaim/posts_helper.rb +4 -0
- data/app/helpers/proclaim/subscriptions_helper.rb +4 -0
- data/app/mailers/proclaim/subscription_mailer.rb +43 -0
- data/app/models/proclaim/comment.rb +35 -0
- data/app/models/proclaim/image.rb +19 -0
- data/app/models/proclaim/post.rb +133 -0
- data/app/models/proclaim/subscription.rb +63 -0
- data/app/policies/application_policy.rb +53 -0
- data/app/policies/proclaim/comment_policy.rb +27 -0
- data/app/policies/proclaim/image_policy.rb +29 -0
- data/app/policies/proclaim/post_policy.rb +38 -0
- data/app/policies/proclaim/subscription_policy.rb +32 -0
- data/app/uploaders/proclaim/image_uploader.rb +82 -0
- data/app/views/layouts/proclaim/subscription_mailer.html.erb +133 -0
- data/app/views/proclaim/comments/_comment.html.erb +33 -0
- data/app/views/proclaim/comments/_form.html.erb +51 -0
- data/app/views/proclaim/posts/_form.html.erb +67 -0
- data/app/views/proclaim/posts/edit.html.erb +3 -0
- data/app/views/proclaim/posts/index.html.erb +30 -0
- data/app/views/proclaim/posts/new.html.erb +3 -0
- data/app/views/proclaim/posts/show.html.erb +46 -0
- data/app/views/proclaim/subscription_mailer/new_comment_notification_email.html.erb +11 -0
- data/app/views/proclaim/subscription_mailer/new_post_notification_email.html.erb +15 -0
- data/app/views/proclaim/subscription_mailer/welcome_email.html.erb +25 -0
- data/app/views/proclaim/subscriptions/_form.html.erb +32 -0
- data/app/views/proclaim/subscriptions/new.html.erb +8 -0
- data/app/views/proclaim/subscriptions/subscribed.html.erb +7 -0
- data/app/views/proclaim/subscriptions/unsubscribe.html.erb +7 -0
- data/app/views/proclaim/subscriptions/unsubscribed.html.erb +3 -0
- data/config/routes.rb +18 -0
- data/db/migrate/20141108222616_create_proclaim_posts.rb +15 -0
- data/db/migrate/20141114235359_create_proclaim_comments.rb +15 -0
- data/db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb +26 -0
- data/db/migrate/20141210234057_create_proclaim_subscriptions.rb +17 -0
- data/db/migrate/20141222224905_create_proclaim_images.rb +12 -0
- data/lib/generators/proclaim/install_generator.rb +23 -0
- data/lib/generators/proclaim/templates/README +27 -0
- data/lib/generators/proclaim/templates/initialize_proclaim.rb +22 -0
- data/lib/generators/proclaim/views_generator.rb +24 -0
- data/lib/proclaim.rb +22 -0
- data/lib/proclaim/engine.rb +39 -0
- data/lib/proclaim/version.rb +3 -0
- data/lib/tasks/proclaim_tasks.rake +4 -0
- data/proclaim.gemspec +46 -0
- data/test/controllers/proclaim/comments_controller_test.rb +228 -0
- data/test/controllers/proclaim/images_controller_test.rb +123 -0
- data/test/controllers/proclaim/posts_controller_test.rb +303 -0
- data/test/controllers/proclaim/subscriptions_controller_test.rb +93 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +14 -0
- data/test/dummy/app/assets/stylesheets/application.css +16 -0
- data/test/dummy/app/controllers/application_controller.rb +15 -0
- data/test/dummy/app/helpers/application_helper.rb +28 -0
- data/test/dummy/app/models/user.rb +7 -0
- data/test/dummy/app/views/layouts/application.html.erb +16 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +24 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +45 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +49 -0
- data/test/dummy/config/initializers/assets.rb +8 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/migrate/20141117214323_create_users.rb +10 -0
- data/test/dummy/db/schema.rb +75 -0
- data/test/dummy/log/development.log +131 -0
- data/test/dummy/log/test.log +25961 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/tmp/cache/assets/test/sass/0b69f7cc441d56def3a51688e6a7a8474dc476d1/proclaim.css.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/comments.css.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/images.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/posts.css.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/subscriptions.css.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/04adcece63bc645379e6de797e7998f8 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/06620fc450f0a9b4a482a7bc08387711 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/076dd0d567a92c34163b3b98af1d48ba +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/09fc2eadf6d6062b2cc135a44e4e73db +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/09fe8c62e8ae706e01058b4b4d056c8e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/142fd040033525acb73ad2ccf1406aea +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1762aeeaf38da3b8d989a5b66b088004 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/194ac1a695334e303516614579b3926d +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/197ea008934db3e7ea8045302d206b92 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/19eba2635fec0895379c3e38f81ada84 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1c2ebe72fcd7ff1379a561552ca30f85 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1f42c80faacb651f670ec2b0998e49dc +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2243230e778a749ecbf0415a52e75be0 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/23ad87e715c70312aa61dde4fbb4bfe1 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/245b8735db4ea90bcaa91c011a1f447e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/26a42dac0cec64483f4126d2de4b0c9e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/30151c8f6d93717f06fa12774612ddf4 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/3c623d200214a5334aaf170537db087f +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/3ec36650a50759fd4b75794cb253936f +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/40431cdcc10c75ba1f275ecfe42623d3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/4226218a4b06608115b21063353370ea +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/437901953eb8707af6c27ca59cf65d91 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/461885b8ad31ef6a94c9a4f2e332b7eb +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/4792f46317cda92ccd5b278ec61f9ac5 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/4dcb3434b91b1c62f897a1741c6d398b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/5101cda93cf70f0fc0837713be587780 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/52d8c61de0703e0d7cf97d0f7b0cca7a +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/57f3d19a9bd484ac68c46f962a8684b2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/587e7c1332c8d8b69746dd85164e2cef +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/5934d5d0d1ac6657842708e85c73cf51 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/5af081799d7da2f04ead6a516c6015ad +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/69ee5af8d9a655898a67bc538ca1c7e7 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/6d1c56259648b0383bc438c875a448c3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/6e7de35055967df848aa490830043e51 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/70bc59560ee544af7bb2f727247db307 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/728cb566999910549092ff0a98e2853b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/72b5f0d35e9d69b744a156edad98f983 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/72ffa34d552e3fd02f28a6f845a5ac5b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/7369d324e84bc872c42b3e717ff4ad6c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/749a8b0e45b11df748a256dd04ceb1f7 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/77fb9f62552d9b786f9407ef11cc9a09 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/797823842565e01fc989ad8df0bd4254 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/7c139afa2296ac17483520109aecd449 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/7fb99e2b35af65c4f58bfb92dd4185b4 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/819de31c63b704f9ddf4865587a91d41 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8604b464bf846e5223da37ef2f29b524 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/88fc815613b473e98e9307b1d423918d +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8bc4341aa4060b8646e8134722cf3b11 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8cf8fd5ff8eae12211a88f971af30236 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8da3b4a9f17aafff49eb263bdb758f44 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9168e513bae02f041dbb806d6dbe94ac +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/920c1322be1212a54b7c4f2751d5e7bf +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/92205679a36afd387a2ba5c585a5a62c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/940566ebcae2d4e5c56a881ab66f2cf0 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/976967e07e2944a7ecc7403667f1f96b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/99bdde70cefa71745279232be575f14e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9a8e402a7e32063e46647403b43553a5 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9b09ad72f8cc33503878b01c713d92d0 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a20dbdfebf37fe50e832a6273c972553 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a3c6189fad6cb9ae955f6d5a43a61d51 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/abb54e11ff057a3e22a5a97d27cc4fa3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ad18e3875541d4298b1df133d494b93f +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/b9b7c575c22943d49734d52381c5ee16 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ba269a52f100d3d6cffda81e82e1ed49 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/bc7a0846b4881b0832d41de2b1724dba +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/bcb2df87f9611d3cc3ef8a5575e54fb8 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/bcf33791d3286af3ba2cdf6a6756c89e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/be32d0a530ce861537d6abfa41333df9 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/c8270a6f07dccc5f00e6b2b43f10efd2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cd82cd410a50bffcfb6e21e3c49a85c9 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ce4ccaa06bdee6426486224bc7e54187 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d0bdb8592e4eed80aa2341e37f20dbc9 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d4b784b16fa1b1dfcca6590689a8c157 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d968bd38a69bbf5c0065e2df3d30cfd3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/daa4d4b8a5ce46d6c4ecf031e0c61cfe +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/dc2effd195334219a7e4acfdc7ec7974 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/de36ab6c3b1a9b62a586d98373dd569c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e3aec457d5c753090d6521f2bb2d91b6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e8d6158b1fed2f574242b55856a3953d +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ea82f6aececcf81eef3e2e15a9225e66 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ed9f5c17f71ec75de10b1bb029ebd7a2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f2984adaeaa5322e3a040705c6d40622 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f62fd0cf9f5e7e077ec9c4daeccb06ae +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f78ea69bdbba5738c052e9eb04e6c208 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f864e553f706456dbdf168319970ec2e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/fb0f641bfcbb0101c040da9ff736447b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/fe426a44cf23cf82032091cbffff898c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ff732ea47a86c449582b2a81ef2930da +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ffc4980851addaacf12abeebfa63e07f +0 -0
- data/test/dummy/tmp/generators/config/initializers/proclaim.rb +22 -0
- data/test/factories/proclaim/comment.rb +11 -0
- data/test/factories/proclaim/image.rb +6 -0
- data/test/factories/proclaim/post.rb +14 -0
- data/test/factories/proclaim/subscription.rb +13 -0
- data/test/factories/user.rb +6 -0
- data/test/helpers/proclaim/comments_helper_test.rb +6 -0
- data/test/helpers/proclaim/posts_helper_test.rb +6 -0
- data/test/helpers/proclaim/subscriptions_helper_test.rb +6 -0
- data/test/integration/with_javascript/comment_test.rb +353 -0
- data/test/integration/with_javascript/post_form_test.rb +179 -0
- data/test/integration/with_javascript/post_subscription_test.rb +273 -0
- data/test/integration/without_javascript/blog_subscription_test.rb +87 -0
- data/test/integration/without_javascript/post_test.rb +140 -0
- data/test/integration/without_javascript/subscription_email_test.rb +95 -0
- data/test/integration/without_javascript/unsubscribe_test.rb +32 -0
- data/test/mailers/previews/proclaim/subscription_mailer_preview.rb +22 -0
- data/test/mailers/proclaim/subscription_mailer_test.rb +87 -0
- data/test/models/proclaim/comment_test.rb +41 -0
- data/test/models/proclaim/image_test.rb +70 -0
- data/test/models/proclaim/post_test.rb +127 -0
- data/test/models/proclaim/subscription_test.rb +66 -0
- data/test/policies/proclaim/comment_policy_test.rb +71 -0
- data/test/policies/proclaim/post_policy_test.rb +87 -0
- data/test/policies/proclaim/subscription_policy_test.rb +91 -0
- data/test/proclaim_test.rb +7 -0
- data/test/support/images/test.jpg +0 -0
- data/test/support/pages/posts/edit_page.rb +5 -0
- data/test/support/pages/posts/show_page.rb +47 -0
- data/test/support/wait_for_ajax.rb +11 -0
- data/test/test_helper.rb +56 -0
- data/vendor/assets/images/link.png +0 -0
- data/vendor/assets/images/remove.png +0 -0
- data/vendor/assets/images/resize-bigger.png +0 -0
- data/vendor/assets/images/resize-smaller.png +0 -0
- data/vendor/assets/images/unlink.png +0 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-embeds.js +197 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-embeds.min.js +10 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-images.js +572 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-images.min.js +10 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-maps.js +50 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-maps.min.js +10 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-plugin.js +496 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-plugin.min.js +10 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-tables.js +132 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-tables.min.js +10 -0
- data/vendor/assets/javascripts/medium-editor-insert-plugin.all.js +1415 -0
- data/vendor/assets/javascripts/medium-editor-insert-plugin.all.min.js +10 -0
- data/vendor/assets/stylesheets/medium-editor-insert-plugin-frontend.css +55 -0
- data/vendor/assets/stylesheets/medium-editor-insert-plugin-frontend.min.css +10 -0
- data/vendor/assets/stylesheets/medium-editor-insert-plugin.css +277 -0
- data/vendor/assets/stylesheets/medium-editor-insert-plugin.min.css +10 -0
- metadata +791 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Proclaim.setup do |config|
|
|
2
|
+
# The class to which posts belong. Changing this also changes the
|
|
3
|
+
# `current_author_method` and `authentication_method`. For example, setting
|
|
4
|
+
# `author_class = "Admin"` changes the default `current_author_method` to be
|
|
5
|
+
# `:current_admin`, etc.
|
|
6
|
+
#author_class = "User"
|
|
7
|
+
|
|
8
|
+
# Method to obtain the name of the author. This should be a method on the
|
|
9
|
+
# author class.
|
|
10
|
+
#author_name_method = :name
|
|
11
|
+
|
|
12
|
+
# Method to obtain the currently-authenticated user. Should return nil if
|
|
13
|
+
# no user is currently authenticated.
|
|
14
|
+
#current_author_method = :current_user
|
|
15
|
+
|
|
16
|
+
# Method to verify that a user is authenticated, and if not, will redirect
|
|
17
|
+
# to some sort of authentication page.
|
|
18
|
+
#authentication_method = :authenticate_user!
|
|
19
|
+
|
|
20
|
+
# Maximum length for the excerpts shown on the posts index.
|
|
21
|
+
#excerpt_length = 500
|
|
22
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
FactoryGirl.define do
|
|
2
|
+
factory :post, class: Proclaim::Post do
|
|
3
|
+
sequence(:title) {|n| "title#{n}"}
|
|
4
|
+
sequence(:body) {|n| "body#{n}"}
|
|
5
|
+
association :author, factory: :user
|
|
6
|
+
|
|
7
|
+
factory :published_post do
|
|
8
|
+
# Also called upon create
|
|
9
|
+
after(:build) do |post, evaluator|
|
|
10
|
+
post.publish
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
FactoryGirl.define do
|
|
2
|
+
factory :subscription, class: Proclaim::Subscription do
|
|
3
|
+
sequence(:email) {|n| "email#{n}@example.com"}
|
|
4
|
+
|
|
5
|
+
factory :post_subscription do
|
|
6
|
+
post
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
factory :published_post_subscription do
|
|
10
|
+
association :post, factory: :published_post
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class CommentTest < ActionDispatch::IntegrationTest
|
|
4
|
+
self.use_transactional_fixtures = false
|
|
5
|
+
|
|
6
|
+
setup do
|
|
7
|
+
ApplicationController.any_instance.stubs(:current_user).returns(nil)
|
|
8
|
+
ApplicationController.any_instance.stubs(:authenticate_user).returns(false)
|
|
9
|
+
|
|
10
|
+
DatabaseCleaner.strategy = :truncation
|
|
11
|
+
DatabaseCleaner.start
|
|
12
|
+
|
|
13
|
+
Capybara.current_driver = :selenium
|
|
14
|
+
|
|
15
|
+
@show_page = ShowPage.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
teardown do
|
|
19
|
+
DatabaseCleaner.clean
|
|
20
|
+
Capybara.use_default_driver
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
test "leave root comment" do
|
|
24
|
+
post = FactoryGirl.create(:published_post)
|
|
25
|
+
|
|
26
|
+
visit proclaim.post_path(post)
|
|
27
|
+
|
|
28
|
+
# Test leaving a root comment
|
|
29
|
+
within('#new_comment') do
|
|
30
|
+
fill_in 'Author', with: "Comment Author"
|
|
31
|
+
fill_in 'Body', with: "Comment Body"
|
|
32
|
+
fill_in 'What is', with: @show_page.antispam_solution
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
@show_page.new_comment_submit_button.click
|
|
36
|
+
|
|
37
|
+
assert page.has_no_css?('div.error')
|
|
38
|
+
assert page.has_text? "Comment Author"
|
|
39
|
+
assert page.has_text? "Comment Body"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
test "leave two replies" do
|
|
43
|
+
comment = FactoryGirl.create(:published_comment)
|
|
44
|
+
post = comment.post
|
|
45
|
+
|
|
46
|
+
visit proclaim.post_path(post)
|
|
47
|
+
|
|
48
|
+
# Leave first reply
|
|
49
|
+
@show_page.comment_reply_link(comment).click
|
|
50
|
+
within("#reply_to_#{comment.id}_new_comment") do
|
|
51
|
+
fill_in 'Author', with: "Reply Author 1"
|
|
52
|
+
fill_in 'Body', with: "Reply Body 1"
|
|
53
|
+
fill_in 'What is', with: @show_page.antispam_solution(comment)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
@show_page.new_comment_submit_button(comment).click
|
|
57
|
+
|
|
58
|
+
assert page.has_no_css?('div.error')
|
|
59
|
+
assert page.has_text? "Reply Author 1"
|
|
60
|
+
assert page.has_text? "Reply Body 1"
|
|
61
|
+
|
|
62
|
+
# Leave second reply
|
|
63
|
+
@show_page.comment_reply_link(comment).click
|
|
64
|
+
within("#reply_to_#{comment.id}_new_comment") do
|
|
65
|
+
fill_in 'Author', with: "Reply Author 2"
|
|
66
|
+
fill_in 'Body', with: "Reply Body 2"
|
|
67
|
+
fill_in 'What is', with: @show_page.antispam_solution(comment)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
@show_page.new_comment_submit_button(comment).click
|
|
71
|
+
|
|
72
|
+
assert page.has_no_css?('div.error')
|
|
73
|
+
assert page.has_text? "Reply Author 2"
|
|
74
|
+
assert page.has_text? "Reply Body 2"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
test "root comment should fail if spammy" do
|
|
78
|
+
post = FactoryGirl.create(:published_post)
|
|
79
|
+
|
|
80
|
+
visit proclaim.post_path(post)
|
|
81
|
+
|
|
82
|
+
# Test leaving a root comment
|
|
83
|
+
within('#new_comment') do
|
|
84
|
+
fill_in 'Author', with: "Comment Author"
|
|
85
|
+
fill_in 'Body', with: "Comment Body"
|
|
86
|
+
fill_in 'What is', with: "wrong answer"
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
@show_page.new_comment_submit_button.click
|
|
90
|
+
|
|
91
|
+
assert page.has_css?('div.error')
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
test "reply should fail if spammy" do
|
|
95
|
+
comment = FactoryGirl.create(:published_comment)
|
|
96
|
+
post = comment.post
|
|
97
|
+
|
|
98
|
+
visit proclaim.post_path(post)
|
|
99
|
+
|
|
100
|
+
@show_page.comment_reply_link(comment).click
|
|
101
|
+
within("#reply_to_#{comment.id}_new_comment") do
|
|
102
|
+
fill_in 'Author', with: "Reply Author 1"
|
|
103
|
+
fill_in 'Body', with: "Reply Body 1"
|
|
104
|
+
fill_in 'What is', with: "wrong answer"
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
@show_page.new_comment_submit_button(comment).click
|
|
108
|
+
|
|
109
|
+
assert page.has_css?('div.error')
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
test "reply forms should be exclusive" do
|
|
113
|
+
comment1 = FactoryGirl.create(:published_comment)
|
|
114
|
+
comment2 = FactoryGirl.create(:published_comment, post: comment1.post)
|
|
115
|
+
|
|
116
|
+
visit proclaim.post_path(comment1.post)
|
|
117
|
+
|
|
118
|
+
# Check that a form shows up to reply to comment1
|
|
119
|
+
@show_page.comment_reply_link(comment1).click
|
|
120
|
+
assert page.has_css? "form#reply_to_#{comment1.id}_new_comment"
|
|
121
|
+
|
|
122
|
+
# Now, without closing that form manually, assert that it is closed
|
|
123
|
+
# automatically when we try to reply to comment2
|
|
124
|
+
@show_page.comment_reply_link(comment2).click
|
|
125
|
+
assert page.has_css? "form#reply_to_#{comment2.id}_new_comment"
|
|
126
|
+
assert page.has_no_css?("form#reply_to_#{comment1.id}_new_comment"),
|
|
127
|
+
"The form from comment1 should be removed when replying to comment2!"
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
test "should not have option to edit if not logged in" do
|
|
131
|
+
comment = FactoryGirl.create(:published_comment)
|
|
132
|
+
|
|
133
|
+
visit proclaim.post_path(comment.post)
|
|
134
|
+
|
|
135
|
+
assert page.has_no_css?("#comment_#{comment.id} .edit"),
|
|
136
|
+
"A guest should not be given the option to edit a comment!"
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
test "edit root comment" do
|
|
140
|
+
user = FactoryGirl.create(:user)
|
|
141
|
+
sign_in user
|
|
142
|
+
|
|
143
|
+
comment = FactoryGirl.create(:published_comment)
|
|
144
|
+
|
|
145
|
+
visit proclaim.post_path(comment.post)
|
|
146
|
+
|
|
147
|
+
@show_page.comment_edit_link(comment).click
|
|
148
|
+
assert page.has_no_css?("p.comment_author", text: comment.author),
|
|
149
|
+
"The comment author should have been completely replaced by the edit form!"
|
|
150
|
+
assert page.has_no_css?("div.comment_body", text: comment.body),
|
|
151
|
+
"The comment body should have been completely replaced by the edit form!"
|
|
152
|
+
|
|
153
|
+
within("#edit_comment_#{comment.id}") do
|
|
154
|
+
fill_in 'Author', with: "Edit Author"
|
|
155
|
+
fill_in 'Body', with: "Edit Body"
|
|
156
|
+
end
|
|
157
|
+
@show_page.edit_comment_submit_button(comment).click
|
|
158
|
+
assert page.has_css? "p.comment_author", text: "Edit Author"
|
|
159
|
+
assert page.has_css? "div.comment_body", text: "Edit Body"
|
|
160
|
+
assert page.has_no_css?("p.comment_author", text: comment.author),
|
|
161
|
+
"The old comment author should be gone!"
|
|
162
|
+
assert page.has_no_css?("div.comment_body", text: comment.body),
|
|
163
|
+
"The old comment body should be gone!"
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
test "edit parent comment" do
|
|
167
|
+
user = FactoryGirl.create(:user)
|
|
168
|
+
sign_in user
|
|
169
|
+
|
|
170
|
+
parent = FactoryGirl.create(:published_comment)
|
|
171
|
+
child = FactoryGirl.create(:published_comment,
|
|
172
|
+
post: parent.post,
|
|
173
|
+
parent: parent)
|
|
174
|
+
|
|
175
|
+
visit proclaim.post_path(parent.post)
|
|
176
|
+
|
|
177
|
+
@show_page.comment_edit_link(parent).click
|
|
178
|
+
assert page.has_no_css?("p.comment_author", text: parent.author),
|
|
179
|
+
"The parent comment author should have been completely replaced by the edit form!"
|
|
180
|
+
assert page.has_no_css?("div.comment_body", text: parent.body),
|
|
181
|
+
"The parent comment body should have been completely replaced by the edit form!"
|
|
182
|
+
assert page.has_css?("p.comment_author", text: child.author),
|
|
183
|
+
"The child comment author should still be on the page!"
|
|
184
|
+
assert page.has_css?("div.comment_body", text: child.body),
|
|
185
|
+
"The child comment body should still be on the page!"
|
|
186
|
+
|
|
187
|
+
within("#edit_comment_#{parent.id}") do
|
|
188
|
+
fill_in 'Author', with: "Edit Author"
|
|
189
|
+
fill_in 'Body', with: "Edit Body"
|
|
190
|
+
end
|
|
191
|
+
@show_page.edit_comment_submit_button(parent).click
|
|
192
|
+
assert page.has_css?("p.comment_author", text: "Edit Author"),
|
|
193
|
+
"The parent comment author should now be edited!"
|
|
194
|
+
assert page.has_css?("div.comment_body", text: "Edit Body"),
|
|
195
|
+
"The parent comment body should now be edited!"
|
|
196
|
+
assert page.has_css?("p.comment_author", text: child.author),
|
|
197
|
+
"The child comment author should still be on the page!"
|
|
198
|
+
assert page.has_css?("div.comment_body", text: child.body),
|
|
199
|
+
"The child comment body should still be on the page!"
|
|
200
|
+
assert page.has_no_css?("p.comment_author", text: parent.author),
|
|
201
|
+
"The old parent comment author should be gone!"
|
|
202
|
+
assert page.has_no_css?("div.comment_body", text: parent.body),
|
|
203
|
+
"The old parent comment body should be gone!"
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
test "edit child comment" do
|
|
207
|
+
user = FactoryGirl.create(:user)
|
|
208
|
+
sign_in user
|
|
209
|
+
|
|
210
|
+
parent = FactoryGirl.create(:published_comment)
|
|
211
|
+
child = FactoryGirl.create(:published_comment,
|
|
212
|
+
post: parent.post,
|
|
213
|
+
parent: parent)
|
|
214
|
+
|
|
215
|
+
visit proclaim.post_path(parent.post)
|
|
216
|
+
|
|
217
|
+
@show_page.comment_edit_link(child).click
|
|
218
|
+
assert page.has_no_css?("p.comment_author", text: child.author),
|
|
219
|
+
"The child comment author should have been completely replaced by the edit form!"
|
|
220
|
+
assert page.has_no_css?("div.comment_body", text: child.body),
|
|
221
|
+
"The chid comment body should have been completely replaced by the edit form!"
|
|
222
|
+
assert page.has_css?("p.comment_author", text: parent.author),
|
|
223
|
+
"The parent comment author should still be on the page!"
|
|
224
|
+
assert page.has_css?("div.comment_body", text: parent.body),
|
|
225
|
+
"The parent comment body should still be on the page!"
|
|
226
|
+
|
|
227
|
+
within("#edit_comment_#{child.id}") do
|
|
228
|
+
fill_in 'Author', with: "Edit Author"
|
|
229
|
+
fill_in 'Body', with: "Edit Body"
|
|
230
|
+
end
|
|
231
|
+
@show_page.edit_comment_submit_button(child).click
|
|
232
|
+
assert page.has_css? "p.comment_author", text: 'Edit Author'
|
|
233
|
+
assert page.has_css? "div.comment_body", text: 'Edit Body'
|
|
234
|
+
assert page.has_css? "p.comment_author", text: parent.author
|
|
235
|
+
assert page.has_css? "div.comment_body", text: parent.body
|
|
236
|
+
|
|
237
|
+
assert page.has_no_css?("p.comment_author", text: child.author),
|
|
238
|
+
"The old child comment author should be gone!"
|
|
239
|
+
assert page.has_no_css?("div.comment_body", text: child.body),
|
|
240
|
+
"The old child comment body should be gone!"
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
test "should not have option to delete if not logged in" do
|
|
244
|
+
comment = FactoryGirl.create(:published_comment)
|
|
245
|
+
|
|
246
|
+
visit proclaim.post_path(comment.post)
|
|
247
|
+
|
|
248
|
+
assert page.has_no_css?("#comment_#{comment.id} .delete"),
|
|
249
|
+
"A guest should not be given the option to delete a comment!"
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
test "delete root comment" do
|
|
253
|
+
user = FactoryGirl.create(:user)
|
|
254
|
+
sign_in user
|
|
255
|
+
|
|
256
|
+
comment = FactoryGirl.create(:published_comment)
|
|
257
|
+
|
|
258
|
+
visit proclaim.post_path(comment.post)
|
|
259
|
+
|
|
260
|
+
assert page.has_text? comment.author
|
|
261
|
+
assert page.has_text? comment.body
|
|
262
|
+
|
|
263
|
+
current_count = Proclaim::Comment.count
|
|
264
|
+
|
|
265
|
+
@show_page.comment_delete_link(comment).click
|
|
266
|
+
page.accept_alert
|
|
267
|
+
|
|
268
|
+
assert page.has_no_text? comment.author
|
|
269
|
+
assert page.has_no_text? comment.body
|
|
270
|
+
|
|
271
|
+
assert(wait_until { Proclaim::Comment.count == current_count - 1 },
|
|
272
|
+
"Root comment should have been deleted!")
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
test "delete parent comment" do
|
|
276
|
+
user = FactoryGirl.create(:user)
|
|
277
|
+
sign_in user
|
|
278
|
+
|
|
279
|
+
parent = FactoryGirl.create(:published_comment)
|
|
280
|
+
child = FactoryGirl.create(:published_comment,
|
|
281
|
+
post: parent.post,
|
|
282
|
+
parent: parent)
|
|
283
|
+
|
|
284
|
+
visit proclaim.post_path(parent.post)
|
|
285
|
+
|
|
286
|
+
assert page.has_text? parent.author
|
|
287
|
+
assert page.has_text? parent.body
|
|
288
|
+
assert page.has_text? child.author
|
|
289
|
+
assert page.has_text? child.body
|
|
290
|
+
|
|
291
|
+
current_count = Proclaim::Comment.count
|
|
292
|
+
|
|
293
|
+
@show_page.comment_delete_link(parent).click
|
|
294
|
+
page.accept_alert
|
|
295
|
+
|
|
296
|
+
assert page.has_no_text?(parent.author), "Parent author should be gone!"
|
|
297
|
+
assert page.has_no_text?(parent.body), "Parent body should be gone!"
|
|
298
|
+
assert page.has_no_text?(child.author), "Child author should be gone!"
|
|
299
|
+
assert page.has_no_text?(child.body), "Child body should be gone!"
|
|
300
|
+
|
|
301
|
+
assert(wait_until { Proclaim::Comment.count == current_count - 2 },
|
|
302
|
+
"Both parent and child should have been deleted!")
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
test "delete child comment" do
|
|
306
|
+
user = FactoryGirl.create(:user)
|
|
307
|
+
sign_in user
|
|
308
|
+
|
|
309
|
+
parent = FactoryGirl.create(:published_comment)
|
|
310
|
+
child = FactoryGirl.create(:published_comment,
|
|
311
|
+
post: parent.post,
|
|
312
|
+
parent: parent)
|
|
313
|
+
|
|
314
|
+
visit proclaim.post_path(parent.post)
|
|
315
|
+
|
|
316
|
+
assert page.has_text? child.author
|
|
317
|
+
assert page.has_text? child.body
|
|
318
|
+
|
|
319
|
+
current_count = Proclaim::Comment.count
|
|
320
|
+
|
|
321
|
+
@show_page.comment_delete_link(child).click
|
|
322
|
+
page.accept_alert
|
|
323
|
+
|
|
324
|
+
assert page.has_no_text?(child.author), "Child author should be gone!"
|
|
325
|
+
assert page.has_no_text?(child.body), "Child body should be gone!"
|
|
326
|
+
assert page.has_text?(parent.author), "Parent author should not be gone!"
|
|
327
|
+
assert page.has_text?(parent.body), "Parent body should not be gone!"
|
|
328
|
+
|
|
329
|
+
assert(wait_until { Proclaim::Comment.count == current_count - 1 },
|
|
330
|
+
"Child comment should have been deleted!")
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
test "cancel button should remove errors" do
|
|
334
|
+
post = FactoryGirl.create(:published_post)
|
|
335
|
+
|
|
336
|
+
visit proclaim.post_path(post)
|
|
337
|
+
|
|
338
|
+
within('#new_comment') do
|
|
339
|
+
fill_in 'Author', with: "Comment Author"
|
|
340
|
+
# Make a mistake-- leave out the body
|
|
341
|
+
end
|
|
342
|
+
@show_page.new_comment_submit_button.click
|
|
343
|
+
|
|
344
|
+
# Errors should be on the page
|
|
345
|
+
assert page.has_css?('div.error')
|
|
346
|
+
|
|
347
|
+
# Now click cancel
|
|
348
|
+
@show_page.new_comment_cancel_button.click
|
|
349
|
+
|
|
350
|
+
# Now errors should be cleared
|
|
351
|
+
assert page.has_no_css?('div.error')
|
|
352
|
+
end
|
|
353
|
+
end
|