activity_notification 1.4.4 → 1.5.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 +4 -4
- data/.travis.yml +26 -20
- data/CHANGELOG.md +15 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +93 -85
- data/README.md +44 -8
- data/activity_notification.gemspec +6 -6
- data/gemfiles/Gemfile.rails-4.2 +2 -0
- data/gemfiles/Gemfile.rails-4.2.lock +41 -41
- data/gemfiles/Gemfile.rails-5.0.lock +75 -75
- data/gemfiles/Gemfile.rails-5.1.lock +80 -80
- data/gemfiles/Gemfile.rails-5.2 +18 -0
- data/gemfiles/Gemfile.rails-5.2.lock +242 -0
- data/lib/activity_notification/renderable.rb +9 -5
- data/lib/activity_notification/version.rb +1 -1
- data/lib/generators/templates/controllers/README +2 -2
- data/scripts/bundle_update.sh +7 -0
- data/spec/concerns/models/target_spec.rb +6 -32
- data/spec/concerns/renderable_spec.rb +34 -15
- data/spec/helpers/view_helpers_spec.rb +15 -0
- data/spec/mailers/mailer_spec.rb +1 -1
- data/spec/rails_app/config/application.rb +3 -0
- data/spec/rails_app/config/locales/activity_notification.en.yml +7 -3
- data/spec/rails_app/lib/mailer_previews/mailer_preview.rb +1 -1
- data/spec/roles/acts_as_notifiable_spec.rb +14 -12
- metadata +17 -14
@@ -8,7 +8,7 @@ module ActivityNotification
|
|
8
8
|
#
|
9
9
|
# @param [Hash] params Parameters for rendering notification text
|
10
10
|
# @option params [String] :target Target type name to use as i18n text key
|
11
|
-
# @option params [Hash] others Parameters to be
|
11
|
+
# @option params [Hash] others Parameters to be referred in i18n text
|
12
12
|
# @return [String] Rendered text
|
13
13
|
def text(params = {})
|
14
14
|
k = key.split('.')
|
@@ -21,12 +21,16 @@ module ActivityNotification
|
|
21
21
|
k.push('text')
|
22
22
|
k = k.join('.')
|
23
23
|
|
24
|
-
|
24
|
+
attrs = (parameters.symbolize_keys.merge(params) || {}).merge(
|
25
25
|
group_member_count: group_member_count,
|
26
26
|
group_notification_count: group_notification_count,
|
27
27
|
group_member_notifier_count: group_member_notifier_count,
|
28
28
|
group_notifier_count: group_notifier_count
|
29
|
-
)
|
29
|
+
)
|
30
|
+
|
31
|
+
# Generate the :default fallback key without using pluralization key :count
|
32
|
+
default = I18n.t(k, attrs)
|
33
|
+
I18n.t(k, attrs.merge(count: group_notification_count, default: default))
|
30
34
|
end
|
31
35
|
|
32
36
|
# Renders notification from views.
|
@@ -88,7 +92,7 @@ module ActivityNotification
|
|
88
92
|
# <%= yield %>
|
89
93
|
#
|
90
94
|
# == Custom Layout Location
|
91
|
-
#
|
95
|
+
#
|
92
96
|
# You can customize the layout directory by supplying :layout_root
|
93
97
|
# or by using an absolute path.
|
94
98
|
#
|
@@ -142,7 +146,7 @@ module ActivityNotification
|
|
142
146
|
# @option params [Hash] others Parameters to be set as locals
|
143
147
|
# @return [String] Rendered view or text as string
|
144
148
|
def render(context, params = {})
|
145
|
-
params[:i18n] and return context.render
|
149
|
+
params[:i18n] and return context.render plain: self.text(params)
|
146
150
|
|
147
151
|
partial = partial_path(*params.values_at(:partial, :partial_root, :target))
|
148
152
|
layout = layout_path(*params.values_at(:layout, :layout_root))
|
@@ -6,8 +6,8 @@ Some setup you must do manually if you haven't yet:
|
|
6
6
|
For example:
|
7
7
|
|
8
8
|
Rails.application.routes.draw do
|
9
|
-
notify_to :users,
|
10
|
-
notify_to :admins, with_devise: :users,
|
9
|
+
notify_to :users, controller: 'users/notifications'
|
10
|
+
notify_to :admins, with_devise: :users, controller: 'admins/notifications_with_devise'
|
11
11
|
end
|
12
12
|
|
13
13
|
===============================================================================
|
@@ -924,18 +924,8 @@ shared_examples_for :target do
|
|
924
924
|
end
|
925
925
|
|
926
926
|
if ActivityNotification.config.orm == :active_record
|
927
|
-
it "calls with_target, with_notifiable and
|
928
|
-
expect(
|
929
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:notifiable)
|
930
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:notifier)
|
931
|
-
test_instance.unopened_notification_index_with_attributes
|
932
|
-
end
|
933
|
-
|
934
|
-
it "does not call with_group" do
|
935
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:target)
|
936
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:notifiable)
|
937
|
-
expect(ActiveRecord::Base).not_to receive(:includes).with(:group)
|
938
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:notifier)
|
927
|
+
it "calls with_target, with_notifiable, with_notifier and does not call with_group" do
|
928
|
+
expect(ActivityNotification::Notification).to receive_message_chain(:with_target, :with_notifiable, :with_notifier)
|
939
929
|
test_instance.unopened_notification_index_with_attributes
|
940
930
|
end
|
941
931
|
end
|
@@ -950,10 +940,7 @@ shared_examples_for :target do
|
|
950
940
|
|
951
941
|
if ActivityNotification.config.orm == :active_record
|
952
942
|
it "calls with_group" do
|
953
|
-
expect(
|
954
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:notifiable)
|
955
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:group)
|
956
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:notifier)
|
943
|
+
expect(ActivityNotification::Notification).to receive_message_chain(:with_target, :with_notifiable, :with_group, :with_notifier)
|
957
944
|
test_instance.unopened_notification_index_with_attributes
|
958
945
|
end
|
959
946
|
end
|
@@ -986,18 +973,8 @@ shared_examples_for :target do
|
|
986
973
|
end
|
987
974
|
|
988
975
|
if ActivityNotification.config.orm == :active_record
|
989
|
-
it "calls with_target, with_notifiable and
|
990
|
-
expect(
|
991
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:notifiable)
|
992
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:notifier)
|
993
|
-
test_instance.opened_notification_index_with_attributes
|
994
|
-
end
|
995
|
-
|
996
|
-
it "does not call with_group" do
|
997
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:target)
|
998
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:notifiable)
|
999
|
-
expect(ActiveRecord::Base).not_to receive(:includes).with(:group)
|
1000
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:notifier)
|
976
|
+
it "calls with_target, with_notifiable, with_notifier and does not call with_group" do
|
977
|
+
expect(ActivityNotification::Notification).to receive_message_chain(:with_target, :with_notifiable, :with_notifier)
|
1001
978
|
test_instance.opened_notification_index_with_attributes
|
1002
979
|
end
|
1003
980
|
end
|
@@ -1012,10 +989,7 @@ shared_examples_for :target do
|
|
1012
989
|
|
1013
990
|
if ActivityNotification.config.orm == :active_record
|
1014
991
|
it "calls with_group" do
|
1015
|
-
expect(
|
1016
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:notifiable)
|
1017
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:group)
|
1018
|
-
expect(ActiveRecord::Base).to receive(:includes).with(:notifier)
|
992
|
+
expect(ActivityNotification::Notification).to receive_message_chain(:with_target, :with_notifiable, :with_group, :with_notifier)
|
1019
993
|
test_instance.opened_notification_index_with_attributes
|
1020
994
|
end
|
1021
995
|
end
|
@@ -4,17 +4,23 @@ shared_examples_for :renderable do
|
|
4
4
|
let(:test_instance) { create(test_class_name, target: test_target) }
|
5
5
|
let(:target_type_key) { 'user' }
|
6
6
|
|
7
|
-
let(:notifier_name)
|
8
|
-
let(:article_title)
|
9
|
-
let(:
|
10
|
-
let(:
|
11
|
-
let(:
|
12
|
-
let(:
|
13
|
-
let(:
|
14
|
-
let(:
|
15
|
-
let(:
|
16
|
-
let(:
|
17
|
-
let(:
|
7
|
+
let(:notifier_name) { 'foo' }
|
8
|
+
let(:article_title) { 'bar' }
|
9
|
+
let(:group_notification_count) { 4 }
|
10
|
+
let(:group_member_count) { 3 }
|
11
|
+
let(:simple_text_key) { 'article.create' }
|
12
|
+
let(:params_text_key) { 'article.update' }
|
13
|
+
let(:group_text_key) { 'comment.reply' }
|
14
|
+
let(:plural_text_key) { 'comment.post' }
|
15
|
+
let(:simple_text_original) { 'Article has been created' }
|
16
|
+
let(:params_text_original) { "Article %{article_title} has been updated" }
|
17
|
+
let(:plural_text_original_one) { "<p>%{notifier_name} posted a comment on your article %{article_title}</p>" }
|
18
|
+
let(:plural_text_original_other) { "<p>%{notifier_name} posted %{count} comments on your article %{article_title}</p>" }
|
19
|
+
let(:group_text_original) { "<p>%{notifier_name} and %{group_member_count} other people replied %{group_notification_count} times to your comment</p>" }
|
20
|
+
let(:params_text_embedded) { "Article bar has been updated" }
|
21
|
+
let(:group_text_embedded) { "<p>foo and 3 other people replied 4 times to your comment</p>" }
|
22
|
+
let(:plural_text_embedded_one) { "<p>foo posted a comment on your article bar</p>" }
|
23
|
+
let(:plural_text_embedded_other) { "<p>foo posted 4 comments on your article bar</p>" }
|
18
24
|
|
19
25
|
describe "i18n configuration" do
|
20
26
|
it "has key configured for simple text" do
|
@@ -26,17 +32,30 @@ shared_examples_for :renderable do
|
|
26
32
|
expect(I18n.t("notification.#{target_type_key}.#{params_text_key}.text"))
|
27
33
|
.to eq(params_text_original)
|
28
34
|
expect(I18n.t("notification.#{target_type_key}.#{params_text_key}.text",
|
29
|
-
{
|
35
|
+
{article_title: article_title}))
|
30
36
|
.to eq(params_text_embedded)
|
31
37
|
end
|
32
38
|
|
33
|
-
it "has key configured with embedded params including group_member_count" do
|
39
|
+
it "has key configured with embedded params including group_member_count and group_notification_count" do
|
34
40
|
expect(I18n.t("notification.#{target_type_key}.#{group_text_key}.text"))
|
35
41
|
.to eq(group_text_original)
|
36
42
|
expect(I18n.t("notification.#{target_type_key}.#{group_text_key}.text",
|
37
|
-
{notifier_name: notifier_name, group_member_count: group_member_count}))
|
43
|
+
{notifier_name: notifier_name, group_member_count: group_member_count, group_notification_count: group_notification_count}))
|
38
44
|
.to eq(group_text_embedded)
|
39
45
|
end
|
46
|
+
|
47
|
+
it "has key configured with plurals" do
|
48
|
+
expect(I18n.t("notification.#{target_type_key}.#{plural_text_key}.text")[:one])
|
49
|
+
.to eq(plural_text_original_one)
|
50
|
+
expect(I18n.t("notification.#{target_type_key}.#{plural_text_key}.text")[:other])
|
51
|
+
.to eq(plural_text_original_other)
|
52
|
+
expect(I18n.t("notification.#{target_type_key}.#{plural_text_key}.text",
|
53
|
+
{article_title: article_title, notifier_name: notifier_name, count: 1}))
|
54
|
+
.to eq(plural_text_embedded_one)
|
55
|
+
expect(I18n.t("notification.#{target_type_key}.#{plural_text_key}.text",
|
56
|
+
{article_title: article_title, notifier_name: notifier_name, count: group_notification_count}))
|
57
|
+
.to eq(plural_text_embedded_other)
|
58
|
+
end
|
40
59
|
end
|
41
60
|
|
42
61
|
describe "as public instance methods" do
|
@@ -83,7 +102,7 @@ shared_examples_for :renderable do
|
|
83
102
|
context "when the text has embedded parameters" do
|
84
103
|
it "uses text with embedded parameters" do
|
85
104
|
test_instance.key = params_text_key
|
86
|
-
expect(test_instance.text({
|
105
|
+
expect(test_instance.text({article_title: article_title}))
|
87
106
|
.to eq(params_text_embedded)
|
88
107
|
end
|
89
108
|
|
@@ -67,6 +67,21 @@ describe ActivityNotification::ViewHelpers, type: :helper do
|
|
67
67
|
expect(render_notification notification, fallback: :text)
|
68
68
|
.to eq(simple_text_original)
|
69
69
|
end
|
70
|
+
|
71
|
+
it "interpolates from parameters" do
|
72
|
+
notification.parameters = { "article_title" => "custom title" }
|
73
|
+
notification.key = 'article.update'
|
74
|
+
expect(render_notification notification, fallback: :text)
|
75
|
+
.to eq("Article custom title has been updated")
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context "with i18n param set" do
|
80
|
+
it "uses i18n text from key" do
|
81
|
+
notification.key = simple_text_key
|
82
|
+
expect(render_notification notification, i18n: true)
|
83
|
+
.to eq(simple_text_original)
|
84
|
+
end
|
70
85
|
end
|
71
86
|
|
72
87
|
context "with custom view" do
|
data/spec/mailers/mailer_spec.rb
CHANGED
@@ -84,7 +84,7 @@ describe ActivityNotification::Mailer do
|
|
84
84
|
notification.notifiable.extend(AdditionalMethods)
|
85
85
|
ActivityNotification::Mailer.send_notification_email(notification).deliver_now
|
86
86
|
expect(ActivityNotification::Mailer.deliveries.last.subject)
|
87
|
-
.to eq("New comment
|
87
|
+
.to eq("New comment on your article")
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -28,6 +28,9 @@ module Dummy
|
|
28
28
|
if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2 && ENV['AN_TEST_DB'] != 'mongodb'
|
29
29
|
config.active_record.raise_in_transactional_callbacks = true
|
30
30
|
end
|
31
|
+
if Rails::VERSION::MAJOR >= 5 && Rails::VERSION::MINOR >= 2 && ENV['AN_TEST_DB'] != 'mongodb'
|
32
|
+
config.active_record.sqlite3.represent_boolean_as_integer = true
|
33
|
+
end
|
31
34
|
end
|
32
35
|
end
|
33
36
|
|
@@ -6,14 +6,18 @@ en:
|
|
6
6
|
article:
|
7
7
|
create:
|
8
8
|
text: 'Article has been created'
|
9
|
+
update:
|
10
|
+
text: 'Article %{article_title} has been updated'
|
9
11
|
destroy:
|
10
12
|
text: 'Some user removed an article!'
|
11
13
|
comment:
|
12
14
|
post:
|
13
|
-
text:
|
15
|
+
text:
|
16
|
+
one: "<p>%{notifier_name} posted a comment on your article %{article_title}</p>"
|
17
|
+
other: "<p>%{notifier_name} posted %{count} comments on your article %{article_title}</p>"
|
14
18
|
reply:
|
15
|
-
text: "<p>%{notifier_name} and %{group_member_count} people replied
|
16
|
-
mail_subject: 'New comment
|
19
|
+
text: "<p>%{notifier_name} and %{group_member_count} other people replied %{group_notification_count} times to your comment</p>"
|
20
|
+
mail_subject: 'New comment on your article'
|
17
21
|
admin:
|
18
22
|
article:
|
19
23
|
post:
|
@@ -13,7 +13,7 @@ class ActivityNotification::MailerPreview < ActionMailer::Preview
|
|
13
13
|
def send_batch_notification_email
|
14
14
|
target = User.find_by_name('Ichiro')
|
15
15
|
target_notifications = target.notification_index_with_attributes(filtered_by_key: 'comment.default')
|
16
|
-
ActivityNotification::Mailer.send_batch_notification_email(target, target_notifications)
|
16
|
+
ActivityNotification::Mailer.send_batch_notification_email(target, target_notifications, 'batch.comment.default')
|
17
17
|
end
|
18
18
|
|
19
19
|
end
|
@@ -183,6 +183,7 @@ describe ActivityNotification::ActsAsNotifiable do
|
|
183
183
|
|
184
184
|
context "with :dependent_notifications option" do
|
185
185
|
before do
|
186
|
+
dummy_notifiable_class.delete_all
|
186
187
|
@notifiable_1, @notifiable_2, @notifiable_3 = dummy_notifiable_class.create, dummy_notifiable_class.create, dummy_notifiable_class.create
|
187
188
|
@group_owner = create(:notification, target: user_target, notifiable: @notifiable_1, group: @notifiable_1)
|
188
189
|
@group_member = create(:notification, target: user_target, notifiable: @notifiable_2, group: @notifiable_1, group_owner: @group_owner)
|
@@ -205,7 +206,7 @@ describe ActivityNotification::ActsAsNotifiable do
|
|
205
206
|
it "does not deletes any notifications when notifiable is deleted" do
|
206
207
|
dummy_notifiable_class.acts_as_notifiable :users
|
207
208
|
expect(user_target.notifications.reload.size).to eq(3)
|
208
|
-
expect { @notifiable_1.destroy }.to change(
|
209
|
+
expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
|
209
210
|
expect(user_target.notifications.reload.size).to eq(3)
|
210
211
|
end
|
211
212
|
end
|
@@ -214,14 +215,14 @@ describe ActivityNotification::ActsAsNotifiable do
|
|
214
215
|
it "deletes all notifications when notifiable is deleted" do
|
215
216
|
dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :delete_all
|
216
217
|
expect(user_target.notifications.reload.size).to eq(3)
|
217
|
-
expect { @notifiable_1.destroy }.to change(
|
218
|
+
expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
|
218
219
|
expect(user_target.notifications.reload.size).to eq(2)
|
219
220
|
expect(@group_member.reload.group_owner?).to be_falsey
|
220
221
|
end
|
221
222
|
|
222
223
|
it "does not delete notifications of other targets when notifiable is deleted" do
|
223
224
|
dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :delete_all
|
224
|
-
expect { @notifiable_1.destroy }.to change(
|
225
|
+
expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
|
225
226
|
expect(user_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(0)
|
226
227
|
expect(dummy_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(1)
|
227
228
|
end
|
@@ -231,14 +232,14 @@ describe ActivityNotification::ActsAsNotifiable do
|
|
231
232
|
it "destroies all notifications when notifiable is deleted" do
|
232
233
|
dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :destroy
|
233
234
|
expect(user_target.notifications.reload.size).to eq(3)
|
234
|
-
expect { @notifiable_1.destroy }.to change(
|
235
|
+
expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
|
235
236
|
expect(user_target.notifications.reload.size).to eq(2)
|
236
237
|
expect(@group_member.reload.group_owner?).to be_falsey
|
237
238
|
end
|
238
239
|
|
239
240
|
it "does not destroy notifications of other targets when notifiable is deleted" do
|
240
241
|
dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :destroy
|
241
|
-
expect { @notifiable_1.destroy }.to change(
|
242
|
+
expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
|
242
243
|
expect(user_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(0)
|
243
244
|
expect(dummy_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(1)
|
244
245
|
end
|
@@ -260,7 +261,8 @@ describe ActivityNotification::ActsAsNotifiable do
|
|
260
261
|
it "can not be deleted when it has generated notifications" do
|
261
262
|
dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :restrict_with_error
|
262
263
|
expect(user_target.notifications.reload.size).to eq(3)
|
263
|
-
|
264
|
+
@notifiable_1.destroy
|
265
|
+
expect(@notifiable_1.destroyed?).to be_falsey
|
264
266
|
end
|
265
267
|
end
|
266
268
|
|
@@ -268,21 +270,21 @@ describe ActivityNotification::ActsAsNotifiable do
|
|
268
270
|
it "deletes all notifications and update notification group when notifiable is deleted" do
|
269
271
|
dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :update_group_and_delete_all
|
270
272
|
expect(user_target.notifications.reload.size).to eq(3)
|
271
|
-
expect { @notifiable_1.destroy }.to change(
|
273
|
+
expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
|
272
274
|
expect(user_target.notifications.reload.size).to eq(2)
|
273
275
|
expect(@group_member.reload.group_owner?).to be_truthy
|
274
276
|
end
|
275
277
|
|
276
278
|
it "does not delete notifications of other targets when notifiable is deleted" do
|
277
279
|
dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :update_group_and_delete_all
|
278
|
-
expect { @notifiable_1.destroy }.to change(
|
280
|
+
expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
|
279
281
|
expect(user_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(0)
|
280
282
|
expect(dummy_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(1)
|
281
283
|
end
|
282
284
|
|
283
285
|
it "does not update notification group when notifiable is deleted" do
|
284
286
|
dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :update_group_and_delete_all
|
285
|
-
expect { @notifiable_1.destroy }.to change(
|
287
|
+
expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
|
286
288
|
expect(@group_member.reload.group_owner?).to be_truthy
|
287
289
|
expect(@other_target_group_member.reload.group_owner?).to be_falsey
|
288
290
|
end
|
@@ -292,21 +294,21 @@ describe ActivityNotification::ActsAsNotifiable do
|
|
292
294
|
it "destroies all notifications and update notification group when notifiable is deleted" do
|
293
295
|
dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :update_group_and_destroy
|
294
296
|
expect(user_target.notifications.reload.size).to eq(3)
|
295
|
-
expect { @notifiable_1.destroy }.to change(
|
297
|
+
expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
|
296
298
|
expect(user_target.notifications.reload.size).to eq(2)
|
297
299
|
expect(@group_member.reload.group_owner?).to be_truthy
|
298
300
|
end
|
299
301
|
|
300
302
|
it "does not destroy notifications of other targets when notifiable is deleted" do
|
301
303
|
dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :update_group_and_destroy
|
302
|
-
expect { @notifiable_1.destroy }.to change(
|
304
|
+
expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
|
303
305
|
expect(user_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(0)
|
304
306
|
expect(dummy_target.notifications.filtered_by_instance(@notifiable_1).count).to eq(1)
|
305
307
|
end
|
306
308
|
|
307
309
|
it "does not update notification group when notifiable is deleted" do
|
308
310
|
dummy_notifiable_class.acts_as_notifiable :users, dependent_notifications: :update_group_and_destroy
|
309
|
-
expect { @notifiable_1.destroy }.to change(
|
311
|
+
expect { @notifiable_1.destroy }.to change(@notifiable_1, :destroyed?).from(false).to(true)
|
310
312
|
expect(@group_member.reload.group_owner?).to be_truthy
|
311
313
|
expect(@other_target_group_member.reload.group_owner?).to be_falsey
|
312
314
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activity_notification
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shota Yamazaki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 4.2.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '5.
|
22
|
+
version: '5.3'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 4.2.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '5.
|
32
|
+
version: '5.3'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: i18n
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,28 +78,28 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.
|
81
|
+
version: 0.5.1
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.
|
88
|
+
version: 0.5.1
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: pg
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 0.
|
95
|
+
version: 1.0.0
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 0.
|
102
|
+
version: 1.0.0
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: mongoid
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,14 +120,14 @@ dependencies:
|
|
120
120
|
requirements:
|
121
121
|
- - "~>"
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: 3.7.
|
123
|
+
version: 3.7.2
|
124
124
|
type: :development
|
125
125
|
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: 3.7.
|
130
|
+
version: 3.7.2
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
132
|
name: factory_bot_rails
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,14 +162,14 @@ dependencies:
|
|
162
162
|
requirements:
|
163
163
|
- - "~>"
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: 0.9.
|
165
|
+
version: 0.9.12
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: 0.9.
|
172
|
+
version: 0.9.12
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
174
|
name: yard-activesupport-concern
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,14 +190,14 @@ dependencies:
|
|
190
190
|
requirements:
|
191
191
|
- - "~>"
|
192
192
|
- !ruby/object:Gem::Version
|
193
|
-
version: 4.3
|
193
|
+
version: 4.4.3
|
194
194
|
type: :development
|
195
195
|
prerelease: false
|
196
196
|
version_requirements: !ruby/object:Gem::Requirement
|
197
197
|
requirements:
|
198
198
|
- - "~>"
|
199
199
|
- !ruby/object:Gem::Version
|
200
|
-
version: 4.3
|
200
|
+
version: 4.4.3
|
201
201
|
- !ruby/object:Gem::Dependency
|
202
202
|
name: aws-sdk-sns
|
203
203
|
requirement: !ruby/object:Gem::Requirement
|
@@ -288,6 +288,8 @@ files:
|
|
288
288
|
- gemfiles/Gemfile.rails-5.0.lock
|
289
289
|
- gemfiles/Gemfile.rails-5.1
|
290
290
|
- gemfiles/Gemfile.rails-5.1.lock
|
291
|
+
- gemfiles/Gemfile.rails-5.2
|
292
|
+
- gemfiles/Gemfile.rails-5.2.lock
|
291
293
|
- lib/activity_notification.rb
|
292
294
|
- lib/activity_notification/apis/notification_api.rb
|
293
295
|
- lib/activity_notification/apis/subscription_api.rb
|
@@ -343,6 +345,7 @@ files:
|
|
343
345
|
- lib/generators/templates/models/notification.rb
|
344
346
|
- lib/generators/templates/models/subscription.rb
|
345
347
|
- lib/tasks/activity_notification_tasks.rake
|
348
|
+
- scripts/bundle_update.sh
|
346
349
|
- spec/concerns/apis/notification_api_spec.rb
|
347
350
|
- spec/concerns/apis/subscription_api_spec.rb
|
348
351
|
- spec/concerns/common_spec.rb
|