added failure test for deleted likes
This commit is contained in:
parent
66c28c4caf
commit
2f6d079635
3 changed files with 18 additions and 1 deletions
|
|
@ -24,7 +24,11 @@ module NotificationsHelper
|
||||||
end
|
end
|
||||||
elsif note.instance_of?(Notifications::Liked)
|
elsif note.instance_of?(Notifications::Liked)
|
||||||
post = note.target
|
post = note.target
|
||||||
"#{translation(target_type, post.author.name)} #{link_to t('notifications.post'), status_message_path(post), 'data-ref' => post.id, :class => 'hard_object_link'}".html_safe
|
if post
|
||||||
|
"#{translation(target_type, post.author.name)} #{link_to t('notifications.post'), status_message_path(post), 'data-ref' => post.id, :class => 'hard_object_link'}".html_safe
|
||||||
|
else
|
||||||
|
t('notifications.liked_post_deleted')
|
||||||
|
end
|
||||||
else #Notifications:StartedSharing, etc.
|
else #Notifications:StartedSharing, etc.
|
||||||
translation(target_type)
|
translation(target_type)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -299,6 +299,7 @@ en:
|
||||||
post: "post."
|
post: "post."
|
||||||
deleted: "deleted"
|
deleted: "deleted"
|
||||||
also_commented_deleted: "commented on a deleted post."
|
also_commented_deleted: "commented on a deleted post."
|
||||||
|
liked_post_deleted: "liked your deleted post."
|
||||||
index:
|
index:
|
||||||
notifications: "Notifications"
|
notifications: "Notifications"
|
||||||
mark_all_as_read: "Mark All as Read"
|
mark_all_as_read: "Mark All as Read"
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,18 @@ describe NotificationsHelper do
|
||||||
output = object_link(@notification)
|
output = object_link(@notification)
|
||||||
output.should include t("#{@notification.popup_translation_key}")
|
output.should include t("#{@notification.popup_translation_key}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when post is deleted' do
|
||||||
|
it 'works' do
|
||||||
|
@post.destroy
|
||||||
|
expect{ object_link(@notification)}.should_not raise_error
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'displays that the post was deleted' do
|
||||||
|
@post.destroy
|
||||||
|
object_link(@notification).should == t('notifications.liked_post_deleted')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue