From 0422b5fb19ac0956b464611b84bbd250ece1148e Mon Sep 17 00:00:00 2001 From: May Miller-Ricci Date: Mon, 1 Apr 2019 14:01:43 -0700 Subject: [PATCH] Reverse order of email and response tuple --- lib/bamboo/mailer.ex | 6 +++--- test/lib/bamboo/mailer_test.exs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/bamboo/mailer.ex b/lib/bamboo/mailer.ex index 2a3d346e..ace154f6 100644 --- a/lib/bamboo/mailer.ex +++ b/lib/bamboo/mailer.ex @@ -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) @@ -130,7 +130,7 @@ defmodule Bamboo.Mailer do else debug_sent(email, adapter) response = adapter.deliver(email, config) - {response, email} + {email, response} end end diff --git a/test/lib/bamboo/mailer_test.exs b/test/lib/bamboo/mailer_test.exs index c4f031ad..fb3c2aad 100644 --- a/test/lib/bamboo/mailer_test.exs +++ b/test/lib/bamboo/mailer_test.exs @@ -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