diff options
author | Angelina Filippova <linakirsanova@gmail.com> | 2020-08-07 21:05:44 +0300 |
---|---|---|
committer | Angelina Filippova <linakirsanova@gmail.com> | 2020-08-07 21:05:44 +0300 |
commit | f21b6ebd5d71b77b1f2b7c8918005c3b70752c15 (patch) | |
tree | 7beddc568e0e1430ab6bc8fdbc4c6d9d04744d49 /test/support/helpers.ex | |
parent | 8e1f7a3eff05a43f59f15dc6fa0483713e221fa7 (diff) | |
parent | 8e90cc58e7ec3f19f03d049ff541750f1ab4774e (diff) | |
download | pleroma-f21b6ebd5d71b77b1f2b7c8918005c3b70752c15.tar.gz pleroma-f21b6ebd5d71b77b1f2b7c8918005c3b70752c15.zip |
Merge branch 'feature/update-welcome-setting-in-description' of git.pleroma.social:pleroma/pleroma into feature/update-welcome-setting-in-description
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 |