summaryrefslogtreecommitdiff
path: root/test/support/helpers.ex
diff options
context:
space:
mode:
authorMark Felder <feld@FreeBSD.org>2020-08-07 14:55:22 -0500
committerMark Felder <feld@FreeBSD.org>2020-08-07 14:55:22 -0500
commit54e2af829377b3f21823548e5612bbbb41550432 (patch)
tree0ad164ee09bba1a82560d192d71d14033f70b195 /test/support/helpers.ex
parent474147a67a89f8bd92186dbda93d78d8e2045d52 (diff)
parent39ca4a23c6c4a6cac9b277b8473ab9040a250e68 (diff)
downloadpleroma-54e2af829377b3f21823548e5612bbbb41550432.tar.gz
pleroma-54e2af829377b3f21823548e5612bbbb41550432.zip
Merge branch 'develop' into fix/ldap-auth-issues
Diffstat (limited to 'test/support/helpers.ex')
-rw-r--r--test/support/helpers.ex14
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