Post follow and updates notifications V1 (#111)

* It is now possible to follow a post in order to receive updates about it
* Notifications are now sent when updates are published
* Post status changes are now tracked
* Update sidebar now shows the post status history
* Mark a comment as a post update using the comment form
* ... more ...
This commit is contained in:
Riccardo Graziosi
2022-05-28 11:03:36 +02:00
committed by GitHub
parent ce7be1b30c
commit dad382d2b1
59 changed files with 1080 additions and 71 deletions

View File

@@ -8,15 +8,16 @@ RSpec.describe UserMailer, type: :mailer do
let(:mail) { UserMailer.notify_post_owner(comment: comment) }
it "renders the headers" do
expect(mail.subject).to eq("[#{ENV.fetch('APP_NAME')}] - New comment on #{post.title}")
expect(mail.subject).to eq("[#{ENV.fetch('APP_NAME')}] New comment on #{post.title}")
expect(mail.to).to eq(["notified@example.com"])
expect(mail.from).to eq(["notifications@example.com"])
end
it "renders the body" do
expect(mail.body.encoded).to include("Hello, #{user.full_name}")
expect(mail.body.encoded).to include("There is a new comment by")
expect(mail.body.encoded).to include('Annoyed ? You can <a href="http://localhost:3000/users/edit">turn off notifications here</a>')
it "renders the user name, post title, replier name and comment body" do
expect(mail.body.encoded).to include(user.full_name)
expect(mail.body.encoded).to include(post.title)
expect(mail.body.encoded).to include(comment.user.full_name)
expect(mail.body.encoded).to include(comment.body)
end
end
end