FIX: don't process the same incoming email more than once

This commit is contained in:
Régis Hanol
2017-05-18 16:43:07 +02:00
parent 13e489b4ca
commit 4fb335f1f0
2 changed files with 18 additions and 9 deletions

View File

@ -160,6 +160,13 @@ describe Email::Receiver do
expect(topic.posts.last.raw).to eq("This is a **HTML** reply ;)")
end
it "doesn't process email with same message-id more than once" do
expect do
process(:text_reply)
process(:text_reply)
end.to change { topic.posts.count }.by(1)
end
it "handles different encodings correctly" do
expect { process(:hebrew_reply) }.to change { topic.posts.count }
expect(topic.posts.last.raw).to eq("שלום! מה שלומך היום?")