From 6d5de6453dcd1722c2b2f6f62b87433017eb7f53 Mon Sep 17 00:00:00 2001 From: Justin Tormey Date: Thu, 3 Jun 2021 12:30:36 -0500 Subject: [PATCH] Determine httpoison module at compile time --- lib/elixir_auth_google.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/elixir_auth_google.ex b/lib/elixir_auth_google.ex index 37e7d6b..4b05663 100644 --- a/lib/elixir_auth_google.ex +++ b/lib/elixir_auth_google.ex @@ -7,14 +7,14 @@ defmodule ElixirAuthGoogle do @google_token_url "https://oauth2.googleapis.com/token" @google_user_profile "https://www.googleapis.com/oauth2/v3/userinfo" + @httpoison Mix.env() == :test && ElixirAuthGoogle.HTTPoisonMock || HTTPoison + @doc """ `inject_poison/0` injects a TestDouble of HTTPoison in Test so that we don't have duplicate mock in consuming apps. see: https://github.com/dwyl/elixir-auth-google/issues/35 """ - def inject_poison() do - Mix.env() == :test && ElixirAuthGoogle.HTTPoisonMock || HTTPoison - end + def inject_poison(), do: @httpoison @doc """ `get_baseurl_from_conn/1` derives the base URL from the conn struct