Skip to content

Commit

Permalink
Reverse order of email and response tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
maymillerricci committed Apr 12, 2019
1 parent a69dc99 commit 0422b5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/bamboo/mailer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ defmodule Bamboo.Mailer do
`deliver_later/1` if you want to send in the background.
Pass in an argument of `response: true` if you need access to the response
from delivering the email. This returns a tuple of the response from calling
`deliver` with your adapter and the `Email` struct. This is useful if you need
from delivering the email. This returns a tuple of the `Email` struct and the
response from calling `deliver` with your adapter. This is useful if you need
access to any data sent back from your email provider in the response.
Email.welcome_email |> Mailer.deliver_now(response: true)
Expand Down Expand Up @@ -130,7 +130,7 @@ defmodule Bamboo.Mailer do
else
debug_sent(email, adapter)
response = adapter.deliver(email, config)
{response, email}
{email, response}
end
end

Expand Down
6 changes: 3 additions & 3 deletions test/lib/bamboo/mailer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,13 @@ defmodule Bamboo.MailerTest do
end

@tag adapter: ResponseAdapter
test "deliver_now/2 returns response and email when passing in response: true option" do
test "deliver_now/2 returns email and response when passing in response: true option" do
email = new_email(to: "foo@bar.com")

{response, email} = Mailer.deliver_now(email, response: true)
{email, response} = Mailer.deliver_now(email, response: true)

assert %{body: _, headers: _, status_code: _} = response
assert %Email{} = email
assert %{body: _, headers: _, status_code: _} = response
end

@tag adapter: ResponseAdapter
Expand Down

0 comments on commit 0422b5f

Please sign in to comment.