diff options
author | lain <lain@soykaf.club> | 2020-08-06 15:22:20 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-08-06 15:22:20 +0200 |
commit | bf95dfb240cff8c5a2f8a0930e5309a09ca00ba1 (patch) | |
tree | 3a0c81155e7ae38e27008a7c066e8bc03fb1b410 /test/support/helpers.ex | |
parent | 532d6f94aea5d4f53e846b8b77296f80a9ae68a0 (diff) | |
parent | 10b0e55acffeeff5842421c12b3b26feb35336de (diff) | |
download | pleroma-bf95dfb240cff8c5a2f8a0930e5309a09ca00ba1.tar.gz |
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into frontend-bundles-downloads
Diffstat (limited to 'test/support/helpers.ex')
-rw-r--r-- | test/support/helpers.ex | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/test/support/helpers.ex b/test/support/helpers.ex index 5cbf2e291..ecd4b1e18 100644 --- a/test/support/helpers.ex +++ b/test/support/helpers.ex @@ -17,9 +17,19 @@ defmodule Pleroma.Tests.Helpers do defmacro clear_config(config_path, do: yield) do quote do - initial_setting = Config.get(unquote(config_path)) + initial_setting = Config.fetch(unquote(config_path)) unquote(yield) - on_exit(fn -> Config.put(unquote(config_path), initial_setting) end) + + on_exit(fn -> + case initial_setting do + :error -> + Config.delete(unquote(config_path)) + + {:ok, value} -> + Config.put(unquote(config_path), value) + end + end) + :ok end end |