Closed lvalencia closed 6 years ago
Context: When I mock an module call and try to run tests async I got a concurrent_reload error from Meck
Problem: We can't run tests asynchronously if we're mocking module calls
Is there a workaround for this?
Sample Error
...** (EXIT from #PID<0.71.0>) an exception was raised: ** (ErlangError) erlang error: :concurrent_reload src/meck_proc.erl:458: :meck_proc.check_if_being_reloaded/1 src/meck_proc.erl:231: :meck_proc.handle_call/3 (stdlib) gen_server.erl:615: :gen_server.try_handle_call/4 (stdlib) gen_server.erl:647: :gen_server.handle_msg/5 (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3 21:35:18.669 [error] GenServer MyApp.Repo_meck terminating ** (stop) :concurrent_reload src/meck_proc.erl:458: :meck_proc.check_if_being_reloaded/1 src/meck_proc.erl:231: :meck_proc.handle_call/3 (stdlib) gen_server.erl:615: :gen_server.try_handle_call/4 (stdlib) gen_server.erl:647: :gen_server.handle_msg/5 (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3 Last message: {:set_expect, {{:insert, 1}, [{{:args_matcher, [:_], "", false}, {:meck_exec, #Function<0.14554771/1 in MyApp.MyControllerSpec.before_jcswrdayflhugompvzxeinbtkq/1>}}]}}
sample problem code
use ESpec.Phoenix, controller: MyApp.MyController, async: true alias MyApp.Repo ... before do allow(Repo).to accept(:insert, fn(_changeset) -> {:ok, @response} end) end it "does something" do ... end
regards.
found a link to the same issue addressed directly on espec repo
https://github.com/antonmi/espec/issues/184
Context: When I mock an module call and try to run tests async I got a concurrent_reload error from Meck
Problem: We can't run tests asynchronously if we're mocking module calls
Is there a workaround for this?
Sample Error
sample problem code
regards.