activity_notification 1.4.4 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. checksums.yaml +5 -5
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +22 -0
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
  4. data/.github/pull_request_template.md +13 -0
  5. data/.github/workflows/build.yml +116 -0
  6. data/.gitignore +15 -3
  7. data/CHANGELOG.md +200 -1
  8. data/Gemfile +17 -2
  9. data/Procfile +2 -0
  10. data/README.md +168 -1033
  11. data/Rakefile +19 -10
  12. data/activity_notification.gemspec +14 -9
  13. data/app/channels/activity_notification/notification_api_channel.rb +12 -0
  14. data/app/channels/activity_notification/notification_api_with_devise_channel.rb +46 -0
  15. data/app/channels/activity_notification/notification_channel.rb +37 -0
  16. data/app/channels/activity_notification/notification_with_devise_channel.rb +51 -0
  17. data/app/controllers/activity_notification/apidocs_controller.rb +75 -0
  18. data/app/controllers/activity_notification/notifications_api_controller.rb +143 -0
  19. data/app/controllers/activity_notification/notifications_api_with_devise_controller.rb +7 -0
  20. data/app/controllers/activity_notification/notifications_controller.rb +60 -54
  21. data/app/controllers/activity_notification/subscriptions_api_controller.rb +197 -0
  22. data/app/controllers/activity_notification/subscriptions_api_with_devise_controller.rb +7 -0
  23. data/app/controllers/activity_notification/subscriptions_controller.rb +83 -73
  24. data/app/jobs/activity_notification/notify_all_job.rb +25 -0
  25. data/app/jobs/activity_notification/notify_job.rb +26 -0
  26. data/app/jobs/activity_notification/notify_to_job.rb +25 -0
  27. data/app/views/activity_notification/notifications/default/_default.html.erb +23 -23
  28. data/app/views/activity_notification/notifications/default/_default_without_grouping.html.erb +19 -19
  29. data/app/views/activity_notification/notifications/default/_index.html.erb +3 -3
  30. data/app/views/activity_notification/notifications/default/index.html.erb +60 -7
  31. data/app/views/activity_notification/notifications/default/open.js.erb +2 -2
  32. data/app/views/activity_notification/notifications/default/open_all.js.erb +2 -2
  33. data/app/views/activity_notification/notifications/default/show.html.erb +2 -2
  34. data/app/views/activity_notification/optional_targets/default/action_cable_channel/_default.html.erb +176 -0
  35. data/app/views/activity_notification/optional_targets/default/base/_default.text.erb +1 -1
  36. data/app/views/activity_notification/optional_targets/default/slack/_default.text.erb +1 -1
  37. data/app/views/activity_notification/subscriptions/default/_form.html.erb +2 -2
  38. data/app/views/activity_notification/subscriptions/default/_notification_keys.html.erb +5 -33
  39. data/app/views/activity_notification/subscriptions/default/_subscription.html.erb +8 -8
  40. data/app/views/activity_notification/subscriptions/default/index.html.erb +13 -9
  41. data/app/views/activity_notification/subscriptions/default/show.html.erb +3 -3
  42. data/app/views/activity_notification/subscriptions/default/subscribe.js.erb +1 -1
  43. data/app/views/activity_notification/subscriptions/default/subscribe_to_email.js.erb +1 -1
  44. data/app/views/activity_notification/subscriptions/default/subscribe_to_optional_target.js.erb +1 -1
  45. data/app/views/activity_notification/subscriptions/default/unsubscribe.js.erb +1 -1
  46. data/app/views/activity_notification/subscriptions/default/unsubscribe_to_email.js.erb +1 -1
  47. data/app/views/activity_notification/subscriptions/default/unsubscribe_to_optional_target.js.erb +1 -1
  48. data/bin/_dynamodblocal +4 -0
  49. data/bin/bundle_update.sh +7 -0
  50. data/bin/deploy_on_heroku.sh +16 -0
  51. data/bin/install_dynamodblocal.sh +5 -0
  52. data/bin/start_dynamodblocal.sh +47 -0
  53. data/bin/stop_dynamodblocal.sh +34 -0
  54. data/docs/CODE_OF_CONDUCT.md +76 -0
  55. data/docs/CONTRIBUTING.md +36 -0
  56. data/docs/Functions.md +1146 -0
  57. data/docs/Setup.md +817 -0
  58. data/docs/Testing.md +148 -0
  59. data/gemfiles/Gemfile.rails-5.0 +8 -1
  60. data/gemfiles/Gemfile.rails-5.1 +7 -1
  61. data/gemfiles/Gemfile.rails-5.2 +24 -0
  62. data/gemfiles/Gemfile.rails-6.0 +23 -0
  63. data/gemfiles/Gemfile.rails-6.1 +22 -0
  64. data/gemfiles/Gemfile.rails-7.0 +25 -0
  65. data/lib/activity_notification/apis/notification_api.rb +356 -159
  66. data/lib/activity_notification/apis/subscription_api.rb +98 -59
  67. data/lib/activity_notification/apis/swagger.rb +6 -0
  68. data/lib/activity_notification/common.rb +18 -7
  69. data/lib/activity_notification/config.rb +176 -30
  70. data/lib/activity_notification/controllers/common_api_controller.rb +30 -0
  71. data/lib/activity_notification/controllers/common_controller.rb +47 -27
  72. data/lib/activity_notification/controllers/concerns/swagger/error_responses.rb +55 -0
  73. data/lib/activity_notification/controllers/concerns/swagger/notifications_api.rb +273 -0
  74. data/lib/activity_notification/controllers/concerns/swagger/notifications_parameters.rb +92 -0
  75. data/lib/activity_notification/controllers/concerns/swagger/subscriptions_api.rb +405 -0
  76. data/lib/activity_notification/controllers/concerns/swagger/subscriptions_parameters.rb +50 -0
  77. data/lib/activity_notification/controllers/devise_authentication_controller.rb +22 -5
  78. data/lib/activity_notification/gem_version.rb +14 -0
  79. data/lib/activity_notification/helpers/errors.rb +6 -0
  80. data/lib/activity_notification/helpers/view_helpers.rb +118 -28
  81. data/lib/activity_notification/mailers/helpers.rb +19 -12
  82. data/lib/activity_notification/models/concerns/notifiable.rb +142 -55
  83. data/lib/activity_notification/models/concerns/subscriber.rb +28 -13
  84. data/lib/activity_notification/models/concerns/swagger/error_schema.rb +36 -0
  85. data/lib/activity_notification/models/concerns/swagger/notification_schema.rb +209 -0
  86. data/lib/activity_notification/models/concerns/swagger/subscription_schema.rb +162 -0
  87. data/lib/activity_notification/models/concerns/target.rb +131 -32
  88. data/lib/activity_notification/models/notification.rb +1 -0
  89. data/lib/activity_notification/models/subscription.rb +1 -0
  90. data/lib/activity_notification/models.rb +23 -1
  91. data/lib/activity_notification/optional_targets/action_cable_api_channel.rb +69 -0
  92. data/lib/activity_notification/optional_targets/action_cable_channel.rb +68 -0
  93. data/lib/activity_notification/optional_targets/base.rb +9 -15
  94. data/lib/activity_notification/orm/active_record/notification.rb +23 -34
  95. data/lib/activity_notification/orm/active_record/subscription.rb +1 -1
  96. data/lib/activity_notification/orm/active_record.rb +1 -1
  97. data/lib/activity_notification/orm/dynamoid/extension.rb +262 -0
  98. data/lib/activity_notification/orm/dynamoid/notification.rb +224 -0
  99. data/lib/activity_notification/orm/dynamoid/subscription.rb +82 -0
  100. data/lib/activity_notification/orm/dynamoid.rb +530 -0
  101. data/lib/activity_notification/orm/mongoid/notification.rb +29 -28
  102. data/lib/activity_notification/orm/mongoid/subscription.rb +3 -3
  103. data/lib/activity_notification/orm/mongoid.rb +33 -1
  104. data/lib/activity_notification/rails/routes.rb +273 -60
  105. data/lib/activity_notification/renderable.rb +22 -7
  106. data/lib/activity_notification/roles/acts_as_notifiable.rb +64 -1
  107. data/lib/activity_notification/roles/acts_as_target.rb +99 -9
  108. data/lib/activity_notification/version.rb +1 -1
  109. data/lib/activity_notification.rb +14 -0
  110. data/lib/generators/activity_notification/controllers_generator.rb +2 -1
  111. data/lib/generators/templates/activity_notification.rb +61 -7
  112. data/lib/generators/templates/controllers/README +2 -2
  113. data/lib/generators/templates/controllers/notifications_api_controller.rb +31 -0
  114. data/lib/generators/templates/controllers/notifications_api_with_devise_controller.rb +31 -0
  115. data/lib/generators/templates/controllers/notifications_controller.rb +1 -37
  116. data/lib/generators/templates/controllers/notifications_with_devise_controller.rb +1 -45
  117. data/lib/generators/templates/controllers/subscriptions_api_controller.rb +61 -0
  118. data/lib/generators/templates/controllers/subscriptions_api_with_devise_controller.rb +61 -0
  119. data/lib/generators/templates/controllers/subscriptions_controller.rb +14 -37
  120. data/lib/generators/templates/controllers/subscriptions_with_devise_controller.rb +14 -45
  121. data/lib/generators/templates/migrations/migration.rb +5 -5
  122. data/lib/generators/templates/models/README +8 -4
  123. data/lib/generators/templates/models/notification.rb +1 -1
  124. data/lib/generators/templates/models/subscription.rb +1 -1
  125. data/lib/tasks/activity_notification_tasks.rake +14 -4
  126. data/package.json +8 -0
  127. data/spec/channels/notification_api_channel_shared_examples.rb +59 -0
  128. data/spec/channels/notification_api_channel_spec.rb +49 -0
  129. data/spec/channels/notification_api_with_devise_channel_spec.rb +76 -0
  130. data/spec/channels/notification_channel_shared_examples.rb +59 -0
  131. data/spec/channels/notification_channel_spec.rb +48 -0
  132. data/spec/channels/notification_with_devise_channel_spec.rb +97 -0
  133. data/spec/concerns/apis/notification_api_spec.rb +177 -12
  134. data/spec/concerns/apis/subscription_api_spec.rb +146 -4
  135. data/spec/concerns/common_spec.rb +25 -3
  136. data/spec/concerns/models/notifiable_spec.rb +161 -11
  137. data/spec/concerns/models/subscriber_spec.rb +253 -79
  138. data/spec/concerns/models/target_spec.rb +180 -47
  139. data/spec/concerns/renderable_spec.rb +35 -16
  140. data/spec/config_spec.rb +52 -1
  141. data/spec/controllers/controller_spec_utility.rb +100 -0
  142. data/spec/controllers/notifications_api_controller_shared_examples.rb +506 -0
  143. data/spec/controllers/notifications_api_controller_spec.rb +19 -0
  144. data/spec/controllers/notifications_api_with_devise_controller_spec.rb +60 -0
  145. data/spec/controllers/notifications_controller_shared_examples.rb +55 -76
  146. data/spec/controllers/notifications_controller_spec.rb +1 -2
  147. data/spec/controllers/notifications_with_devise_controller_spec.rb +14 -8
  148. data/spec/controllers/subscriptions_api_controller_shared_examples.rb +750 -0
  149. data/spec/controllers/subscriptions_api_controller_spec.rb +19 -0
  150. data/spec/controllers/subscriptions_api_with_devise_controller_spec.rb +60 -0
  151. data/spec/controllers/subscriptions_controller_shared_examples.rb +99 -121
  152. data/spec/controllers/subscriptions_controller_spec.rb +1 -2
  153. data/spec/controllers/subscriptions_with_devise_controller_spec.rb +14 -8
  154. data/spec/factories/notifications.rb +1 -1
  155. data/spec/factories/subscriptions.rb +3 -3
  156. data/spec/factories/users.rb +3 -3
  157. data/spec/generators/migration/migration_generator_spec.rb +29 -4
  158. data/spec/helpers/view_helpers_spec.rb +31 -21
  159. data/spec/jobs/notify_all_job_spec.rb +23 -0
  160. data/spec/jobs/notify_job_spec.rb +23 -0
  161. data/spec/jobs/notify_to_job_spec.rb +23 -0
  162. data/spec/mailers/mailer_spec.rb +42 -1
  163. data/spec/models/dummy/dummy_group_spec.rb +4 -0
  164. data/spec/models/dummy/dummy_notifiable_spec.rb +4 -0
  165. data/spec/models/dummy/dummy_notifier_spec.rb +4 -0
  166. data/spec/models/dummy/dummy_subscriber_spec.rb +3 -0
  167. data/spec/models/dummy/dummy_target_spec.rb +4 -0
  168. data/spec/models/notification_spec.rb +181 -45
  169. data/spec/models/subscription_spec.rb +77 -27
  170. data/spec/optional_targets/action_cable_api_channel_spec.rb +34 -0
  171. data/spec/optional_targets/action_cable_channel_spec.rb +41 -0
  172. data/spec/optional_targets/amazon_sns_spec.rb +0 -2
  173. data/spec/optional_targets/slack_spec.rb +0 -2
  174. data/spec/orm/dynamoid_spec.rb +115 -0
  175. data/spec/rails_app/Rakefile +9 -0
  176. data/spec/rails_app/app/assets/config/manifest.js +3 -0
  177. data/spec/rails_app/app/assets/javascripts/application.js +2 -1
  178. data/spec/rails_app/app/assets/javascripts/cable.js +12 -0
  179. data/spec/rails_app/app/controllers/admins_controller.rb +21 -0
  180. data/spec/rails_app/app/controllers/application_controller.rb +1 -1
  181. data/spec/rails_app/app/controllers/articles_controller.rb +6 -1
  182. data/spec/rails_app/app/controllers/comments_controller.rb +3 -1
  183. data/spec/rails_app/app/controllers/spa_controller.rb +7 -0
  184. data/spec/rails_app/app/controllers/users/notifications_controller.rb +0 -65
  185. data/spec/rails_app/app/controllers/users/notifications_with_devise_controller.rb +0 -73
  186. data/spec/rails_app/app/controllers/users/subscriptions_controller.rb +0 -77
  187. data/spec/rails_app/app/controllers/users/subscriptions_with_devise_controller.rb +0 -85
  188. data/spec/rails_app/app/controllers/users_controller.rb +26 -0
  189. data/spec/rails_app/app/javascript/App.vue +40 -0
  190. data/spec/rails_app/app/javascript/components/DeviseTokenAuth.vue +82 -0
  191. data/spec/rails_app/app/javascript/components/Top.vue +98 -0
  192. data/spec/rails_app/app/javascript/components/notifications/Index.vue +200 -0
  193. data/spec/rails_app/app/javascript/components/notifications/Notification.vue +133 -0
  194. data/spec/rails_app/app/javascript/components/notifications/NotificationContent.vue +122 -0
  195. data/spec/rails_app/app/javascript/components/subscriptions/Index.vue +279 -0
  196. data/spec/rails_app/app/javascript/components/subscriptions/NewSubscription.vue +112 -0
  197. data/spec/rails_app/app/javascript/components/subscriptions/NotificationKey.vue +141 -0
  198. data/spec/rails_app/app/javascript/components/subscriptions/Subscription.vue +226 -0
  199. data/spec/rails_app/app/javascript/config/development.js +5 -0
  200. data/spec/rails_app/app/javascript/config/environment.js +7 -0
  201. data/spec/rails_app/app/javascript/config/production.js +5 -0
  202. data/spec/rails_app/app/javascript/config/test.js +5 -0
  203. data/spec/rails_app/app/javascript/packs/application.js +18 -0
  204. data/spec/rails_app/app/javascript/packs/spa.js +14 -0
  205. data/spec/rails_app/app/javascript/router/index.js +73 -0
  206. data/spec/rails_app/app/javascript/store/index.js +37 -0
  207. data/spec/rails_app/app/models/admin.rb +15 -10
  208. data/spec/rails_app/app/models/article.rb +25 -20
  209. data/spec/rails_app/app/models/comment.rb +27 -62
  210. data/spec/rails_app/app/models/dummy/dummy_base.rb +1 -0
  211. data/spec/rails_app/app/models/dummy/dummy_group.rb +9 -0
  212. data/spec/rails_app/app/models/dummy/dummy_notifiable.rb +1 -0
  213. data/spec/rails_app/app/models/dummy/dummy_notifiable_target.rb +27 -0
  214. data/spec/rails_app/app/models/dummy/dummy_notifier.rb +1 -0
  215. data/spec/rails_app/app/models/dummy/dummy_subscriber.rb +1 -0
  216. data/spec/rails_app/app/models/dummy/dummy_target.rb +1 -0
  217. data/spec/rails_app/app/models/user.rb +44 -18
  218. data/spec/rails_app/app/views/activity_notification/notifications/default/article/_update.html.erb +146 -0
  219. data/spec/rails_app/app/views/activity_notification/notifications/users/overridden/custom/_test.html.erb +1 -0
  220. data/spec/rails_app/app/views/activity_notification/optional_targets/admins/amazon_sns/comment/_default.text.erb +1 -1
  221. data/spec/rails_app/app/views/articles/index.html.erb +68 -20
  222. data/spec/rails_app/app/views/articles/show.html.erb +1 -1
  223. data/spec/rails_app/app/views/layouts/_header.html.erb +9 -3
  224. data/spec/rails_app/app/views/spa/index.html.erb +2 -0
  225. data/spec/rails_app/babel.config.js +72 -0
  226. data/spec/rails_app/bin/webpack +18 -0
  227. data/spec/rails_app/bin/webpack-dev-server +18 -0
  228. data/spec/rails_app/config/application.rb +26 -6
  229. data/spec/rails_app/config/cable.yml +8 -0
  230. data/spec/rails_app/config/database.yml +1 -1
  231. data/spec/rails_app/config/dynamoid.rb +13 -0
  232. data/spec/rails_app/config/environment.rb +5 -1
  233. data/spec/rails_app/config/environments/development.rb +5 -0
  234. data/spec/rails_app/config/environments/production.rb +7 -1
  235. data/spec/rails_app/config/environments/test.rb +7 -11
  236. data/spec/rails_app/config/initializers/activity_notification.rb +63 -9
  237. data/spec/rails_app/config/initializers/copy_it.aws.rb.template +6 -0
  238. data/spec/rails_app/config/initializers/devise_token_auth.rb +55 -0
  239. data/spec/rails_app/config/initializers/mysql.rb +9 -0
  240. data/spec/rails_app/config/locales/activity_notification.en.yml +10 -4
  241. data/spec/rails_app/config/routes.rb +42 -1
  242. data/spec/rails_app/config/webpack/development.js +5 -0
  243. data/spec/rails_app/config/webpack/environment.js +7 -0
  244. data/spec/rails_app/config/webpack/loaders/vue.js +6 -0
  245. data/spec/rails_app/config/webpack/production.js +5 -0
  246. data/spec/rails_app/config/webpack/test.js +5 -0
  247. data/spec/rails_app/config/webpacker.yml +97 -0
  248. data/spec/rails_app/db/migrate/{20160715050433_create_test_tables.rb → 20160716000000_create_test_tables.rb} +1 -1
  249. data/spec/rails_app/db/migrate/{20160715050420_create_activity_notification_tables.rb → 20181209000000_create_activity_notification_tables.rb} +3 -3
  250. data/spec/rails_app/db/migrate/20191201000000_add_tokens_to_users.rb +10 -0
  251. data/spec/rails_app/db/schema.rb +46 -43
  252. data/spec/rails_app/db/seeds.rb +28 -4
  253. data/spec/rails_app/lib/custom_optional_targets/raise_error.rb +14 -0
  254. data/spec/rails_app/lib/mailer_previews/mailer_preview.rb +14 -4
  255. data/spec/rails_app/package.json +23 -0
  256. data/spec/rails_app/postcss.config.js +12 -0
  257. data/spec/roles/acts_as_group_spec.rb +0 -2
  258. data/spec/roles/acts_as_notifiable_spec.rb +80 -20
  259. data/spec/roles/acts_as_notifier_spec.rb +0 -2
  260. data/spec/roles/acts_as_target_spec.rb +1 -5
  261. data/spec/spec_helper.rb +13 -11
  262. data/spec/version_spec.rb +31 -0
  263. metadata +306 -53
  264. data/.travis.yml +0 -85
  265. data/Gemfile.lock +0 -234
  266. data/gemfiles/Gemfile.rails-4.2 +0 -17
  267. data/gemfiles/Gemfile.rails-4.2.lock +0 -225
  268. data/gemfiles/Gemfile.rails-5.0.lock +0 -234
  269. data/gemfiles/Gemfile.rails-5.1.lock +0 -234
  270. data/spec/rails_app/app/views/activity_notification/notifications/users/overriden/custom/_test.html.erb +0 -1
  271. /data/spec/rails_app/app/{models → assets/images}/.keep +0 -0
