mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Special work to never include previous posts in parsed emails. Also a new attempt
to catch reply strings in different languages.
This commit is contained in:
@@ -21,7 +21,7 @@ describe Email::Receiver do
|
||||
let(:reply_below) { File.read("#{Rails.root}/spec/fixtures/emails/multipart.eml") }
|
||||
let(:receiver) { Email::Receiver.new(reply_below) }
|
||||
|
||||
it "does something" do
|
||||
it "processes correctly" do
|
||||
receiver.process
|
||||
expect(receiver.body).to eq(
|
||||
"So presumably all the quoted garbage and my (proper) signature will get
|
||||
@@ -33,18 +33,48 @@ stripped from my reply?")
|
||||
let(:reply_below) { File.read("#{Rails.root}/spec/fixtures/emails/html_only.eml") }
|
||||
let(:receiver) { Email::Receiver.new(reply_below) }
|
||||
|
||||
it "does something" do
|
||||
it "processes correctly" do
|
||||
receiver.process
|
||||
expect(receiver.body).to eq("The EC2 instance - I've seen that there tends to be odd and " +
|
||||
"unrecommended settings on the Bitnami installs that I've checked out.")
|
||||
end
|
||||
end
|
||||
|
||||
describe "it supports a dutch reply" do
|
||||
let(:dutch) { File.read("#{Rails.root}/spec/fixtures/emails/dutch.eml") }
|
||||
let(:receiver) { Email::Receiver.new(dutch) }
|
||||
|
||||
it "processes correctly" do
|
||||
receiver.process
|
||||
expect(receiver.body).to eq("Dit is een antwoord in het Nederlands.")
|
||||
end
|
||||
end
|
||||
|
||||
describe "if wrote is on a second line" do
|
||||
let(:wrote) { File.read("#{Rails.root}/spec/fixtures/emails/multiline_wrote.eml") }
|
||||
let(:receiver) { Email::Receiver.new(wrote) }
|
||||
|
||||
it "processes correctly" do
|
||||
receiver.process
|
||||
expect(receiver.body).to eq("Thanks!")
|
||||
end
|
||||
end
|
||||
|
||||
describe "remove previous discussion" do
|
||||
let(:previous) { File.read("#{Rails.root}/spec/fixtures/emails/previous.eml") }
|
||||
let(:receiver) { Email::Receiver.new(previous) }
|
||||
|
||||
it "processes correctly" do
|
||||
receiver.process
|
||||
expect(receiver.body).to eq("This will not include the previous discussion that is present in this email.")
|
||||
end
|
||||
end
|
||||
|
||||
describe "multiple paragraphs" do
|
||||
let(:paragraphs) { File.read("#{Rails.root}/spec/fixtures/emails/paragraphs.eml") }
|
||||
let(:receiver) { Email::Receiver.new(paragraphs) }
|
||||
|
||||
it "does something" do
|
||||
it "processes correctly" do
|
||||
receiver.process
|
||||
expect(receiver.body).to eq(
|
||||
"Is there any reason the *old* candy can't be be kept in silos while the new candy
|
||||
|
||||
Reference in New Issue
Block a user