FIX: better error message when user without permissions replies via email

This commit is contained in:
Maja Komel
2019-06-02 23:49:05 +02:00
committed by Guo Xiang Tan
parent 70b73c2159
commit 87d3b86484
4 changed files with 19 additions and 2 deletions

View File

@ -298,6 +298,13 @@ describe Email::Receiver do
expect(post.user).to eq(user)
end
it "raises a ReplyNotAllowedError when user without permissions is replying" do
Fabricate(:user, email: "bob@bar.com")
category.set_permissions(admins: :full)
category.save
expect { process(:reply_user_not_matching_but_known) }.to raise_error(Email::Receiver::ReplyNotAllowedError)
end
it "raises a TopicNotFoundError when the topic was deleted" do
topic.update_columns(deleted_at: 1.day.ago)
expect { process(:reply_user_matching) }.to raise_error(Email::Receiver::TopicNotFoundError)