diff --git a/src/support/z_context.erl b/src/support/z_context.erl index b162372a6d..78f9057e03 100644 --- a/src/support/z_context.erl +++ b/src/support/z_context.erl @@ -141,7 +141,7 @@ new(ReqData, Module) -> % @doc Create a new context used when testing parts of zotonic new_tests() -> - z_trans_server:set_context_table(#context{host=test, language=en}). + z_trans_server:set_context_table(#context{host=test, language=en, notifier='z_notifier$test'}). %% @doc Set the dispatch rule for this request to the context var 'zotonic_dispatch' diff --git a/src/support/z_notifier.erl b/src/support/z_notifier.erl index 162bdb4480..6de1624794 100644 --- a/src/support/z_notifier.erl +++ b/src/support/z_notifier.erl @@ -30,6 +30,7 @@ %% interface functions -export([ + start_tests/0, observe/3, observe/4, detach/3, @@ -63,6 +64,12 @@ start_link(SiteProps) when is_list(SiteProps) -> gen_server:start_link({local, Name}, ?MODULE, SiteProps, []). +%% @doc Start a notifier server for unit testing +start_tests() -> + io:format("Starting notifier server.~n"), + gen_server:start_link({local, 'z_notifier$test'}, ?MODULE, [], []). + + %%==================================================================== %% API for subscription %%==================================================================== diff --git a/src/tests/erlydtl/erlydtl_tests_init.erl b/src/tests/erlydtl/erlydtl_tests_init.erl index cdef652124..ff58ce7429 100644 --- a/src/tests/erlydtl/erlydtl_tests_init.erl +++ b/src/tests/erlydtl/erlydtl_tests_init.erl @@ -4,4 +4,5 @@ init() -> z_trans_server:start_tests(), + z_notifier:start_tests(), z_ids:start_tests().