notify_with 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/notify_with/notification_attached_object.rb +14 -0
- data/lib/notify_with/version.rb +1 -1
- data/spec/dummy/app/models/message.rb +1 -0
- data/spec/dummy/log/development.log +100 -0
- data/spec/dummy/log/test.log +3902 -0
- data/spec/models/notification_spec.rb +17 -0
- metadata +4 -4
- data/config/routes.rb +0 -2
@@ -66,4 +66,21 @@ RSpec.describe Notification, type: :model do
|
|
66
66
|
.to(receiver)
|
67
67
|
expect(notification.deliver_later).to be_a(ActionMailer::DeliveryJob)
|
68
68
|
end
|
69
|
+
|
70
|
+
describe 'receiver' do
|
71
|
+
it 'should can return his all notifications' do
|
72
|
+
notification = Notification.new.send_notification(type: notification_type, attached_object: message)
|
73
|
+
.to(receiver)
|
74
|
+
expect {notification.save}.to change{receiver.notifications.count}.from(0).to(1)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context 'when attached object is destroy' do
|
79
|
+
it 'all notifications with this object should destroy' do
|
80
|
+
notification = Notification.new.send_notification(type: notification_type, attached_object: message)
|
81
|
+
.to(receiver)
|
82
|
+
notification.save
|
83
|
+
expect {message.destroy}.to change{receiver.notifications.count}.from(1).to(0)
|
84
|
+
end
|
85
|
+
end
|
69
86
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notify_with
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peng DU
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -106,9 +106,9 @@ files:
|
|
106
106
|
- app/controllers/concerns/notify_with/notifications_api.rb
|
107
107
|
- app/mailers/notify_with/notifications_mailer.rb
|
108
108
|
- app/models/concerns/notify_with/notification.rb
|
109
|
+
- app/models/concerns/notify_with/notification_attached_object.rb
|
109
110
|
- app/models/concerns/notify_with/notification_receiver.rb
|
110
111
|
- app/models/concerns/notify_with/notification_type.rb
|
111
|
-
- config/routes.rb
|
112
112
|
- lib/generators/notify_with/install/USAGE
|
113
113
|
- lib/generators/notify_with/install/install_generator.rb
|
114
114
|
- lib/generators/notify_with/install/templates/create_notification.rb
|
@@ -188,7 +188,7 @@ files:
|
|
188
188
|
- spec/rails_helper.rb
|
189
189
|
- spec/spec_helper.rb
|
190
190
|
- spec/support/factory_girl.rb
|
191
|
-
homepage:
|
191
|
+
homepage: https://github.com/sleede/notfity_with
|
192
192
|
licenses:
|
193
193
|
- MIT
|
194
194
|
metadata: {}
|
data/config/routes.rb
DELETED