OMG SO MANY EMAILS, fixed

This commit is contained in:
Raphael Sofaer 2011-05-11 16:07:24 -07:00
parent 6fa433ced8
commit 970190fb7a
2 changed files with 29 additions and 11 deletions

View file

@ -41,6 +41,6 @@ class Like < ActiveRecord::Base
end
def notification_type(user, person)
Notifications::Liked unless user.person == person
Notifications::Liked if self.post.author == user.person && user.person != person
end
end

View file

@ -34,6 +34,24 @@ describe Like do
end
end
describe '#notification_type' do
before do
@like = @bob.like(1, :on => @status)
end
it 'should be notifications liked if you are the post owner' do
@like.notification_type(@alice, @bob.person).should be Notifications::Liked
end
it 'should not notify you if you are the like-r owner' do
@like.notification_type(@bob, @alice.person).should be_nil
end
it 'should not notify you if you did not create the post' do
@like.notification_type(@bob, @alice.person).should be_nil
end
end
describe 'xml' do
before do
@liker = Factory.create(:user)