commontator 5.0.0 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -1
- data/app/assets/javascripts/commontator/application.js~ +3 -0
- data/app/assets/javascripts/commontator/mentions.js~ +31 -0
- data/app/assets/stylesheets/commontator/application.css~ +14 -0
- data/app/assets/stylesheets/commontator/threads.css~ +71 -0
- data/app/controllers/commontator/comments_controller.rb~ +160 -0
- data/app/controllers/commontator/threads_controller.rb~ +75 -0
- data/app/mailers/commontator/subscriptions_mailer.rb~ +65 -0
- data/app/models/commontator/comment.rb~ +124 -0
- data/app/models/commontator/subscription.rb~ +23 -0
- data/app/views/commontator/shared/_thread.html.erb~ +21 -0
- data/app/views/commontator/subscriptions_mailer/comment_created.html.erb~ +10 -0
- data/app/views/commontator/threads/_hide_show.js.erb~ +21 -0
- data/app/views/commontator/threads/_hide_show_links.js.erb~ +17 -0
- data/app/views/commontator/threads/_show.html.erb~ +118 -0
- data/app/views/commontator/threads/_show.js.erb~ +18 -0
- data/config/initializers/commontator.rb~ +290 -0
- data/config/locales/en.yml~ +101 -0
- data/config/locales/ru.yml~ +79 -0
- data/config/locales/zh.yml~ +79 -0
- data/config/routes.rb~ +25 -0
- data/db/migrate/0_install_commontator.rb~ +52 -0
- data/db/migrate/1_add_parent_comment_id_to_commontator_comments.rb~ +9 -0
- data/lib/commontator.rb~ +145 -0
- data/lib/commontator/acts_as_commontable.rb +3 -1
- data/lib/commontator/shared_helper.rb~ +26 -0
- data/lib/commontator/version.rb +1 -1
- data/lib/commontator/version.rb~ +3 -0
- data/spec/controllers/commontator/comments_controller_spec.rb~ +612 -0
- data/spec/controllers/commontator/subscriptions_controller_spec.rb~ +101 -0
- data/spec/controllers/commontator/threads_controller_spec.rb~ +218 -0
- data/spec/dummy/README.md~ +3 -0
- data/spec/dummy/Rakefile~ +6 -0
- data/spec/dummy/app/assets/javascripts/application.js~ +16 -0
- data/spec/dummy/app/assets/stylesheets/application.css~ +14 -0
- data/spec/dummy/app/controllers/application_controller.rb~ +4 -0
- data/spec/dummy/app/controllers/dummy_models_controller.rb~ +23 -0
- data/spec/dummy/app/helpers/application_helper.rb~ +15 -0
- data/spec/dummy/app/models/dummy_dependent_model.rb +4 -0
- data/spec/dummy/app/models/dummy_model.rb~ +3 -0
- data/spec/dummy/app/models/dummy_user.rb~ +13 -0
- data/spec/dummy/app/views/dummy_models/index.html.erb~ +6 -0
- data/spec/dummy/app/views/dummy_models/show.html.erb~ +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb~ +14 -0
- data/spec/dummy/config.ru~ +4 -0
- data/spec/dummy/config/application.rb~ +26 -0
- data/spec/dummy/config/boot.rb~ +5 -0
- data/spec/dummy/config/database.yml~ +25 -0
- data/spec/dummy/config/environment.rb~ +8 -0
- data/spec/dummy/config/environments/development.rb~ +31 -0
- data/spec/dummy/config/environments/production.rb~ +82 -0
- data/spec/dummy/config/environments/test.rb~ +40 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb~ +7 -0
- data/spec/dummy/config/initializers/commontator.rb~ +21 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb~ +4 -0
- data/spec/dummy/config/initializers/inflections.rb~ +16 -0
- data/spec/dummy/config/initializers/mime_types.rb~ +5 -0
- data/spec/dummy/config/initializers/secret_token.rb~ +12 -0
- data/spec/dummy/config/initializers/session_store.rb~ +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb~ +14 -0
- data/spec/dummy/config/routes.rb~ +10 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/1_create_dummy_models.rb~ +7 -0
- data/spec/dummy/db/migrate/2_create_dummy_users.rb~ +7 -0
- data/spec/dummy/db/migrate/3_acts_as_votable_migration.rb~ +27 -0
- data/spec/dummy/db/migrate/4_create_dummy_dependent_models.rb +7 -0
- data/spec/dummy/db/schema.rb +6 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/controllers.rb~ +10 -0
- data/spec/dummy/log/development.log +6471 -191
- data/spec/dummy/log/test.log +121221 -31445
- data/spec/dummy/public/404.html~ +26 -0
- data/spec/dummy/public/422.html~ +26 -0
- data/spec/dummy/public/500.html~ +25 -0
- data/spec/dummy/script/rails~ +6 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/-RolHYhJdGiLoPkoWZXQdI9AIWUjMMCa2yFJezCE_Bo.cache +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/-STzK7UuGeY3gSvnmTELWLvtRMKpmSAQCEw4ao3b1r8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/3NH8nN7uktAXgA3NqaqXTXDVic3BxBvqCxoLpGGbib4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/4_iT7KM6P2IT75Rssrk9p4crTBwM8DQWR41gmsxczL0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/58TLCXvf5bFFYY-mIUXrQNOVWlGsq7qPAoSX2OIIB8Y.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/6OQdyrATvNatvWu8Mp1qbuvRx-HLmzCZ5XBGYca-rZU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/6UKCUV-ZLaWCoPMfMB6a2W0RCFPQzPJ6Mz-y67sH7zk.cache +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/6wKNjFdNd4OHjIpLC0nq1kBWcbYg1aEYrp7ZhWoJlvY.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/7Xxb5iYP5elo40JRlhNQB1gLbv3ueELK2rTinYt5xdc.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/7twIKlS6VYCyLlwhsQg2vu4wLSUJsT2REHR4DjZf1oE.cache +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/87m-4EcbQnkbo2HYkQp4V9I2U3AYQO1mPeReieduolA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8B331vt8qC4iXTcVzkx3j-ET8i1oaQskj5LyqGq8mPQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8KWvIOgvo7BVJYtdTpFuiSQQFFwZhLWYtwacZv52y48.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9yQa5M2ObK2-qDu231zMoarjVbhKUUg-ND3r2iXqB_Q.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/A-ffuUI2juZT6qFpTUwUR1P8OPWcyFFN26WSUZe60Ko.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/BbO4diS6uacx69Hn_bCabYlXEbWWdjHShRlfzlWSOMI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/CXhqxaQQAQ8b0Y8y0jTQyiqsZ6Oe4fZn0YiacpJ9IoI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/E1zaNOh68xzPxdtdOwRtOaMCoKivN2dxVwCP65WEi5I.cache +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/EmPkV3H8p2Snv9WyPjWran_kOMQ0MqQ1a9CVdGDd8l4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Hc12Nxe7cw2e0u2pzNsAe8D3ncQpcqLuI2NVL7aAXgw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/HdWuQr9W2mZvggsAxVjDgLYUNfg3rbI-T8KhaDIsvQk.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/I7lsrHTKpbfLWqIqdDIx2RN_12yFL2PyLRyYsMxg1IU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/JOCzfBjMjX3D5BUUGh5lJ7fjzMuJrHLxAginRA2_hZQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/JusxTSXt06IqBm9jeCMM2nTmM3Wvbl3i3L1IwEvW5YA.cache +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/KAY1_IaTONtGr0KK8ihOdoA-RDXybqBMNSZLIDRHx68.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/KBHIDNfa4ryw9LAkYqK8GgPWne7HkX6mNYgrJajGm94.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/L_lv02y00MmIFiFhg5c9zhl7CDHLSahehzLyi_mRZeY.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/MOT2X4iikR8v89A4N1bxDTeS1-xV8c9036TNFXmwXCM.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/MiX2Z4Vbha1riozZWw1U3_PGttRiZ1iQ_o4wSZJnKCs.cache +3 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/MntKfwol0ud4LuvrX3MVPthTlfNlJZRYbQXpQBxhRrs.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/MrqmgPGNYJV1capJKIKJOVEQ4NiO-Z_2YhpjNteJ8B8.cache +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/NVMnAwylzGp5bjl_o9dwMAQxVAPDzc4ygddNQSD1fiw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/O2sKqGxNuCYhjzuEZVC9hX_FeemOfRn_1-CCuHBQYyg.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Qy3TykLFmAt5jhSluMTaZaefcA5c_vfBRhQ7tin-gsk.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/R3DpUgZ_hja1dQTIzumiP9AD_r8mlOaqv0U9QqnGQqo.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/RF07mgb06A30OcDWtCaDlM5tEc1yp0uAsk986Gqs5w8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/S-6Iq5YOEpVnd_vQ0RSSfrmyIwB1dk0op35alFgJ9xA.cache +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/TKV8dUTo88gdFY-z2I7Xa5vDC1Z3LY6Paa18385MJsI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/UI4zPmWfZA2d_5ZZIXqK9KmkjOKSDg6JoM7qcOIxm0Q.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/UP29vrIQbCkfghZGSCFxpW5gjlsgCxlVrncjjopvRqM.cache +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/UoU16f4V7haEXM5GY5j4QFuNMP7PJZaAMEvVNNtNLBA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/VqPqYNG07yqcjbd7FA05Mu-jr5hzsZPaHFf8X0FFbXk.cache +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/WkN1QFvcuzXSsyNmfaK02ojXPk-8zmdEegzNPfdAEL4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/WkQX7Wiz41OKx2aGF7uffOmS04hIVZeGCondBAvwum8.cache +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/XMeYF1vwAg53eVjXVkw_IKQH2W3-9tWvtuCdqUCbPBM.cache +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/XX0Z7OM0xZKfQaAvHARpyeQNZCstNyu9MlsnwThSkg8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Y-pGNFTA6bAKxSvqZvmMVs3b4Els1aByxZVFxtJR71c.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Y3p3m5V5NOm7yq56apKmF5KZUUsTfnhT_SG3fqbEJgo.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/YLZuRWklL6q-csC-7A7CiOTTTYEQcA9PCdWEOm9MpNU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Yo7V5YXukEBm6z37l-TIRCJx3HZExEUBu3MUMhAzkMU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/bK6QttR8pGmMAMJO0avCBLwH0za8_bAC-yWqkU3Yj24.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/cLncjrqpQXzsVBp7K0W7iG1STLrnzfGpbJXxNE7aIUk.cache +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/dBcAd64EZFdhHZNXKGXPIR7EtPGf03bzqkci2W12T8g.cache +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d_bbPiareJHKkzFZFCl3pcwfQOFzsB1KHn4A2xxhR20.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/eaHZBuJRcawVlkGZVyyRr5_4xYKVOXbCqnTcmaNXzL0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/gWnmfJty3jBn53qsJfOXKrWv4e8i3Dp80wVel-f1L1E.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/gumo32Bd3W_q7MYEt9JIZEiQdHF93tLSsGfmXIm2MqU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/jKTlG9KP0iaCGHwg8kQ1amz9SHJ1OAWeCRRn9wc5w7c.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/kPJfTiWbmX-q6i2rjM9MAMdEf2silSihU0_lxlTGVA8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/lrt1SWPj4qWUZUMH9xg3n9KLYUqJZxRn-XI-NTU6oTI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/mcCP5u08nlCL6TgWdzzrem9uE2rbsbG3KyIXxvWvlJE.cache +3 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/pC4exGjkQLXXPE0O9hjX_2AJ4DASTFeB6RGjXagxEac.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/pIRh_Lq-ZhYC_XdRcqIsCtUkTnwVET0Wrrpw1EltHd8.cache +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/qfXc71sDbi1cE9f327D6ABPURPU6lLguGiJqH2fqM0w.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/rBcrkzXcMaiCjwvWl8tO0eARzKZS69I3i-lfsTAFzcc.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/sfl8l1_1AGn-4llkmb91Q0wHJ-A-x5gAGkIUWe1zLqo.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/tFQc0MOeWpJ7t7cNP2GOzo7o9Z6YBgLEpdS0tGLvUSw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/tb9v5OemP-ADEwYnETLLi1r088kZm_TMb9ZVeTV5JxI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/uKmWfbgaNZ8FTsVK1VNuUv15rmtTHzSdJ7TQRGr0Rck.cache +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ul0QEoovfr_12YOpyWx8BJs8fvz5Ay3AZG8-lsLr-a4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/vY6eUgBIXKHqfU2ZroS-GugKPg5_fo2QBs-vS5gBN2o.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/vrRc4DPAbHIJHJqsXfBYdyKUPFv8f8YYKJUrk-1zdVw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/wTET4PQq7wlxzrgvNivPJad-CACkoQS4BNxAP0FQaR4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/wcvE87iLx7cDjMDs_Yu1jKYvep-VyLEyj1eXL79KLp4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/xQeZ92qbm2t9FaRck5xUakvNP-MJ2cs0RroN-fm0Tf8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/xQz9WPf67Mu5uV4rNuOfU-y6_KWSlWcnTWrTvQPonKM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/xhYTRUOS8cIvyRp2Jn6FKnXlGOSsIM2z3HAGOJoJs7w.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/yLxMFI0ARh2OKSOQLF2xEfM7sbst2vUbOBXoOuI6iTE.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ynnYZxuxqerlFUytw54dl_CwP94g0U4HmGjyILWnhfQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/zCivVPbSRpKF_X-P5OJeld32YhymG-bkjQwzqe2o6zg.cache +2 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/02d4b791eb831cf2057bf4703a1218d1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0f196a1a50363b0a076ec6e1ee5417f6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a3fb9025f90ff05a6fd4afc7ded2692c +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a41c8be5379abec3c0d0d98e2f0d5609 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c69ee3cc5796188d873574179290a6ef +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e1f674c11941d62aac1764ef3a7134e4 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e85565206c3e5fdf9dfeb367c85557b1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/-gXoYfEJ-e9QQUbNRpNa-pwMCnTc7Eqvkq6Bosde6W8.cache +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/6iNAIrMKxHltOChiHQQf9VNsLQuj2rVKz6oqWnK7aSM.cache +1 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/E1zaNOh68xzPxdtdOwRtOaMCoKivN2dxVwCP65WEi5I.cache +2 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/HsNbq1o4RbrEWNL4zXVqFfUVnXXLK_y0F0BvddDre6g.cache +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/JusxTSXt06IqBm9jeCMM2nTmM3Wvbl3i3L1IwEvW5YA.cache +2 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/L5DjABL_iOtoxSOLn3X7_YlxECU5EhnrVIKxJFAysgc.cache +1 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/PNc9TJUmRdGTSwgZvGlxKaIiJIkyoWtTPiGGWBqpHAE.cache +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/QkgTHa6nNs7XP6RPoV3yBbWWV-uo1u2-qxLuvLCFe_0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/S-6Iq5YOEpVnd_vQ0RSSfrmyIwB1dk0op35alFgJ9xA.cache +2 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/Vuc93A9yywiFxc9CAdxrzdsAQw4jxiCa6JRzRjNxOYs.cache +1 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/YAPBll4U0cgs6cz-WyMRKoakK_gVOOcl9n0CvGyxPjY.cache +1 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/bDNeZfPBQaef5z0YajZc4jFE54nNy9gc06mPNKvvPFk.cache +1 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/c5Wa2loowFYFRBaMoTn1IWYXo4BGMbEy7NIi0vbvfRU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/dkn8MYu2ve_AJW6u0jjTlKrj1KBRqorOHQR0Obx2elU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/fZuAzt_-48u9C7ZXmsPgTraGDYtNC9B9zN-9-EnxJG4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/gumo32Bd3W_q7MYEt9JIZEiQdHF93tLSsGfmXIm2MqU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/ige85jXyj8X7XYr7HpA0gSTThqfPUm71HjhSJXtTbUY.cache +1 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/kuYeE5bV6FdXmfB_o-xhflhSDWoQhYYaaupAXODZ9dQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/qhZbbNIRUaAOtGano94zLHjeBKUhKr4qbh2tTCi0Bnk.cache +2 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/wJJbzdHJHP6tchng3HhfTwmjc5LursgX8yZkAjpO5UA.cache +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/xNL1WW-qU3EvV2iTSW6F4hAFRBsCYmFKJhLjgCZkOV8.cache +2 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/ytHkF2DwUE6oaiLyrK6tL-0INpeNhjN6ctD7J0LNY6I.cache +2 -0
- data/spec/helpers/commontator/application_helper_spec.rb~ +9 -0
- data/spec/lib/commontator/acts_as_commontable_spec.rb~ +25 -0
- data/spec/lib/commontator/acts_as_commontator_spec.rb~ +52 -0
- data/spec/lib/commontator/commontable_config_spec.rb~ +29 -0
- data/spec/lib/commontator/commontator_config_spec.rb~ +29 -0
- data/spec/lib/commontator/controller_includes_spec.rb~ +18 -0
- data/spec/lib/commontator/controllers_spec.rb~ +18 -0
- data/spec/lib/commontator/shared_helper_spec.rb~ +22 -0
- data/spec/lib/commontator_spec.rb~ +26 -0
- data/spec/mailers/commontator/subscriptions_mailer_spec.rb~ +30 -0
- data/spec/models/commontator/comment_spec.rb~ +82 -0
- data/spec/models/commontator/subscription_spec.rb~ +38 -0
- data/spec/models/commontator/thread_spec.rb +37 -0
- data/spec/models/commontator/thread_spec.rb~ +122 -0
- data/spec/rails_helper.rb~ +74 -0
- data/spec/spec_helper.rb~ +93 -0
- data/vendor/assets/javascripts/mentionsInput/index.js~ +3 -0
- metadata +409 -51
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
RSpec.describe ActsAsCommontator, type: :lib do
|
5
|
+
it 'must add methods to ActiveRecord and subclasses' do
|
6
|
+
ActiveRecord::Base.must_respond_to :acts_as_commontator
|
7
|
+
ActiveRecord::Base.must_respond_to :is_commontator
|
8
|
+
ActiveRecord::Base.is_commontator.must_equal false
|
9
|
+
DummyModel.must_respond_to :acts_as_commontator
|
10
|
+
DummyModel.must_respond_to :is_commontator
|
11
|
+
DummyModel.is_commontator.must_equal false
|
12
|
+
DummyUser.must_respond_to :acts_as_commontator
|
13
|
+
DummyUser.must_respond_to :is_commontator
|
14
|
+
DummyUser.is_commontator.must_equal true
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'must modify models that act_as_commontator' do
|
18
|
+
user = DummyUser.create
|
19
|
+
user.must_respond_to :comments
|
20
|
+
user.must_respond_to :subscriptions
|
21
|
+
user.must_respond_to :commontator_config
|
22
|
+
user.commontator_config.must_be_instance_of CommontatorConfig
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
require 'rails_helper'
|
28
|
+
|
29
|
+
module Commontator
|
30
|
+
RSpec.describe ActsAsCommontator, type: :lib do
|
31
|
+
it 'must add methods to ActiveRecord and subclasses' do
|
32
|
+
expect(ActiveRecord::Base).to respond_to(:acts_as_commontator)
|
33
|
+
expect(ActiveRecord::Base).to respond_to(:is_commontator)
|
34
|
+
expect(ActiveRecord::Base.is_commontator).to eq false
|
35
|
+
expect(DummyModel).to respond_to(:acts_as_commontator)
|
36
|
+
expect(DummyModel).to respond_to(:is_commontator)
|
37
|
+
expect(DummyModel.is_commontator).to eq false
|
38
|
+
expect(DummyUser).to respond_to(:acts_as_commontator)
|
39
|
+
expect(DummyUser).to respond_to(:is_commontator)
|
40
|
+
expect(DummyUser.is_commontator).to eq true
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'must modify models that act_as_commontator' do
|
44
|
+
user = DummyUser.create
|
45
|
+
expect(user).to respond_to(:comments)
|
46
|
+
expect(user).to respond_to(:subscriptions)
|
47
|
+
expect(user).to respond_to(:commontator_config)
|
48
|
+
expect(user.commontator_config).to be_a(CommontatorConfig)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
RSpec.describe CommontableConfig, type: :lib do
|
5
|
+
it 'must respond to commontable attributes' do
|
6
|
+
config = CommontableConfig.new
|
7
|
+
COMMONTABLE_ATTRIBUTES.each do |attribute|
|
8
|
+
expect(config).to respond_to(attribute)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "won't respond to engine or commontator attributes" do
|
13
|
+
config = CommontableConfig.new
|
14
|
+
(ENGINE_ATTRIBUTES + COMMONTATOR_ATTRIBUTES).each do |attribute|
|
15
|
+
expect(config).not_to respond_to(attribute)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'must be configurable' do
|
20
|
+
proc = lambda { |thread| 'Some name' }
|
21
|
+
proc2 = lambda { |thread| 'Another name' }
|
22
|
+
config = CommontableConfig.new(:commontable_name_proc => proc)
|
23
|
+
expect(config.commontable_name_proc).to eq proc
|
24
|
+
config = CommontableConfig.new(:commontable_name_proc => proc2)
|
25
|
+
(config.commontable_name_proc == proc2).must_equal true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
RSpec.describe CommontatorConfig, type: :lib do
|
5
|
+
it 'must respond to commontator attributes' do
|
6
|
+
config = CommontatorConfig.new
|
7
|
+
COMMONTATOR_ATTRIBUTES.each do |attribute|
|
8
|
+
config.must_respond_to attribute
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "won't respond to engine or commontable attributes" do
|
13
|
+
config = CommontatorConfig.new
|
14
|
+
(ENGINE_ATTRIBUTES + COMMONTABLE_ATTRIBUTES).each do |attribute|
|
15
|
+
expect(config).not_to respond_to(attribute)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'must be configurable' do
|
20
|
+
proc = lambda { |user| 'Some name' }
|
21
|
+
proc2 = lambda { |user| 'Another name' }
|
22
|
+
config = CommontatorConfig.new(:user_name_proc => proc)
|
23
|
+
expect(config.user_name_proc).to eq proc
|
24
|
+
config = CommontatorConfig.new(:user_name_proc => proc2)
|
25
|
+
expect(config.user_name_proc).to eq proc2
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
RSpec.describe ControllerIncludes, type: :lib do
|
5
|
+
it 'must add commontator_thread_show to ActionController instances' do
|
6
|
+
expect(ActionController::Base.new.respond_to?(:commontator_thread_show,
|
7
|
+
true)).to eq true
|
8
|
+
expect(DummyModelsController.new.respond_to?(:commontator_thread_show,
|
9
|
+
true)).to eq true
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'must add shared helper to ActionController and subclasses' do
|
13
|
+
expect(ActionController::Base.helpers).to respond_to(:commontator_thread)
|
14
|
+
DummyModelsController.helpers.must_respond_to :commontator_thread
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
RSpec.describe ControllerIncludes, type: :lib do
|
5
|
+
it 'must add commontator_thread_show to ActionController instances' do
|
6
|
+
expect(ActionController::Base.new.respond_to?(:commontator_thread_show,
|
7
|
+
true)).to eq true
|
8
|
+
expect(DummyModelsController.new.respond_to?(:commontator_thread_show,
|
9
|
+
true)).to eq true
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'must add shared helper to ActionController and subclasses' do
|
13
|
+
expect(ActionController::Base.helpers).to respond_to(:commontator_thread)
|
14
|
+
expect(DummyModelsController.helpers).to respond_to(:commontator_thread)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
RSpec.describe SharedHelper, type: :lib do
|
5
|
+
before(:each) do
|
6
|
+
setup_controller_spec
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'must show commontator thread' do
|
10
|
+
@user.can_read = true
|
11
|
+
sign_in @user
|
12
|
+
|
13
|
+
controller = DummyModelsController.new
|
14
|
+
|
15
|
+
thread_link = controller.view_context
|
16
|
+
.commontator_thread(DummyModel.create)
|
17
|
+
expect(thread_link).not_to be_blank
|
18
|
+
puts thread_link
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
RSpec.describe Commontator, type: :lib do
|
5
|
+
it 'must respond to all attributes' do
|
6
|
+
(ENGINE_ATTRIBUTES + COMMONTATOR_ATTRIBUTES + \
|
7
|
+
COMMONTABLE_ATTRIBUTES).each do |attribute|
|
8
|
+
expect(Commontator).to respond_to(attribute)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'must be configurable' do
|
13
|
+
l1 = lambda { |controller| controller.current_user }
|
14
|
+
l2 = lambda { |controller| controller.current_user }
|
15
|
+
Commontator.configure do |config|
|
16
|
+
config.current_user_proc = l1
|
17
|
+
end
|
18
|
+
expect(Commontator.current_user_proc).to eq l1
|
19
|
+
Commontator.configure do |config|
|
20
|
+
config.current_user_proc = l2
|
21
|
+
end
|
22
|
+
assert_equal(Commontator.current_user_proc, l2)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
RSpec.describe SubscriptionsMailer, type: :mailer do
|
5
|
+
before(:each) do
|
6
|
+
setup_mailer_spec
|
7
|
+
@user2 = DummyUser.create
|
8
|
+
@thread.subscribe(@user)
|
9
|
+
@thread.subscribe(@user2)
|
10
|
+
@comment = Comment.new
|
11
|
+
@comment.thread = @thread
|
12
|
+
@comment.creator = @user
|
13
|
+
@comment.body = 'Something'
|
14
|
+
@comment.save!
|
15
|
+
@recipients = @thread.subscribers.reject{|s| s == @user}
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'must create deliverable mail' do
|
19
|
+
mail = SubscriptionsMailer.comment_created(@comment, @recipients)
|
20
|
+
expect(mail.to).to eq I18n.t('commontator.email.undisclosed_recipients')
|
21
|
+
expect(mail.cc).to be_nil
|
22
|
+
expect(mail.bcc.size).to eq 1
|
23
|
+
expect(mail.bcc).to include(@user2.email)
|
24
|
+
expect(mail.subject).not_to be_empty
|
25
|
+
expect(mail.body).not_to be_empty
|
26
|
+
expect(mail.deliver).to eq mail
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
require 'acts_as_votable'
|
3
|
+
|
4
|
+
module Commontator
|
5
|
+
RSpec.describe Comment, type: :model do
|
6
|
+
before(:each) do
|
7
|
+
setup_model_spec
|
8
|
+
@comment = Comment.new
|
9
|
+
@comment.thread = @thread
|
10
|
+
@comment.creator = @user
|
11
|
+
@comment.body = 'Something'
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'must be votable if acts_as_votable is installed' do
|
15
|
+
Comment.must_respond_to(:acts_as_votable)
|
16
|
+
expect(@comment.is_votable?).to eq true
|
17
|
+
expect(@comment.acts_as_votable_initialized).to eq true
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'must know if it has been modified' do
|
21
|
+
@comment.save!
|
22
|
+
|
23
|
+
expect(@comment.is_modified?).to eq false
|
24
|
+
|
25
|
+
@comment.body = 'Something else'
|
26
|
+
@comment.editor = @user
|
27
|
+
@comment.save!
|
28
|
+
|
29
|
+
expect(@comment.is_modified?).to eq true
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'must know if it has been deleted' do
|
33
|
+
user = DummyUser.new
|
34
|
+
|
35
|
+
expect(@comment.is_deleted?).to eq false
|
36
|
+
expect(@comment.editor).to be_nil
|
37
|
+
|
38
|
+
@comment.delete_by(user)
|
39
|
+
|
40
|
+
expect(@comment.is_deleted?).to eq true
|
41
|
+
expect(@comment.editor).to eq user
|
42
|
+
|
43
|
+
@comment.undelete_by(user)
|
44
|
+
|
45
|
+
expect(@comment.is_deleted?).to eq false
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'must make proper timestamps' do
|
49
|
+
@comment.save!
|
50
|
+
|
51
|
+
expect(@comment.created_timestamp).to eq(
|
52
|
+
I18n.t('commontator.comment.status.created_at',
|
53
|
+
:created_at => I18n.l(@comment.created_at,
|
54
|
+
:format => :commontator))
|
55
|
+
)
|
56
|
+
expect(@comment.updated_timestamp).to eq(
|
57
|
+
I18n.t('commontator.comment.status.updated_at',
|
58
|
+
:editor_name => @user.name,
|
59
|
+
:updated_at => I18n.l(@comment.updated_at,
|
60
|
+
:format => :commontator))
|
61
|
+
)
|
62
|
+
|
63
|
+
user2 = DummyUser.create
|
64
|
+
@comment.body = 'Something else'
|
65
|
+
@comment.editor = user2
|
66
|
+
@comment.save!
|
67
|
+
|
68
|
+
expect(@comment.created_timestamp).to eq(
|
69
|
+
I18n.t('commontator.comment.status.created_at',
|
70
|
+
:created_at => I18n.l(@comment.created_at,
|
71
|
+
:format => :commontator))
|
72
|
+
)
|
73
|
+
expect(@comment.updated_timestamp).to eq(
|
74
|
+
I18n.t('commontator.comment.status.updated_at',
|
75
|
+
:editor_name => user2.name,
|
76
|
+
:updated_at => I18n.l(@comment.updated_at,
|
77
|
+
:format => :commontator))
|
78
|
+
)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
RSpec.describe Subscription, type: :model do
|
5
|
+
before(:each) do
|
6
|
+
setup_model_spec
|
7
|
+
@subscription = Subscription.new
|
8
|
+
@subscription.thread = @thread
|
9
|
+
@subscription.subscriber = @user
|
10
|
+
@subscription.save!
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'must count unread comments' do
|
14
|
+
expect(@subscription.unread_comments.count).to eq 0
|
15
|
+
|
16
|
+
comment = Comment.new
|
17
|
+
comment.thread = @thread
|
18
|
+
comment.creator = @user
|
19
|
+
comment.body = 'Something'
|
20
|
+
comment.save!
|
21
|
+
|
22
|
+
expect(@subscription.reload.unread_comments.count).to eq 1
|
23
|
+
|
24
|
+
comment = Comment.new
|
25
|
+
comment.thread = @thread
|
26
|
+
comment.creator = @user
|
27
|
+
comment.body = 'Something else'
|
28
|
+
comment.save!
|
29
|
+
|
30
|
+
expect(@subscription.reload.unread_comments.count).to eq 2
|
31
|
+
|
32
|
+
@subscription.touch
|
33
|
+
|
34
|
+
expect(@subscription.reload.unread_comments.count).to eq 0
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
@@ -113,6 +113,43 @@ module Commontator
|
|
113
113
|
expect(@commontable.thread.comments).not_to include(comment)
|
114
114
|
end
|
115
115
|
|
116
|
+
it 'must preserve the thread and comments by default when commontable is gone' do
|
117
|
+
comment = Comment.new
|
118
|
+
comment.thread = @thread
|
119
|
+
comment.creator = @user
|
120
|
+
comment.body = 'Undead'
|
121
|
+
comment.save!
|
122
|
+
comment.reload
|
123
|
+
|
124
|
+
expect(Thread.find(@thread.id)).to eq @thread
|
125
|
+
expect(Comment.find(comment.id)).to eq comment
|
126
|
+
|
127
|
+
@commontable.destroy!
|
128
|
+
|
129
|
+
expect(Thread.find(@thread.id)).to eq @thread
|
130
|
+
expect(Comment.find(comment.id)).to eq comment
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'must delete the thread and comments when commontable has dependent :destroy' do
|
134
|
+
commontable = DummyDependentModel.create
|
135
|
+
thread = commontable.thread
|
136
|
+
|
137
|
+
comment = Comment.new
|
138
|
+
comment.thread = thread
|
139
|
+
comment.creator = @user
|
140
|
+
comment.body = 'Undead'
|
141
|
+
comment.save!
|
142
|
+
comment.reload
|
143
|
+
|
144
|
+
expect(Thread.find(thread.id)).to eq thread
|
145
|
+
expect(Comment.find(comment.id)).to eq comment
|
146
|
+
|
147
|
+
commontable.destroy!
|
148
|
+
|
149
|
+
expect{Thread.find(thread.id)}.to raise_exception(ActiveRecord::RecordNotFound)
|
150
|
+
expect{Comment.find(comment.id)}.to raise_exception(ActiveRecord::RecordNotFound)
|
151
|
+
end
|
152
|
+
|
116
153
|
it 'must return nil subscription for nil or false subscriber' do
|
117
154
|
expect(@thread.subscription_for(nil)).to eq nil
|
118
155
|
expect(@thread.subscription_for(false)).to eq nil
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
RSpec.describe Thread, type: :model do
|
5
|
+
before(:each) do
|
6
|
+
setup_model_spec
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'must have a config' do
|
10
|
+
expect(@thread.config).to be_a(CommontableConfig)
|
11
|
+
@thread.update_attribute(:commontable_id, nil)
|
12
|
+
expect(Thread.find(@thread.id).config).to eq Commontator
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'must order all comments' do
|
16
|
+
comment = Comment.new
|
17
|
+
comment.thread = @thread
|
18
|
+
comment.creator = @user
|
19
|
+
comment.body = 'Something'
|
20
|
+
comment.save!
|
21
|
+
comment2 = Comment.new
|
22
|
+
comment2.thread = @thread
|
23
|
+
comment2.creator = @user
|
24
|
+
comment2.body = 'Something else'
|
25
|
+
comment2.save!
|
26
|
+
|
27
|
+
comments = @thread.comments
|
28
|
+
ordered_comments = @thread.ordered_comments
|
29
|
+
|
30
|
+
comments.each { |c| expect(ordered_comments).to include(c) }
|
31
|
+
ordered_comments.each { |oc| expect(comments).to include(oc) }
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'must list all subscribers' do
|
35
|
+
@thread.subscribe(@user)
|
36
|
+
@thread.subscribe(DummyUser.create)
|
37
|
+
|
38
|
+
@thread.subscriptions.each do |sp|
|
39
|
+
expect(@thread.subscribers).to include(sp.subscriber)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'must find the subscription for each user' do
|
44
|
+
@thread.subscribe(@user)
|
45
|
+
user2 = DummyUser.create
|
46
|
+
@thread.subscribe(user2)
|
47
|
+
|
48
|
+
subscription = @thread.subscription_for(@user)
|
49
|
+
expect(subscription.thread).to eq @thread
|
50
|
+
expect(subscription.subscriber).to eq @user
|
51
|
+
subscription = @thread.subscription_for(user2)
|
52
|
+
expect(subscription.thread).to eq @thread
|
53
|
+
expect(subscription.subscriber).to eq user2
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'must know if it is closed' do
|
57
|
+
expect(@thread.is_closed?).to eq false
|
58
|
+
|
59
|
+
@thread.close(@user)
|
60
|
+
|
61
|
+
expect(@thread.is_closed?).to eq true
|
62
|
+
expect(@thread.closer).to eq @user
|
63
|
+
|
64
|
+
@thread.reopen
|
65
|
+
|
66
|
+
expect(@thread.is_closed?).to eq false
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'must mark comments as read' do
|
70
|
+
@thread.subscribe(@user)
|
71
|
+
|
72
|
+
subscription = @thread.subscription_for(@user)
|
73
|
+
expect(subscription.unread_comments.count).to eq 0
|
74
|
+
|
75
|
+
comment = Comment.new
|
76
|
+
comment.thread = @thread
|
77
|
+
comment.creator = @user
|
78
|
+
comment.body = 'Something'
|
79
|
+
comment.save!
|
80
|
+
|
81
|
+
expect(subscription.reload.unread_comments.count).to eq 1
|
82
|
+
|
83
|
+
@thread.mark_as_read_for(@user)
|
84
|
+
|
85
|
+
expect(subscription.reload.unread_comments.count).to eq 0
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'must be able to clear comments' do
|
89
|
+
comment = Comment.new
|
90
|
+
comment.thread = @thread
|
91
|
+
comment.creator = @user
|
92
|
+
comment.body = 'Something'
|
93
|
+
comment.save!
|
94
|
+
|
95
|
+
@thread.close(@user)
|
96
|
+
|
97
|
+
expect(@thread.commontable).to eq @commontable
|
98
|
+
expect(@thread.comments).to include(comment)
|
99
|
+
expect(@thread.is_closed?).to eq true
|
100
|
+
expect(@thread.closer).to eq @user
|
101
|
+
|
102
|
+
@commontable = DummyModel.find(@commontable.id)
|
103
|
+
expect(@commontable.thread).to eq @thread
|
104
|
+
|
105
|
+
@thread.clear
|
106
|
+
|
107
|
+
expect(@thread.commontable).to be_nil
|
108
|
+
expect(@thread.comments).to include(comment)
|
109
|
+
|
110
|
+
@commontable = DummyModel.find(@commontable.id)
|
111
|
+
expect(@commontable.thread).to be_nil
|
112
|
+
expect(@commontable.thread).not_to eq @thread
|
113
|
+
expect(@commontable.thread.comments).not_to include(comment)
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'must return nil subscription for nil or false subscriber' do
|
117
|
+
expect(@thread.subscription_for(nil)).to eq nil
|
118
|
+
expect(@thread.subscription_for(false)).to eq nil
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|