<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="391215" data-post-id="391215">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mudasobwa" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mudasobwa/120/5298_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mudasobwa
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Cure</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="funboy" data-post="11" data-topic="75844">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/f/ee7513/48.png" class="avatar"> funboy:</div>
<blockquote>
<p>For example, in test env we may want to avoid making real HTTP calls or spawning real processes</p>
</blockquote>
</aside>
<p>HTTP call or spawning a process is <em>already</em> a dependency. You fall prey of the chicken-egg problem. It not that <code>mox</code> enforces you to introduce behaviours where they don’t belong. On the contrary, it <em>highlights</em> the places where the dependency injection must have happened.</p>
<p>We migrated to <code>Req</code> when it appeared in 10 minutes, because—guess what—our HTTP calls were already abstracted.</p>
<aside class="quote no-group quote-modified" data-username="funboy" data-post="11" data-topic="75844">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/f/ee7513/48.png" class="avatar"> funboy:</div>
<blockquote>
<p>It lets you mock <strong>internal modules</strong> […]</p>
</blockquote>
</aside>
<p>That is exactly what <code>Mox</code> <strong>intentionally</strong> <strong>prevents</strong>. Not because they could not figure it out. Because it improves the code quality, while adaptive, indiscriminate, and promiscuous mocking library welcomes God spaghetti objects in your code.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="391215" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/what-api-mocking-tool-are-elixir-teams-using/75844/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-391215" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="391215"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="391216" data-post-id="391216">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mudasobwa" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mudasobwa/120/5298_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mudasobwa
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Cure</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Exactly. The best feature of <code>mox</code> is not it helps to test stuff, but rather it literally points out to the places in the code that were forgotten to be decoupled with dependency injections.</p>
<p>Libraries being so friendly to swallow whatever people want to mock are no better than just marking tests as <code>@tag skip: true</code> on that matter.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="391216" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/what-api-mocking-tool-are-elixir-teams-using/75844/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-391216" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="391216"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="391217" data-post-id="391217">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="krasenyp" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/krasenyp/120/39733_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  krasenyp
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>The mantra that protocols are about data really doesn’t make sense to me. Implementers of a protocol can also depend on the environment… Maybe I should write a blog post about it. Seems like there are some deficiency in the community regarding dependency injection.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="391217" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/what-api-mocking-tool-are-elixir-teams-using/75844/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-391217" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="391217"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="391218" data-post-id="391218">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mudasobwa" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mudasobwa/120/5298_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mudasobwa
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Cure</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="krasenyp" data-post="14" data-topic="75844">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/krasenyp/48/39733_2.png" class="avatar"> krasenyp:</div>
<blockquote>
<p>Maybe I should write a blog post about it.</p>
</blockquote>
</aside>
<p>If you mention “dependency injection is a boundary allowing to easier decouple the code” there, I would be super-grateful because I have it (writing such a text) on my to-do list for months already.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="391218" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/what-api-mocking-tool-are-elixir-teams-using/75844/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-391218" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="391218"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="391220" data-post-id="391220">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="funboy" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  funboy
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="mudasobwa" data-post="12" data-topic="75844">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mudasobwa/48/5298_2.png" class="avatar"> mudasobwa:</div>
<blockquote>
<p>a process is <em>already</em> a dependency</p>
</blockquote>
</aside>
<p>That’s interesting - so in other words do u think I should abstract away e.g. GenServer? <img src="https://forum.elixirforum.com/images/emoji/apple/thinking.png?v=15" title=":thinking:" class="emoji" alt=":thinking:" loading="lazy" width="20" height="20"></p>
<p>e.g.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># moduleA
def foo_a(...) do
   ModuleB.fun_b(...)
   |&gt; actiona
   |&gt; actionb
   |&gt; ...
end

#moduleb 
use GenServer
def fun_b(....) do
     GenServer.call(...)
end

