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:
Robin Ward
2013-07-24 14:22:32 -04:00
parent 0a7bbb08e1
commit 2319a824f8
5 changed files with 148 additions and 8 deletions

View File

@@ -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