@@ -1,8 +1,15 @@
1
1
  # coding: utf-8
2
2
  # This file is seed file for test data on development environment.
3
3
 
4
- def clear_database
5
- [ActivityNotification::Notification, ActivityNotification::Subscription, Comment, Article, Admin, User].each do |model|
4
+ def clean_database
5
+ models = [Comment, Article, Admin, User]
6
+ if ENV['AN_USE_EXISTING_DYNAMODB_TABLE']
7
+ ActivityNotification::Notification.where('id.not_null': true).delete_all
8
+ ActivityNotification::Subscription.where('id.not_null': true).delete_all
9
+ else
10
+ models.concat([ActivityNotification::Notification, ActivityNotification::Subscription])
11
+ end
12
+ models.each do |model|
6
13
  model.delete_all
7
14
  end
8
15
  end
@@ -29,8 +36,11 @@ def reset_pk_sequence
29
36
  end
30
37
  end
31
38
 
32
- clear_database
39
+ clean_database
40
+ puts "* Cleaned database"
41
+
33
42
  reset_pk_sequence
43
+ puts "* Reset sequences for primary keys"
34
44
 
35
45
  ['Ichiro', 'Stephen', 'Klay', 'Kevin'].each do |name|
36
46
  user = User.new(
@@ -42,6 +52,7 @@ reset_pk_sequence
42
52
  user.skip_confirmation!
43
53
  user.save!
44
54
  end
55
+ puts "* Created #{User.count} user records"
45
56
 
46
57
  ['Ichiro'].each do |name|
47
58
  user = User.find_by(name: name)
@@ -51,6 +62,7 @@ end
51
62
  slack_username: ENV['OPTIONAL_TARGET_SLACK_USERNAME']
52
63
  )
