FEATURE: Send the user a notification when their post is approved

This commit is contained in:
Robin Ward
2019-04-15 16:19:32 -04:00
parent de10bd7fb4
commit 3ceff0a92a
5 changed files with 20 additions and 3 deletions

View File

@@ -57,6 +57,12 @@ RSpec.describe ReviewableQueuedPost, type: :model do
expect(Topic.count).to eq(topic_count)
expect(Post.count).to eq(post_count + 1)
notifications = Notification.where(
user: reviewable.created_by,
notification_type: Notification.types[:post_approved]
)
expect(notifications).to be_present
# We can't approve twice
expect(-> { reviewable.perform(moderator, :approve) }).to raise_error(Reviewable::InvalidAction)
end