wupee 1.0.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.
Files changed (100) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +30 -0
  4. data/app/controllers/wupee/api/notifications_controller.rb +33 -0
  5. data/app/controllers/wupee/application_controller.rb +4 -0
  6. data/app/mailers/wupee/notifications_mailer.rb +30 -0
  7. data/app/models/concerns/wupee/attached_object.rb +9 -0
  8. data/app/models/concerns/wupee/receiver.rb +16 -0
  9. data/app/models/wupee/notification.rb +16 -0
  10. data/app/models/wupee/notification_type.rb +18 -0
  11. data/app/models/wupee/notification_type_configuration.rb +17 -0
  12. data/app/models/wupee/notifier.rb +73 -0
  13. data/app/views/wupee/api/notifications/_notification.json.jbuilder +5 -0
  14. data/app/views/wupee/api/notifications/index.json.jbuilder +1 -0
  15. data/app/views/wupee/api/notifications/show.json.jbuilder +1 -0
  16. data/db/migrate/20151029113101_create_wupee_notification_type_configurations.rb +13 -0
  17. data/db/migrate/20151029113107_create_wupee_notifications.rb +14 -0
  18. data/db/migrate/20151029113122_create_wupee_notification_types.rb +10 -0
  19. data/lib/generators/wupee/install/USAGE +15 -0
  20. data/lib/generators/wupee/install/install_generator.rb +24 -0
  21. data/lib/generators/wupee/install/templates/notifications_mailer.rb +4 -0
  22. data/lib/generators/wupee/install/templates/wupee.rb +6 -0
  23. data/lib/generators/wupee/notification_type/USAGE +11 -0
  24. data/lib/generators/wupee/notification_type/notification_type_generator.rb +26 -0
  25. data/lib/tasks/wupee_tasks.rake +4 -0
  26. data/lib/wupee.rb +11 -0
  27. data/lib/wupee/engine.rb +12 -0
  28. data/lib/wupee/version.rb +3 -0
  29. data/spec/controllers/notifications_controller_spec.rb +65 -0
  30. data/spec/dummy/README.rdoc +28 -0
  31. data/spec/dummy/Rakefile +6 -0
  32. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  33. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  34. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  35. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  36. data/spec/dummy/app/mailers/notifications_mailer.rb +4 -0
  37. data/spec/dummy/app/models/message.rb +3 -0
  38. data/spec/dummy/app/models/user.rb +3 -0
  39. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  40. data/spec/dummy/app/views/notifications/_admin_user_created.html.erb +0 -0
  41. data/spec/dummy/app/views/notifications/_notify_new_message.html.erb +0 -0
  42. data/spec/dummy/app/views/notifications_mailer/notify_new_message.html.erb +0 -0
  43. data/spec/dummy/app/views/wupee/api/notifications/_notification.json.jbuilder +5 -0
  44. data/spec/dummy/app/views/wupee/api/notifications/_notify_new_message.json.jbuilder +3 -0
  45. data/spec/dummy/app/views/wupee/api/notifications/index.json.jbuilder +1 -0
  46. data/spec/dummy/app/views/wupee/api/notifications/show.json.jbuilder +1 -0
  47. data/spec/dummy/app/views/wupee/notifications/_notify_new_message.html.erb +0 -0
  48. data/spec/dummy/bin/bundle +3 -0
  49. data/spec/dummy/bin/rails +4 -0
  50. data/spec/dummy/bin/rake +4 -0
  51. data/spec/dummy/bin/setup +29 -0
  52. data/spec/dummy/config.ru +4 -0
  53. data/spec/dummy/config/application.rb +32 -0
  54. data/spec/dummy/config/boot.rb +5 -0
  55. data/spec/dummy/config/database.yml +25 -0
  56. data/spec/dummy/config/environment.rb +5 -0
  57. data/spec/dummy/config/environments/development.rb +41 -0
  58. data/spec/dummy/config/environments/production.rb +79 -0
  59. data/spec/dummy/config/environments/test.rb +42 -0
  60. data/spec/dummy/config/initializers/assets.rb +11 -0
  61. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  62. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  63. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  64. data/spec/dummy/config/initializers/inflections.rb +16 -0
  65. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  66. data/spec/dummy/config/initializers/session_store.rb +3 -0
  67. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  68. data/spec/dummy/config/initializers/wupee.rb +6 -0
  69. data/spec/dummy/config/locales/en.yml +5 -0
  70. data/spec/dummy/config/routes.rb +3 -0
  71. data/spec/dummy/config/secrets.yml +22 -0
  72. data/spec/dummy/db/development.sqlite3 +0 -0
  73. data/spec/dummy/db/migrate/20150213150625_create_users.rb +10 -0
  74. data/spec/dummy/db/migrate/20150213152846_create_messages.rb +9 -0
  75. data/spec/dummy/db/schema.rb +61 -0
  76. data/spec/dummy/db/test.sqlite3 +0 -0
  77. data/spec/dummy/log/development.log +1750 -0
  78. data/spec/dummy/log/test.log +76399 -0
  79. data/spec/dummy/public/404.html +67 -0
  80. data/spec/dummy/public/422.html +67 -0
  81. data/spec/dummy/public/500.html +66 -0
  82. data/spec/dummy/public/favicon.ico +0 -0
  83. data/spec/factories/message.rb +5 -0
  84. data/spec/factories/notification.rb +7 -0
  85. data/spec/factories/notification_type.rb +5 -0
  86. data/spec/factories/notification_type_configuration.rb +6 -0
  87. data/spec/factories/user.rb +9 -0
  88. data/spec/mailers/notifications_mailer_spec.rb +33 -0
  89. data/spec/models/concerns/attached_object_spec.rb +11 -0
  90. data/spec/models/concerns/receiver_spec.rb +37 -0
  91. data/spec/models/message_spec.rb +5 -0
  92. data/spec/models/notification_spec.rb +54 -0
  93. data/spec/models/notification_type_configuration_spec.rb +43 -0
  94. data/spec/models/notifier_spec.rb +42 -0
  95. data/spec/models/user_spec.rb +5 -0
  96. data/spec/rails_helper.rb +52 -0
  97. data/spec/spec_helper.rb +87 -0
  98. data/spec/support/factory_girl.rb +3 -0
  99. data/spec/wupee_spec.rb +15 -0
  100. metadata +291 -0
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :message do
3
+ body 'message body'
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ FactoryGirl.define do
2
+ factory :notification, class: Wupee::Notification do
3
+ association :receiver, factory: :user, strategy: :create
4
+ association :attached_object, factory: :message, strategy: :create
5
+ notification_type { Wupee::NotificationType.find_or_create_by(name: 'notify_new_message') }
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :notification_type, class: Wupee::NotificationType do
3
+ name 'notify_new_message'
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ FactoryGirl.define do
2
+ factory :notification_type_configuration, class: Wupee::NotificationTypeConfiguration do
3
+ association :receiver, factory: :user, strategy: :create
4
+ association :notification_type, factory: :notification_type, strategy: :create
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ FactoryGirl.define do
2
+ sequence(:email) { |n| "user#{n}@sleede.com" }
3
+ sequence(:name) { |n| "user#{n}" }
4
+
5
+ factory :user do
6
+ email { FactoryGirl.generate :email }
7
+ name { FactoryGirl.generate :name }
8
+ end
9
+ end
@@ -0,0 +1,33 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe NotificationsMailer do
4
+ subject { NotificationsMailer }
5
+ let!(:notification_type) { create :notification_type, name: "abc" }
6
+ let!(:notification) { create :notification, notification_type: notification_type }
7
+
8
+ it 'should respond to method #send_mail_for' do
9
+ expect(subject).to respond_to(:send_mail_for)
10
+ end
11
+
12
+ describe 'send mail by a notification' do
13
+ before do
14
+ @mail = subject.send_mail_for(notification, a_var_to_interpolate: "hello world").deliver_now
15
+ end
16
+
17
+ it 'should be sent' do
18
+ expect(ActionMailer::Base.deliveries).not_to be_empty
19
+ end
20
+
21
+ it 'should have the correct subject' do
22
+ expect(@mail.subject).to eq I18n.t(".wupee.email_subjects.#{notification.notification_type.name}", a_var_to_interpolate: "hello world")
23
+ end
24
+
25
+ it 'should have correct receiver' do
26
+ expect(@mail.to).to eq [notification.receiver.email]
27
+ end
28
+
29
+ it 'should mark notification as sent' do
30
+ expect(notification.is_sent).to eq true
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,11 @@
1
+ require 'rails_helper'
2
+
3
+ shared_examples_for "Wupee::AttachedObject" do
4
+ let(:model) { described_class }
5
+
6
+ it "destroys notification on destroy" do
7
+ attached_object = create model.name.underscore
8
+ notif = create :notification, attached_object: attached_object
9
+ expect { attached_object.destroy }.to change { Wupee::Notification.count }.by(-1)
10
+ end
11
+ end
@@ -0,0 +1,37 @@
1
+ require 'rails_helper'
2
+
3
+ shared_examples_for "Wupee::Receiver" do
4
+ let(:model) { described_class }
5
+
6
+ it "has many notifications" do
7
+ expect(model.new).to respond_to(:notifications)
8
+ end
9
+
10
+ it "has many notification_type_configurations" do
11
+ expect(model.new).to respond_to(:notification_type_configurations)
12
+ end
13
+
14
+ it "destroys notification on destroy" do
15
+ receiver = create model.name.underscore
16
+ create :notification, receiver: receiver
17
+ expect { receiver.destroy }.to change { Wupee::Notification.count }.by(-1)
18
+ end
19
+
20
+ it "destroys notification_type_configurations on destroy" do
21
+ receiver = create model.name.underscore
22
+ Wupee::NotificationTypeConfiguration.create(receiver: receiver, notification_type: Wupee::NotificationType.create(name: 'abc'))
23
+ expect { receiver.destroy }.to change { Wupee::NotificationTypeConfiguration.count }.by(-1)
24
+ end
25
+
26
+ context "there are already notification type created" do
27
+ it "has no notification_type_configurations associated to notification_type" do
28
+ expect(Wupee::NotificationTypeConfiguration.count).to eq 0
29
+ end
30
+
31
+ it "creates notification_type_configurations after model is created" do
32
+ create :notification_type
33
+ expect { create model.name.underscore }.to change { Wupee::NotificationTypeConfiguration.count }.by(1)
34
+ expect(Wupee::NotificationTypeConfiguration.last.receiver).to eq model.last
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,5 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Message, type: :model do
4
+ it_behaves_like "Wupee::AttachedObject"
5
+ end
@@ -0,0 +1,54 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Wupee::Notification, type: :model do
4
+ let!(:message) { create :message }
5
+ let!(:receiver) { create :user }
6
+ let!(:notification_type_name) { 'notify_new_message' }
7
+ let!(:notification_type) { create :notification_type, name: notification_type_name }
8
+
9
+ context "validations" do
10
+ it "validates presence of receiver" do
11
+ notification = Wupee::Notification.new
12
+ notification.valid?
13
+ expect(notification.errors).to have_key :receiver
14
+ end
15
+
16
+ it "validates presence of notification_type" do
17
+ notification = Wupee::Notification.new
18
+ notification.valid?
19
+ expect(notification.errors).to have_key :notification_type
20
+ end
21
+ end
22
+
23
+ it 'should be able to be marked as read' do
24
+ notification = create :notification
25
+ notification.mark_as_read
26
+ expect(notification.is_read).to eq true
27
+ end
28
+
29
+ it 'should be able to be marked as sent' do
30
+ notification = create :notification
31
+ notification.mark_as_sent
32
+ expect(notification.is_sent).to eq true
33
+ end
34
+
35
+ context "default values" do
36
+ it { expect(create(:notification).is_read).to be false }
37
+ it { expect(create(:notification).is_sent).to be false }
38
+ end
39
+
40
+ # it '#deliver_now should send a mail' do
41
+ # notification = Wupee::Notification.new.send_notification(type: notification_type_name, attached_object: message)
42
+ # .to(receiver)
43
+ # expect(notification.deliver_now).to be_a(Mail::Message)
44
+ # end
45
+ #
46
+ # it '#deliver_later should send later a mail' do
47
+ # notification = Wupee::Notification.new.send_notification(type: notification_type_name, attached_object: message)
48
+ # .to(receiver)
49
+ # expect(notification.deliver_later).to be_a(ActionMailer::DeliveryJob)
50
+ # end
51
+ #
52
+
53
+
54
+ end
@@ -0,0 +1,43 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Wupee::NotificationTypeConfiguration, type: :model do
4
+ let!(:receiver) { create :user }
5
+ let!(:notification_type) { create :notification_type }
6
+
7
+ context "validations" do
8
+ it "validates presence of receiver" do
9
+ notification_type_conf = Wupee::NotificationTypeConfiguration.new
10
+ notification_type_conf.valid?
11
+ expect(notification_type_conf.errors).to have_key :receiver
12
+ end
13
+
14
+ it "validates presence of notification_type" do
15
+ notification_type_conf = Wupee::NotificationTypeConfiguration.new
16
+ notification_type_conf.valid?
17
+ expect(notification_type_conf.errors).to have_key :notification_type
18
+ end
19
+
20
+ it "validates uniqueness of [receiver, notification_type]" do
21
+ notification_type_conf_same = Wupee::NotificationTypeConfiguration.create(receiver: receiver, notification_type: notification_type)
22
+ expect(notification_type_conf_same).to be_invalid
23
+ end
24
+ end
25
+
26
+ context "methods" do
27
+ it "has method wants_email?" do
28
+ notification_type_conf = Wupee::NotificationTypeConfiguration.new(value: :both)
29
+ expect(notification_type_conf.wants_email?).to eq true
30
+
31
+ notification_type_conf = Wupee::NotificationTypeConfiguration.new(value: :email)
32
+ expect(notification_type_conf.wants_email?).to eq true
33
+ end
34
+
35
+ it "has method wants_notification?" do
36
+ notification_type_conf = Wupee::NotificationTypeConfiguration.new(value: :both)
37
+ expect(notification_type_conf.wants_notification?).to eq true
38
+
39
+ notification_type_conf = Wupee::NotificationTypeConfiguration.new(value: :notification)
40
+ expect(notification_type_conf.wants_notification?).to eq true
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,42 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Wupee::Notifier, type: :model do
4
+
5
+ context "methods defined" do
6
+ it { expect(subject).to respond_to(:notif_type) }
7
+ it { expect(subject).to respond_to(:attached_object) }
8
+ it { expect(subject).to respond_to(:receiver) }
9
+ it { expect(subject).to respond_to(:receivers) }
10
+ it { expect(subject).to respond_to(:deliver) }
11
+ it { expect(subject).to respond_to(:subject_vars) }
12
+ end
13
+
14
+ it "has a method notif_type that can take Wupee::NotificationType instance or string/symbol as argument" do
15
+ notif_type = create :notification_type
16
+ wupee_notifier = Wupee::Notifier.new
17
+ wupee_notifier.notif_type(notif_type.name)
18
+ expect(wupee_notifier.notification_type).to eq notif_type
19
+
20
+ wupee_notifier.notif_type(notif_type)
21
+ expect(wupee_notifier.notification_type).to eq notif_type
22
+ end
23
+
24
+ it "has a method execute to send notifications and mails depending on notification_type_configurations of the users" do
25
+ notif_type = Wupee::NotificationType.create!(name: "notify_new_message")
26
+
27
+ user_1 = create :user
28
+ user_2 = create :user
29
+ user_3 = create :user
30
+ user_4 = create :user
31
+
32
+ Wupee::NotificationTypeConfiguration.find_by(receiver: user_2, notification_type: notif_type).update(value: :nothing)
33
+ Wupee::NotificationTypeConfiguration.find_by(receiver: user_3, notification_type: notif_type).update(value: :email)
34
+ Wupee::NotificationTypeConfiguration.find_by(receiver: user_4, notification_type: notif_type).update(value: :notification)
35
+
36
+ wupee_notifier = Wupee::Notifier.new(receivers: [user_1, user_2, user_3, user_4], notif_type: notif_type)
37
+
38
+ expect { wupee_notifier.execute }.to change { ActionMailer::Base.deliveries.size }.by(2)
39
+ expect { wupee_notifier.execute }.to change { Wupee::Notification.where(is_read: true).count }.by(2)
40
+ expect { wupee_notifier.execute }.to change { Wupee::Notification.count }.by(4)
41
+ end
42
+ end