53
64
  end
65
+ puts "* Created #{Admin.count} admin records"
54
66
 
55
67
  User.all.each do |user|
56
68
  article = user.articles.create(
@@ -59,6 +71,11 @@ User.all.each do |user|
59
71
  )
60
72
  article.notify :users, send_email: false
61
73
  end
74
+ puts "* Created #{Article.count} article records"
75
+ notifications = ActivityNotification::Notification.filtered_by_type("Article")
76
+ puts "** Generated #{ActivityNotification::Notification.filtered_by_type("Article").count} notification records for new articles"
77
+ puts "*** #{ActivityNotification::Notification.filtered_by_type("Article").filtered_by_target_type("User").count} notifications as #{ActivityNotification::Notification.filtered_by_type("Article").filtered_by_target_type("User").group_owners_only.count} groups to users"
78
+ puts "*** #{ActivityNotification::Notification.filtered_by_type("Article").filtered_by_target_type("Admin").count} notifications as #{ActivityNotification::Notification.filtered_by_type("Article").filtered_by_target_type("Admin").group_owners_only.count} groups to admins"
62
79
 
63
80
  Article.all.each do |article|
64
81
  User.all.each do |user|
@@ -68,4 +85,11 @@ Article.all.each do |article|
68
85
  )
69
86
  comment.notify :users, send_email: false
