diff options
author | Kenny Ballou <kennyballou@users.noreply.github.com> | 2016-10-07 19:59:58 -0600 |
---|---|---|
committer | Sam Seay <sam@manuka.co> | 2016-10-08 14:59:58 +1300 |
commit | 0615b46466cece8ce2160cc5093365f6dfe2081e (patch) | |
tree | 02d14e88b8e4ab35e1998576ac896d53154a62ab /test | |
parent | 0584037b09355e8e574227dfa74aedb139d6a1a2 (diff) | |
download | recaptcha-0615b46466cece8ce2160cc5093365f6dfe2081e.tar.gz recaptcha-0615b46466cece8ce2160cc5093365f6dfe2081e.tar.xz |
Refactor configuration variable lookup (#13)
Refactor configuration variable lookup.
Change the `Application.get_env/3` calls to use `Recaptcha.Config.get_env/3` to perform the lookups. Doing so allows the project to defer environment variable lookup to runtime instead of only at compile-time.
Diffstat (limited to 'test')
-rw-r--r-- | test/recaptcha/config_test.exs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/recaptcha/config_test.exs b/test/recaptcha/config_test.exs new file mode 100644 index 0000000..93120c8 --- /dev/null +++ b/test/recaptcha/config_test.exs @@ -0,0 +1,16 @@ +defmodule RecaptchaConfigTest do + use ExUnit.Case, async: true + + test "config can read regular config values" do + Application.put_env(:recaptcha, :test_var, "test") + + assert Recaptcha.Config.get_env(:recaptcha, :test_var) == "test" + end + + test "config can read environment variables" do + System.put_env("TEST_VAR", "test_env_vars") + Application.put_env(:recaptcha, :test_env_var, {:system, "TEST_VAR"}) + + assert Recaptcha.Config.get_env(:recaptcha, :test_env_var) == "test_env_vars" + end +end |