Skip to content

Commit

Permalink
reduce noise in tests by checking for Mix.env() == :test
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Jul 18, 2020
1 parent 0498e98 commit 9cf0ef5
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions priv/repo/seeds.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ defmodule Auth.Seeds do
person ->
person
end

IO.inspect(person.id, label: "seeds.exs person.id")
IO.puts("- - - - - - - - - - - - - - - - - - - - - - ")

if(Mix.env() == :test) do
# don't print noise during tests
else
IO.inspect(person.id, label: "seeds.exs person.id")
IO.puts("- - - - - - - - - - - - - - - - - - - - - - ")
end
person
end

Expand All @@ -47,10 +49,14 @@ defmodule Auth.Seeds do
api_key = key.client_id <> "/" <> key.client_secret
# set the AUTH_API_KEY during test run:
System.put_env("AUTH_API_KEY", api_key)
# Set the AUTH_API_KEY to a valid value that is in the DB:
IO.puts("Remember to set the AUTH_API_KEY environment variable:")
IO.puts("export AUTH_API_KEY=#{api_key}")
IO.puts("- - - - - - - - - - - - - - - - - - - - - - ")

if(Mix.env() == :test) do
# don't print noise during tests
else
IO.puts("Remember to set the AUTH_API_KEY environment variable:")
IO.puts("export AUTH_API_KEY=#{api_key}")
IO.puts("- - - - - - - - - - - - - - - - - - - - - - ")
end
key
end
end
Expand Down

0 comments on commit 9cf0ef5

Please sign in to comment.