forked from kalys/bamboo_ses
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce better email validation regex
- Loading branch information
Krystof Beuermann
committed
Jan 15, 2019
1 parent
8f1af52
commit 5f8925c
Showing
2 changed files
with
18 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,9 @@ defmodule Bamboo.SesAdapterTest do | |
alias Mail.Parsers.RFC2822 | ||
require IEx | ||
|
||
defp new_email do | ||
defp new_email(to \\ "[email protected]") do | ||
Email.new_email( | ||
to: "[email protected]", | ||
to: to, | ||
from: "[email protected]", | ||
cc: "[email protected]", | ||
bcc: "[email protected]", | ||
|
@@ -54,6 +54,20 @@ defmodule Bamboo.SesAdapterTest do | |
new_email() |> SesAdapter.deliver(%{}) | ||
end | ||
|
||
test "delivers mails with dashes in top level domain successfully" do | ||
expected_request_fn = fn _, _, body, _, _ -> | ||
message = parse_body(body) | ||
assert Mail.get_to(message) == ["[email protected]"] | ||
|
||
{:ok, %{status_code: 200}} | ||
end | ||
|
||
HttpMock | ||
|> expect(:request, expected_request_fn) | ||
|
||
new_email("[email protected]") |> SesAdapter.deliver(%{}) | ||
end | ||
|
||
test "delivers attachments" do | ||
expected_request_fn = fn _, _, body, _, _ -> | ||
message = parse_body(body) | ||
|