70
87
  end
71
- end
88
+ end
89
+ puts "* Created #{Comment.count} comment records"
90
+ notifications = ActivityNotification::Notification.filtered_by_type("Comment")
91
+ puts "** Generated #{ActivityNotification::Notification.filtered_by_type("Comment").count} notification records for new comments"
92
+ puts "*** #{ActivityNotification::Notification.filtered_by_type("Comment").filtered_by_target_type("User").count} notifications as #{ActivityNotification::Notification.filtered_by_type("Comment").filtered_by_target_type("User").group_owners_only.count} groups to users"
93
+ puts "*** #{ActivityNotification::Notification.filtered_by_type("Comment").filtered_by_target_type("Admin").count} notifications as #{ActivityNotification::Notification.filtered_by_type("Comment").filtered_by_target_type("Admin").group_owners_only.count} groups to admins"
94
+
95
+ puts "Created ActivityNotification test records!"
@@ -0,0 +1,14 @@
1
+ module CustomOptionalTarget
2
+ # Optional target implementation to raise error.
3
+ class RaiseError < ActivityNotification::OptionalTarget::Base
4
+ def initialize_target(options = {})
5
+ @raise_error = options[:raise_error] == false ? false : true
6
+ end
7
+
8
+ def notify(notification, options = {})
9
+ if @raise_error
10
+ raise 'Intentional RuntimeError in CustomOptionalTarget::RaiseError'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,19 +1,29 @@
1
1
  class ActivityNotification::MailerPreview < ActionMailer::Preview
2
2
 
3
3
  def send_notification_email_single
4
- target_notification = ActivityNotification::Notification.where(group: nil).first
4
+ target_notification =
5
+ case ActivityNotification.config.orm
6
+ when :active_record then ActivityNotification::Notification.where(group: nil).first
7
+ when :mongoid then ActivityNotification::Notification.where(group: nil).first
8
+ when :dynamoid then ActivityNotification::Notification.where('group_key.null': true).first
9
+ end
5
10
  ActivityNotification::Mailer.send_notification_email(target_notification)
6
11
  end
7
12
 
8
13
  def send_notification_email_with_group
9
- target_notification = ActivityNotification::Notification.where.not(group: nil).first
14
+ target_notification =
15
+ case ActivityNotification.config.orm
16
+ when :active_record then ActivityNotification::Notification.where.not(group: nil).first
17
+ when :mongoid then ActivityNotification::Notification.where(:group_id.nin => ["", nil]).first
18
+ when :dynamoid then ActivityNotification::Notification.where('group_key.not_null': true).first
19
+ end
10
20
  ActivityNotification::Mailer.send_notification_email(target_notification)
11
21
  end
12
22
 
13
23
  def send_batch_notification_email
14
- target = User.find_by_name('Ichiro')
24
+ target = User.find_by(name: 'Ichiro')
15
25
  target_notifications = target.notification_index_with_attributes(filtered_by_key: 'comment.default')
16
- ActivityNotification::Mailer.send_batch_notification_email(target, target_notifications)
26
+ ActivityNotification::Mailer.send_batch_notification_email(target, target_notifications, 'batch.comment.default')
17
27
  end
18
28
 
19
29
  end
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "activity_notification",
3
+ "description": "Sample single page application for activity_notification using Vue.js",
4
+ "dependencies": {
5
+ "@rails/webpacker": ">=4.3.0",
6
+ "axios": ">=0.21.1",
7
+ "vue": ">=2.6.10",
8
+ "vuex": ">=3.1.2",
9
+ "vuex-persistedstate": ">=2.7.0",
10
+ "vue-loader": ">=15.7.2",
11
+ "vue-router": ">=3.1.3",
12
+ "vue-template-compiler": ">=2.6.10",
13
+ "vue-moment": ">=4.1.0",
14
+ "vue-moment-tz": ">=2.1.1",
15
+ "vue-pluralize": ">=0.0.2",
16
+ "actioncable-vue": ">=1.5.1",
17
+ "push.js": ">=1.0.12"
18
+ },
19
+ "devDependencies": {
20
+ "webpack-dev-server": ">=3.11.0"
21
+ },
22
+ "license": "MIT"
23
+ }
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ plugins: [
3
+ require('postcss-import'),
4
+ require('postcss-flexbugs-fixes'),
5
+ require('postcss-preset-env')({
6
+ autoprefixer: {
7
+ flexbox: 'no-2009'
8
+ },
9
+ stage: 3
10
+ })
11
+ ]
12
+ }
@@ -18,8 +18,6 @@ describe ActivityNotification::ActsAsGroup do
18
18
  expect(dummy_model_class.acts_as_group).to eq({})
19
19
  end
20
20
  end
21
-
22
- #TODO test other options
23
21
  end
24
22
 
25
23
  describe ".available_group_options" do
@@ -1,4 +1,5 @@
1
1
  describe ActivityNotification::ActsAsNotifiable do
2
+ include ActiveJob::TestHelper
2
3
  let(:dummy_model_class) { Dummy::DummyBase }
3
4
  let(:dummy_notifiable_class) { Dummy::DummyNotifiable }
4
5
  let(:user_target) { create(:confirmed_user) }
