Commit 6110e175 authored by Douwe Maan's avatar Douwe Maan

Use heredocs.

parent 54b04f1c
Delivered-To: test@mail.com
Return-Path: <walter.white@googlemail.com>
From: Walter White <walter.white@googlemail.com>
Content-Type: multipart/alternative;
boundary=Apple-Mail-8E182EEF-9DBC-41DE-A593-DF2E5EBD3975
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (1.0)
Subject: Re: Signature in email replies!
Date: Thu, 23 Oct 2014 14:43:49 +0530
References: <1234@mail.gmail.com>
In-Reply-To: <1234@mail.gmail.com>
To: Arpit Jalan <test@mail.com>
X-Mailer: iPhone Mail (12A405)
--Apple-Mail-8E182EEF-9DBC-41DE-A593-DF2E5EBD3975
Content-Type: text/plain;
charset=us-ascii
Content-Transfer-Encoding: 7bit
This post should not include signature.
Sent from my iPhone
> On 23-Oct-2014, at 9:45 am, Arpit Jalan <test@mail.com> wrote:
>
> Signature in email replies!
--Apple-Mail-8E182EEF-9DBC-41DE-A593-DF2E5EBD3975
...@@ -35,146 +35,158 @@ describe Gitlab::Email::ReplyParser do ...@@ -35,146 +35,158 @@ describe Gitlab::Email::ReplyParser do
it "handles multiple paragraphs" do it "handles multiple paragraphs" do
expect(test_parse_body(fixture_file("emails/paragraphs.eml"))). expect(test_parse_body(fixture_file("emails/paragraphs.eml"))).
to eq( to eq(
"Is there any reason the *old* candy can't be be kept in silos while the new candy <<-BODY.strip_heredoc.chomp
is imported into *new* silos? Is there any reason the *old* candy can't be be kept in silos while the new candy
is imported into *new* silos?
The thing about candy is it stays delicious for a long time -- we can just keep The thing about candy is it stays delicious for a long time -- we can just keep
it there without worrying about it too much, imo. it there without worrying about it too much, imo.
Thanks for listening." Thanks for listening.
BODY
) )
end end
it "handles multiple paragraphs when parsing html" do it "handles multiple paragraphs when parsing html" do
expect(test_parse_body(fixture_file("emails/html_paragraphs.eml"))). expect(test_parse_body(fixture_file("emails/html_paragraphs.eml"))).
to eq( to eq(
"Awesome! <<-BODY.strip_heredoc.chomp
Awesome!
Pleasure to have you here! Pleasure to have you here!
:boom:" :boom:
BODY
) )
end end
it "handles newlines" do it "handles newlines" do
expect(test_parse_body(fixture_file("emails/newlines.eml"))). expect(test_parse_body(fixture_file("emails/newlines.eml"))).
to eq( to eq(
"This is my reply. <<-BODY.strip_heredoc.chomp
It is my best reply. This is my reply.
It will also be my *only* reply." It is my best reply.
It will also be my *only* reply.
BODY
) )
end end
it "handles inline reply" do it "handles inline reply" do
expect(test_parse_body(fixture_file("emails/inline_reply.eml"))). expect(test_parse_body(fixture_file("emails/inline_reply.eml"))).
to eq( to eq(
"On Wed, Oct 8, 2014 at 11:12 AM, techAPJ <info@unconfigured.discourse.org> wrote: <<-BODY.strip_heredoc.chomp
On Wed, Oct 8, 2014 at 11:12 AM, techAPJ <info@unconfigured.discourse.org> wrote:
> techAPJ <https://meta.discourse.org/users/techapj>
> November 28 > techAPJ <https://meta.discourse.org/users/techapj>
> > November 28
> Test reply. >
> > Test reply.
> First paragraph. >
> > First paragraph.
> Second paragraph. >
> > Second paragraph.
> To respond, reply to this email or visit >
> https://meta.discourse.org/t/testing-default-email-replies/22638/3 in > To respond, reply to this email or visit
> your browser. > https://meta.discourse.org/t/testing-default-email-replies/22638/3 in
> ------------------------------ > your browser.
> Previous Replies codinghorror > ------------------------------
> <https://meta.discourse.org/users/codinghorror> > Previous Replies codinghorror
> November 28 > <https://meta.discourse.org/users/codinghorror>
> > November 28
> We're testing the latest GitHub email processing library which we are >
> integrating now. > We're testing the latest GitHub email processing library which we are
> > integrating now.
> https://github.com/github/email_reply_parser >
> > https://github.com/github/email_reply_parser
> Go ahead and reply to this topic and I'll reply from various email clients >
> for testing. > Go ahead and reply to this topic and I'll reply from various email clients
> ------------------------------ > for testing.
> > ------------------------------
> To respond, reply to this email or visit >
> https://meta.discourse.org/t/testing-default-email-replies/22638/3 in > To respond, reply to this email or visit
> your browser. > https://meta.discourse.org/t/testing-default-email-replies/22638/3 in
> > your browser.
> To unsubscribe from these emails, visit your user preferences >
> <https://meta.discourse.org/my/preferences>. > To unsubscribe from these emails, visit your user preferences
> > <https://meta.discourse.org/my/preferences>.
>
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over
the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown The quick brown fox jumps over the lazy dog. The quick brown fox jumps over
fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
the lazy dog. The quick brown fox jumps over the lazy dog." The quick brown fox jumps over the lazy dog. The quick brown fox jumps over
the lazy dog. The quick brown fox jumps over the lazy dog.
BODY
) )
end end
it "strips iPhone signature" do
expect(test_parse_body(fixture_file("emails/iphone_signature.eml"))).not_to match /Sent from my iPhone/
end
it "properly renders email reply from gmail web client" do it "properly renders email reply from gmail web client" do
expect(test_parse_body(fixture_file("emails/gmail_web.eml"))). expect(test_parse_body(fixture_file("emails/gmail_web.eml"))).
to eq( to eq(
"### This is a reply from standard GMail in Google Chrome. <<-BODY.strip_heredoc.chomp
### This is a reply from standard GMail in Google Chrome.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over The quick brown fox jumps over the lazy dog. The quick brown fox jumps over
the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown
fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over The quick brown fox jumps over the lazy dog. The quick brown fox jumps over
the lazy dog. The quick brown fox jumps over the lazy dog. the lazy dog. The quick brown fox jumps over the lazy dog.
Here's some **bold** text in Markdown. Here's some **bold** text in Markdown.
Here's a link http://example.com" Here's a link http://example.com
BODY
) )
end end
it "properly renders email reply from iOS default mail client" do it "properly renders email reply from iOS default mail client" do
expect(test_parse_body(fixture_file("emails/ios_default.eml"))). expect(test_parse_body(fixture_file("emails/ios_default.eml"))).
to eq( to eq(
"### this is a reply from iOS default mail <<-BODY.strip_heredoc.chomp
### this is a reply from iOS default mail
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
Here's some **bold** markdown text. Here's some **bold** markdown text.
Here's a link http://example.com" Here's a link http://example.com
BODY
) )
end end
it "properly renders email reply from Android 5 gmail client" do it "properly renders email reply from Android 5 gmail client" do
expect(test_parse_body(fixture_file("emails/android_gmail.eml"))). expect(test_parse_body(fixture_file("emails/android_gmail.eml"))).
to eq( to eq(
"### this is a reply from Android 5 gmail <<-BODY.strip_heredoc.chomp
### this is a reply from Android 5 gmail
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over The quick brown fox jumps over the lazy dog. The quick brown fox jumps over
the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown
fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
This is **bold** in Markdown. This is **bold** in Markdown.
This is a link to http://example.com" This is a link to http://example.com
BODY
) )
end end
it "properly renders email reply from Windows 8.1 Metro default mail client" do it "properly renders email reply from Windows 8.1 Metro default mail client" do
expect(test_parse_body(fixture_file("emails/windows_8_metro.eml"))). expect(test_parse_body(fixture_file("emails/windows_8_metro.eml"))).
to eq( to eq(
"### reply from default mail client in Windows 8.1 Metro <<-BODY.strip_heredoc.chomp
### reply from default mail client in Windows 8.1 Metro
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
This is a **bold** word in Markdown This is a **bold** word in Markdown
This is a link http://example.com" This is a link http://example.com
BODY
) )
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment