     email = new_email(from: %{foo: :bar})
 
     assert_raise ArgumentError, fn ->
-      FooMailer.deliver_now(email)
+      Mailer.deliver_now(email)
     end
   end
 


    assert_raise RuntimeError, ~r/cannot call Bamboo.Mailer/, fn ->
      Bamboo.Mailer.deliver_later(email)
    end
  end


  use ExUnit.Case
  alias Bamboo.Email

  @mailer_config adapter: __MODULE__.DefaultAdapter, foo: :bar

  setup context do
    config =
      Keyword.merge(@mailer_config, [adapter: context[:adapter]], fn
        _, v, nil -> v
        _, _, v -> v
      end)

    Application.put_env(:bamboo, __MODULE__.Mailer, config)
    Process.register(self(), :mailer_test)
    on_exit(fn -> Application.delete_env(:bamboo, __MODULE__.Mailer) end)
    :ok
  end

  defmodule(Mailer, do: use(Bamboo.Mailer, otp_app: :bamboo))

  defmodule DefaultAdapter do
    def deliver(email, config), do: send(:mailer_test, {:deliver, email, config})

    def handle_config(config), do: config

    def supports_attachments?, do: true
  end

  test "deliver_now/1 converts binary addresses to %{name: name, email: email}" do
    address = "foo@bar.com"
    email = new_email(from: address, to: address, cc: address, bcc: address)

    Mailer.deliver_now(email)

    converted_address = {nil, address}
    assert_received {:deliver, delivered_email, _}