@@ -11,6 +12,7 @@ describe ActivityNotification::ActsAsNotifiable do
11
12
  dummy_notifiable_class.reset_callbacks :create
12
13
  dummy_notifiable_class.reset_callbacks :update
13
14
  dummy_notifiable_class.reset_callbacks :destroy
15
+ dummy_notifiable_class.reset_callbacks :commit if dummy_notifiable_class.respond_to? :after_commit
14
16
  @notifiable = dummy_notifiable_class.create
15
17
  end
16
18
 
@@ -52,7 +54,7 @@ describe ActivityNotification::ActsAsNotifiable do
52
54
 
53
55
  context "true as :tracked" do
54
56
  before do
55
- dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: true
57
+ dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: true, notifiable_path: -> { "dummy_path" }
56
58
  @created_notifiable = dummy_notifiable_class.create
57
59
  end
58
60
 
@@ -83,11 +85,25 @@ describe ActivityNotification::ActsAsNotifiable do
83
85
  .to eq(@notifiable.notification_key_for_tracked_update)
84
86
  end
85
87
  end
88
+
89
+ context "when the target is also configured as notifiable" do
90
+ before do
91
+ ActivityNotification::Notification.filtered_by_type("Dummy::DummyNotifiableTarget").delete_all
92
+ Dummy::DummyNotifiableTarget.delete_all
93
+ @created_target = Dummy::DummyNotifiableTarget.create
94
+ @created_notifiable = Dummy::DummyNotifiableTarget.create
95
+ end
96
+
97
+ it "generates notifications to specified targets" do
98
+ expect(@created_target.notifications.filtered_by_instance(@created_notifiable).count).to eq(1)
99
+ expect(@created_notifiable.notifications.filtered_by_instance(@created_notifiable).count).to eq(1)
100
+ end
101
+ end
86
102
  end
87
103
 
88
104
  context "with :only option (creation only)" do
89
105
  before do
90
- dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: { only: [:create] }
106
+ dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: { only: [:create] }, notifiable_path: -> { "dummy_path" }
91
107
  @created_notifiable = dummy_notifiable_class.create
92
108
  end
93
109
 
@@ -117,7 +133,7 @@ describe ActivityNotification::ActsAsNotifiable do
117
133
 
118
134
  context "with :except option (except update)" do
119
135
  before do
120
- dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: { except: [:update] }
136
+ dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: { except: [:update] }, notifiable_path: -> { "dummy_path" }
121
137
  @created_notifiable = dummy_notifiable_class.create
122
138
  end
123
139
 
@@ -147,7 +163,7 @@ describe ActivityNotification::ActsAsNotifiable do
147
163
 
148
164
  context "with :key option" do
149
165
  before do
150
- dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: { key: "test.key" }
166
+ dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: { key: "test.key" }, notifiable_path: -> { "dummy_path" }
151
167
  @created_notifiable = dummy_notifiable_class.create
152
168
  end
153
169
 
@@ -179,10 +195,55 @@ describe ActivityNotification::ActsAsNotifiable do
179
195
  end
180
196
  end
181
197
  end
198
+
199
+ context "with :notify_later option" do
200
+ before do
201
+ ActiveJob::Base.queue_adapter = :test
202
+ dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: { notify_later: true }, notifiable_path: -> { "dummy_path" }
203
+ @created_notifiable = dummy_notifiable_class.create
204
+ end
205
+
206
+ context "creation" do
207
+ it "generates notifications later when notifiable is created" do
208
+ expect {
209
+ @created_notifiable = dummy_notifiable_class.create
210
+ }.to have_enqueued_job(ActivityNotification::NotifyJob)
211
+ end
212
+
213
+ it "creates notification records later when notifiable is created" do
214
+ perform_enqueued_jobs do
215
+ @created_notifiable = dummy_notifiable_class.create
216
+ end
217
+ expect(user_target.notifications.filtered_by_instance(@created_notifiable).count).to eq(1)
218
+ end
219
+ end
220
+
221
+ context "update" do
222
+ before do
223
+ user_target.notifications.delete_all
224
+ expect(user_target.notifications.count).to eq(0)
225
+ @notifiable.update(created_at: @notifiable.updated_at)
226
+ end
227
+
228
+ it "generates notifications later when notifiable is created" do
229
+ expect {
230
+ @notifiable.update(created_at: @notifiable.updated_at)
231
+ }.to have_enqueued_job(ActivityNotification::NotifyJob)
232
+ end
233
+
234
+ it "creates notification records later when notifiable is created" do
235
+ perform_enqueued_jobs do
236
+ @notifiable.update(created_at: @notifiable.updated_at)
237
+ end
238
+ expect(user_target.notifications.filtered_by_instance(@notifiable).count).to eq(1)
239
+ end
240
+ end
241
+ end
182
242
  end
183
243
 
184
244
  context "with :dependent_notifications option" do
185
245
  before do
246
+ dummy_notifiable_class.delete_all
186
247
  @notifiable_1, @notifiable_2, @notifiable_3 = dummy_notifiable_class.create, dummy_notifiable_class.create, dummy_notifiable_class.create
187
248
  @group_owner = create(:notification, target: user_target, notifiable: @notifiable_1, group: @notifiable_1)
188
249
  @group_member = create(:notification, target: user_target, notifiable: @notifiable_2, group: @notifiable_1, group_owner: @group_owner)
@@ -205,7 +266,7 @@ describe ActivityNotification::ActsAsNotifiable do
205
266
  it "does not deletes any notifications when notifiable is deleted" do
206
267
  dummy_notifiable_class.acts_as_notifiable :users
207
268
  expect(user_target.notifications.reload.size).to eq(3)
208
- expect { @notifiable_1.destroy }.to change(dummy_notifiable_class, :count).by(-1)
269
+ expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
209
270
  expect(user_target.notifications.reload.size).to eq(3)
210
271
  end
211
272
  end
@@ -214,14 +275,14 @@ describe ActivityNotification::ActsAsNotifiable do
214
275
  it "deletes all notifications when notifiable is deleted" do