def init(..) ...
</code></pre>
<p>In the example above I usually stub return data from moduleB.fun_b to write unit tests fro moduleA<br>
Mimic allows me to do it without configuration burden, but I see that using mock implementation for GenServer while testing may work too - GenServer has already behavior - it is enough to mock it’s functions.<br>
The only problem I see it to not easy distinguish of GenServer calls - as we would have to differ them based on pattern matching args which might be not very readable</p>
<p>I mean instead</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">stub(ModuleB, foo, fn -&gt; returnA end)
stub(ModuleC, foo, fn -&gt; return end)
</code></pre>
<p>we would need</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">stub(GenServer, call, fn _, 
                           {:update, "id"} -&gt; returnA # moduleB call
                           {:update, "item"} -&gt; returnB  # moduleC call
                           
end)
</code></pre>
<p>another problem is deep call sequence - we would have to stub all GenServer call/cast down in call stack - where with Mimic we can isolate it right away in the testing module without worring about dependencies very deep down in the code <img src="https://forum.elixirforum.com/images/emoji/apple/thinking.png?v=15" title=":thinking:" class="emoji" alt=":thinking:" loading="lazy" width="20" height="20"><br>
please correct me if I missed sth <img src="https://forum.elixirforum.com/images/emoji/apple/folded_hands.png?v=15" title=":folded_hands:" class="emoji" alt=":folded_hands:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="krasenyp" data-post="14" data-topic="75844">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/krasenyp/48/39733_2.png" class="avatar"> krasenyp:</div>
<blockquote>
<p>The mantra that protocols are about data really doesn’t make sense to me</p>
</blockquote>
</aside>
<p>Please do consider to update Elixir <a href="https://elixir.hexdocs.pm/protocols.html" rel="noopener nofollow ugc">doc</a> then <img src="https://forum.elixirforum.com/images/emoji/apple/sweat_smile.png?v=15" title=":sweat_smile:" class="emoji" alt=":sweat_smile:" loading="lazy" width="20" height="20"></p>
<blockquote>
<p>Protocols are a mechanism to achieve polymorphism in Elixir where you want the behavior to vary depending on the data type.</p>
</blockquote>
<aside class="quote no-group" data-username="krasenyp" data-post="14" data-topic="75844">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/krasenyp/48/39733_2.png" class="avatar"> krasenyp:</div>
<blockquote>
<p>. Implementers of a protocol can also depend on the environment</p>
</blockquote>
</aside>
<p>ok, so do u suggest to pass env as a first arg to protocol to get different behavior, am I right?<br>
Why not use behaviors instead? <img src="https://forum.elixirforum.com/images/emoji/apple/thinking.png?v=15" title=":thinking:" class="emoji" alt=":thinking:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="krasenyp" data-post="14" data-topic="75844">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/krasenyp/48/39733_2.png" class="avatar"> krasenyp:</div>
<blockquote>
<p>Maybe I should write a blog post about i</p>
</blockquote>
</aside>
<p>Please do! I would love to read it <img src="https://forum.elixirforum.com/images/emoji/apple/folded_hands.png?v=15" title=":folded_hands:" class="emoji" alt=":folded_hands:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="391220" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/what-api-mocking-tool-are-elixir-teams-using/75844/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-391220" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="391220"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="391222" data-post-id="391222">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="krasenyp" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/krasenyp/120/39733_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  krasenyp
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>You can’t pass something different than the implementer as first argument when implementing a protocol.</p>
<p>Also, why would you stub a GenServer? Just spin one in your test and pass the pid to your function or whatever. This tells me there might be bigger, more general, problems in the code base.</p>
<p>Are we using OTP to write procedural code, with god objects and all?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="391222" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/what-api-mocking-tool-are-elixir-teams-using/75844/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-391222" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="391222"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="391223" data-post-id="391223">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="funboy" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  funboy
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="krasenyp" data-post="17" data-topic="75844">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/krasenyp/48/39733_2.png" class="avatar"> krasenyp:</div>
<blockquote>
<p>You can’t pass something different than the implementer as first argument when implementing a protocol.</p>
</blockquote>
</aside>
<p>I know <img src="https://forum.elixirforum.com/images/emoji/apple/smiley.png?v=15" title=":smiley:" class="emoji" alt=":smiley:" loading="lazy" width="20" height="20"> The question was - why I should use protocol and passing envs to it - instead of behavior and use Mox?</p>
<aside class="quote no-group" data-username="krasenyp" data-post="17" data-topic="75844">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/krasenyp/48/39733_2.png" class="avatar"> krasenyp:</div>
<blockquote>
<p>Just spin one in your test and pass the pid to your function or whatever.</p>
</blockquote>
</aside>
<p>It’s not a good idea for unit tests. Spawning a process often involves database calls or dependencies on other processes, which can force tests to use <code>async: false</code> and require a much more complex setup. That’s unnecessary overhead when you’re writing unit tests <img src="https://forum.elixirforum.com/images/emoji/apple/grinning_face_with_smiling_eyes.png?v=15" title=":grinning_face_with_smiling_eyes:" class="emoji" alt=":grinning_face_with_smiling_eyes:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="391223" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/what-api-mocking-tool-are-elixir-teams-using/75844/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-391223" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="391223"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="391224" data-post-id="391224">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="krasenyp" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/krasenyp/120/39733_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  krasenyp
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>You do the database calls in the test using the Ecto sandbox and provide the data to the spawned process.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="391224" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/what-api-mocking-tool-are-elixir-teams-using/75844/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-391224" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="391224"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #18"></div>
  </section>
