FIX: wasn't able to parse FROM email in the embedded email

This commit is contained in:
Régis Hanol
2016-12-01 18:34:47 +01:00
parent 8a0cf1b90e
commit 62763f025c
4 changed files with 77 additions and 4 deletions

View File

@ -383,6 +383,32 @@ describe Email::Receiver do
expect(Post.last.raw).to match(/discourse\.rb/)
end
it "handles forwarded emails" do
SiteSetting.enable_forwarded_emails = true
expect { process(:forwarded_email_1) }.to change(Topic, :count)
forwarded_post, last_post = *Post.last(2)
expect(forwarded_post.user.email).to eq("some@one.com")
expect(last_post.user.email).to eq("ba@bar.com")
expect(forwarded_post.raw).to match(/XoXo/)
expect(last_post.raw).to match(/can you have a look at this email below/)
end
it "handles weirdly forwarded emails" do
SiteSetting.enable_forwarded_emails = true
expect { process(:forwarded_email_2) }.to change(Topic, :count)
forwarded_post, last_post = *Post.last(2)
expect(forwarded_post.user.email).to eq("some@one.com")
expect(last_post.user.email).to eq("ba@bar.com")
expect(forwarded_post.raw).to match(/XoXo/)
expect(last_post.raw).to match(/can you have a look at this email below/)
end
end
context "new topic in a category" do