215
276
  dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :delete_all
216
277
  expect(user_target.notifications.reload.size).to eq(3)
217
- expect { @notifiable_1.destroy }.to change(dummy_notifiable_class, :count).by(-1)
278
+ expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
218
279
  expect(user_target.notifications.reload.size).to eq(2)
219
280
  expect(@group_member.reload.group_owner?).to be_falsey
220
281
  end
221
282
 
222
283
  it "does not delete notifications of other targets when notifiable is deleted" do
223
284
  dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :delete_all
224
- expect { @notifiable_1.destroy }.to change(dummy_notifiable_class, :count).by(-1)
285
+ expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
225
286
  expect(user_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(0)
226
287
  expect(dummy_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(1)
227
288
  end
@@ -231,14 +292,14 @@ describe ActivityNotification::ActsAsNotifiable do
231
292
  it "destroies all notifications when notifiable is deleted" do
232
293
  dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :destroy
233
294
  expect(user_target.notifications.reload.size).to eq(3)
234
- expect { @notifiable_1.destroy }.to change(dummy_notifiable_class, :count).by(-1)
295
+ expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
235
296
  expect(user_target.notifications.reload.size).to eq(2)
236
297
  expect(@group_member.reload.group_owner?).to be_falsey
237
298
  end
238
299
 
239
300
  it "does not destroy notifications of other targets when notifiable is deleted" do
240
301
  dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :destroy
241
- expect { @notifiable_1.destroy }.to change(dummy_notifiable_class, :count).by(-1)
302
+ expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
242
303
  expect(user_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(0)
243
304
  expect(dummy_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(1)
244
305
  end
@@ -251,7 +312,7 @@ describe ActivityNotification::ActsAsNotifiable do
251
312
  if ActivityNotification.config.orm == :active_record
252
313
  expect { @notifiable_1.destroy }.to raise_error(ActiveRecord::DeleteRestrictionError)
253
314
  else
254
- expect { @notifiable_1.destroy }.to raise_error(RuntimeError)
315
+ expect { @notifiable_1.destroy }.to raise_error(ActivityNotification::DeleteRestrictionError)
255
316
  end
256
317
  end
257
318
  end
@@ -260,7 +321,8 @@ describe ActivityNotification::ActsAsNotifiable do
260
321
  it "can not be deleted when it has generated notifications" do
261
322
  dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :restrict_with_error
262
323
  expect(user_target.notifications.reload.size).to eq(3)
263
- expect { @notifiable_1.destroy }.to change(dummy_notifiable_class, :count).by(0)
324
+ @notifiable_1.destroy
325
+ expect(@notifiable_1.destroyed?).to be_falsey
264
326
  end
265
327
  end
266
328
 
@@ -268,21 +330,21 @@ describe ActivityNotification::ActsAsNotifiable do
268
330
  it "deletes all notifications and update notification group when notifiable is deleted" do
269
331
  dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :update_group_and_delete_all
270
332
  expect(user_target.notifications.reload.size).to eq(3)
271
- expect { @notifiable_1.destroy }.to change(dummy_notifiable_class, :count).by(-1)
333
+ expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
272
334
  expect(user_target.notifications.reload.size).to eq(2)
273
335
  expect(@group_member.reload.group_owner?).to be_truthy
274
336
  end
275
337
 
276
338
  it "does not delete notifications of other targets when notifiable is deleted" do
277
339
  dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :update_group_and_delete_all
278
- expect { @notifiable_1.destroy }.to change(dummy_notifiable_class, :count).by(-1)
340
+ expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
279
341
  expect(user_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(0)
280
342
  expect(dummy_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(1)
281
343
  end
282
344
 
283
345
  it "does not update notification group when notifiable is deleted" do
284
346
  dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :update_group_and_delete_all
285
- expect { @notifiable_1.destroy }.to change(dummy_notifiable_class, :count).by(-1)
347
+ expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
286
348
  expect(@group_member.reload.group_owner?).to be_truthy
287
349
  expect(@other_target_group_member.reload.group_owner?).to be_falsey
288
350
  end
@@ -292,21 +354,21 @@ describe ActivityNotification::ActsAsNotifiable do
292
354
  it "destroies all notifications and update notification group when notifiable is deleted" do
293
355
  dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :update_group_and_destroy
294
356
  expect(user_target.notifications.reload.size).to eq(3)
295
- expect { @notifiable_1.destroy }.to change(dummy_notifiable_class, :count).by(-1)
357
+ expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
296
358
  expect(user_target.notifications.reload.size).to eq(2)
297
359
  expect(@group_member.reload.group_owner?).to be_truthy
298
360
  end
299
361
 
300
362
  it "does not destroy notifications of other targets when notifiable is deleted" do
301
363
  dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :update_group_and_destroy
302
- expect { @notifiable_1.destroy }.to change(dummy_notifiable_class, :count).by(-1)
364
+ expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
303
365
  expect(user_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(0)
304
366
  expect(dummy_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(1)
305
367
  end
306
368
 
307
369
  it "does not update notification group when notifiable is deleted" do
308
370
  dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :update_group_and_destroy
309
- expect { @notifiable_1.destroy }.to change(dummy_notifiable_class, :count).by(-1)
371
+ expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
310
372
  expect(@group_member.reload.group_owner?).to be_truthy
311
373
  expect(@other_target_group_member.reload.group_owner?).to be_falsey
312
374
  end
@@ -358,14 +420,12 @@ describe ActivityNotification::ActsAsNotifiable do
358
420
  end
359
421
  end
360
422
  end
361
-
362
- #TODO test other options
363
423
  end
364
424
 
365
425
  describe ".available_notifiable_options" do
366
426
  it "returns list of available options in acts_as_notifiable" do
367
427
  expect(dummy_model_class.available_notifiable_options)
368
- .to eq([:targets, :group, :group_expiry_delay, :notifier, :parameters, :email_allowed, :notifiable_path, :printable_notifiable_name, :printable_name, :dependent_notifications, :optional_targets])
428
+ .to eq([:targets, :group, :group_expiry_delay, :notifier, :parameters, :email_allowed, :action_cable_allowed, :action_cable_api_allowed, :notifiable_path, :printable_notifiable_name, :printable_name, :dependent_notifications, :optional_targets])
369
429
  end
370
430
  end
371
431
  end
@@ -18,8 +18,6 @@ describe ActivityNotification::ActsAsNotifier do
18
18
  expect(dummy_model_class.acts_as_notifier).to eq({})
19
19
  end
20
20
  end
21
-
22
- #TODO test other options
23
21
  end
24
22
 
25
23
  describe ".available_notifier_options" do
@@ -18,14 +18,10 @@ describe ActivityNotification::ActsAsTarget do
18
18
  expect(dummy_model_class.acts_as_target).to eq({})
19
19
  end
20
20
  end
21
-
22
- #TODO test other options
23
21
  end
24
22
 
25
23
  describe ".acts_as_notification_target" do
26
24
  it "is an alias of acts_as_target" do
27
- #TODO make better way to test alias
28
- #expect(dummy_model_class.acts_as_notification_target).to receive(:acts_as_target)
29
25
  expect(dummy_model_class.respond_to?(:acts_as_notification_target)).to be_truthy
30
26
  end
31
27
  end
@@ -33,7 +29,7 @@ describe ActivityNotification::ActsAsTarget do
33
29
  describe ".available_target_options" do
34
30
  it "returns list of available options in acts_as_target" do
35
31
  expect(dummy_model_class.available_target_options)
36
- .to eq([:email, :email_allowed, :batch_email_allowed, :subscription_allowed, :devise_resource, :printable_notification_target_name, :printable_name])
32
+ .to eq([:email, :email_allowed, :batch_email_allowed, :subscription_allowed, :action_cable_enabled, :action_cable_with_devise, :devise_resource, :printable_notification_target_name, :printable_name])
37
33
  end
38
34
  end
39
35
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  ENV["RAILS_ENV"] ||= "test"
2
+ Warning[:deprecated] = true if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.2")
2
3
 
3
4
  require 'bundler/setup'
4
5
  Bundler.setup
@@ -14,30 +15,31 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new [
14
15
  SimpleCov.start('rails') do
15
16
  add_filter '/spec/'
16
17
  add_filter '/lib/generators/templates/'
17
- add_filter '/lib/activity_notification/version.rb'
18
- if Rails::VERSION::MAJOR == 5
19
- nocov_token 'skip-rails5'
20
- elsif Rails::VERSION::MAJOR == 4
21
- nocov_token 'skip-rails4'
22
- end
18
+ add_filter '/lib/activity_notification/version'
23
19
  if ENV['AN_ORM'] == 'mongoid'
24
20
  add_filter '/lib/activity_notification/orm/active_record'
21
+ add_filter '/lib/activity_notification/orm/dynamoid'
22
+ elsif ENV['AN_ORM'] == 'dynamoid'
23
+ add_filter '/lib/activity_notification/orm/active_record'
24
+ add_filter '/lib/activity_notification/orm/mongoid'
25
25
  else
26
26
  add_filter '/lib/activity_notification/orm/mongoid'
27
+ add_filter '/lib/activity_notification/orm/dynamoid'
27
28
  end
28
29
  end
29
30
 
30
- # Testing with Devise
31
- require 'devise'
32
31
  # Dummy application
33
32
  require 'rails_app/config/environment'
34
33
 
35
34
  require 'rspec/rails'
36
35
  require 'ammeter/init'
36
+ require "action_cable/testing/rspec" if Rails::VERSION::MAJOR == 5
37
37
  require 'factory_bot_rails'
38
38
  require 'activity_notification'
39
39
 
40
- def clear_database
40
+ Dir[Rails.root.join("../../spec/support/**/*.rb")].each { |file| require file }
41
+
42
+ def clean_database
41
43
  [ActivityNotification::Notification, ActivityNotification::Subscription, Comment, Article, Admin, User].each do |model_class|
42
44
  model_class.delete_all
43
45
  end
@@ -45,9 +47,9 @@ end
45
47
 
46
48
  RSpec.configure do |config|
47
49
  config.include FactoryBot::Syntax::Methods
48
- config.before(:all) do
50
+ config.before(:each) do
49
51
  FactoryBot.reload
50
- clear_database
52
+ clean_database
51
53
  end
52
54
  config.include Devise::Test::ControllerHelpers, type: :controller
53
55
  end
@@ -0,0 +1,31 @@
1
+ describe "ActivityNotification.gem_version" do
2
+ it "returns gem version" do
3
+ expect(ActivityNotification.gem_version.to_s).to eq(ActivityNotification::VERSION)
4
+ end
5
+ end
6
+
7
+ describe ActivityNotification::GEM_VERSION do
8
+ describe "MAJOR" do
9
+ it "returns gem major version" do
10
+ expect(ActivityNotification::GEM_VERSION::MAJOR).to eq(ActivityNotification::VERSION.split(".")[0])
11
+ end
12
+ end
13
+
14
+ describe "MINOR" do
15
+ it "returns gem minor version" do
16
+ expect(ActivityNotification::GEM_VERSION::MINOR).to eq(ActivityNotification::VERSION.split(".")[1])
17
+ end
18
+ end
19
+
20
+ describe "TINY" do
21
+ it "returns gem tiny version" do
22
+ expect(ActivityNotification::GEM_VERSION::TINY).to eq(ActivityNotification::VERSION.split(".")[2])
23
+ end
24
+ end
25
+
26
+ describe "PRE" do
27
+ it "returns gem pre version" do
28
+ expect(ActivityNotification::GEM_VERSION::PRE).to eq(ActivityNotification::VERSION.split(".")[3])
29
+ end
30
+ end
31
+ end