</div>
    <div class="postbit" id="391225" data-post-id="391225">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mudasobwa" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mudasobwa/120/5298_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mudasobwa
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Cure</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="funboy" data-post="16" data-topic="75844">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/f/ee7513/48.png" class="avatar"> funboy:</div>
<blockquote>
<p>In the example above I usually stub return data from <code>moduleB.fun_b</code></p>
</blockquote>
</aside>
<p>I am not sure how you came from stubbing <code>moduleB</code> to mocking the <code>GenServer</code>. Let’s make a step back and discuss the business process. You have a surfacing <code>GenServer</code> that relies on the implementation of some functionality hidden behind the <code>moduleB</code> façade.</p>
<p>The proper design is the <code>GenServer</code> is not tied to <code>moduleB</code> but rather implements a process layer above it. That evidently means <code>moduleB</code> has to be a dependency. Just do <code>@foo_handler Application.compile_env(:foo_app, :foo_handler, ModuleB)</code> if you want a static linking, or pass <code>foo_handler: ModuleB</code> to <code>foo_a</code> if you want it dynamic.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="391225" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/what-api-mocking-tool-are-elixir-teams-using/75844/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-391225" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="391225"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #19"></div>
  </section>
</div>
    <div class="postbit" id="391226" data-post-id="391226">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="funboy" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  funboy
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="krasenyp" data-post="19" data-topic="75844" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/krasenyp/48/39733_2.png" class="avatar"> krasenyp:</div>
<blockquote>
<p>You do the database calls in the test using the Ecto sandbox and provide the data to the spawned process.</p>
</blockquote>
</aside>
<p>unti test shouldn’t call db at all - it should be small, super fast, async, and isolated.<br>
anyway calling db was one of 3 examples - why did u ignore the rest two? <img src="https://forum.elixirforum.com/images/emoji/apple/thinking.png?v=15" title=":thinking:" class="emoji" alt=":thinking:" loading="lazy" width="20" height="20"></p>
<blockquote>
<p>dependencies on other processes, more complex test setup - which often leads to NON async tests</p>
</blockquote>
<p>and these were just examples - there might be more problems like name: <strong>MODULE</strong> (u cannot spawn more processes with the same name, so u can’t run tests in async way) - the list goes on</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="391226" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/what-api-mocking-tool-are-elixir-teams-using/75844/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-391226" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="391226"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #20"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/75844/load_more?page=3">Load more posts (9 remaining)</a>
</div></template></turbo-stream>