File size: 428 Bytes
6778ee0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
defmodule Plausible.Test.Support.Sandbox do
  @moduledoc """
  Prevent background processes from interfering with tests 
  (e.g. exiting before properly returning the connection) by allowing them to access sandbox
  """
  def allow_salts_process do
    case Process.whereis(Plausible.Session.Salts) do
      nil ->
        :ok

      pid ->
        Ecto.Adapters.SQL.Sandbox.allow(Plausible.Repo, self(), pid)
    end
  end
end