WIP
This commit is contained in:
parent
17dde3a7b9
commit
a4988a28b4
3 changed files with 7 additions and 2 deletions
|
|
@ -186,6 +186,6 @@ class Person < ActiveRecord::Base
|
|||
Post.where(:person_id => id).delete_all
|
||||
Comment.where(:person_id => id).delete_all
|
||||
Contact.where(:person_id => id).delete_all
|
||||
Notification.where(:actors => self).delete_all
|
||||
Notification.joins(:notification_actors).where(:notification_actors => {:person_id => self.id}).all.each{ |n| n.destroy}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ end
|
|||
|
||||
Factory.define(:notification) do |n|
|
||||
n.association :recipient, :factory => :user
|
||||
n.association :actor, :factory => :person
|
||||
n.association :actors, :factory => :person
|
||||
n.association :target, :factory => :comment
|
||||
n.after_build do |note|
|
||||
note.action = note.target.notification_type(note.recipient, note.actor)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,11 @@ describe Notification do
|
|||
@note.associations[:people].type.should == :many
|
||||
end
|
||||
|
||||
it 'destoys the associated notification_actor' do
|
||||
@note.save
|
||||
lambda{@note.destroy}.should change(NotificationActors, :count).by(-1)
|
||||
end
|
||||
|
||||
describe '.for' do
|
||||
it 'returns all of a users notifications' do
|
||||
user2 = Factory.create(:user)
|
||||
|
|
|
|||
Loading…
Reference in a new issue