Skip to content

Commit

Permalink
Merge pull request #41 from jtormey/fix-runtime-mix-env
Browse files Browse the repository at this point in the history
Determine HTTPoison module at compile time
  • Loading branch information
nelsonic authored Jun 6, 2021
2 parents 84aa3ae + 6d5de64 commit c3a8323
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/elixir_auth_google.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c3a8323

Please sign in to comment.