<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="388978" data-post-id="388978">
  <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>Whenever I see mocks, or stubs, of services which get called 5-6 levels deep in the call stack I get goosebumps. Why do I need to have this intimate knowledge of what gets called in order to test a function?. With dependency injection it’s evident what is needed for a function to work.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="388978" 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/how-do-i-write-elixir-tests/75335/32">Post #31</a>
	                </div>
	            </div>
              <div id="likers-container-388978" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="388978"
                     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 #31"></div>
  </section>
</div>
    <div class="postbit" id="388984" data-post-id="388984">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>What is the different between mocks, stubs and dependency injection? I’ve always thought that mock is a test-friendly implementation of some interface, while dependency injection is a technique which provides options to substitute the real implementation with a mock</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="388984" 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/how-do-i-write-elixir-tests/75335/33">Post #32</a>
	                </div>
	            </div>
              <div id="likers-container-388984" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="388984"
                     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 #32"></div>
  </section>
</div>
    <div class="postbit" id="388997" data-post-id="388997">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hauleth" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/120/18942_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hauleth
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>So for me the difference between mock and stub in Elixir is that mock is an implementation that replaces behaviour of some module, especially parts of this module.</p>
<p>So for example you use mock like that:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">Repatch.mock(DateTime, :utc_now, fn -&gt; ~U[2005-04-02 21:37:00+02:00] end)

list = Posts.select_recent()
</code></pre>
<p>Stub is when you write new implementation in your test, that will handle required functions and then that module is somehow injected into the function.</p>
<p>For example in my <a href="https://tangled.org/hauleth.dev/aww" rel="noopener nofollow ugc">Aww library</a>:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Dns do
  @behaviour AwwTest.Dns

  @impl true
  def handle_query("_avatars-sec._tcp.evil.test", :in, :srv) do
    %{
      ttl: 3600,
      data: {0, 0, 0xBEEF, ~c"defederated.example"}
    }
  end

  def handle_query("_avatars-sec._tcp.example.test", :in, :srv) do
    %{
      ttl: 3600,
      data: {0, 0, 0xBEEF, ~c"secure.example"}
    }
  end

  def handle_query("_avatars._tcp.example.test", :in, :srv) do
    %{
      ttl: 3600,
      data: {0, 0, 0xDEAD, ~c"insecure.example"}
    }
  end
end

setup do
  assert {:ok, pid, ns} = start_supervised({AwwTest.Dns, module: Dns})

  on_exit(fn -&gt;
    Aww.Cache.clean(Aww.Cache)
  end)

  {:ok, pid: pid, ns: ns}
end

test "uses secure SRV data", %{ns: ns} do
  url =
    @subject.avatar_url("foo@example.test",
      service_opts: [
        host: :libravatar,
        resolv_opts: [nameservers: [ns]]
      ]
    )

  assert url.host == "secure.example"
  assert url.port == 0xBEEF
end
</code></pre>
<p>Where I create stub of DNS server that will then resolve the requested query when asked. I haven’t changed the behaviour of existing module, I have changed who is answering the questions.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="388997" 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/how-do-i-write-elixir-tests/75335/34">Post #33</a>
	                </div>
	            </div>
              <div id="likers-container-388997" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="388997"
                     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 #33"></div>
  </section>
</div>
    <div class="postbit" id="388999" data-post-id="388999">
  <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 quote-modified" data-username="hauleth" data-post="34" data-topic="75335">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/48/18942_2.png" class="avatar"> hauleth:</div>
<blockquote>
<p>So for example you use mock like that […]</p>
</blockquote>
</aside>
<p>Eh. But one doesn’t use mock like that. The ‘<a href="https://dashbit.co/blog/mocks-and-explicit-contracts" rel="noopener nofollow ugc">consider “mock” to be a noun, never a verb</a>’ statement by José should have been carved in stone.</p>
<p>And one doesn’t mock <code>DateTime</code> because <code>DateTime</code> is not behavioural. Poor examples demonstrating that mocks can be abused wouldn’t prove that mocks are of no good. I mean, I could have written a library allowing mocking <code>def/2</code> and <code>defp/2</code> macros, but if you used it, you should not probably complain that mocks <em>in genertal</em> behave weird.</p>
<p>Proper mock is a stub, and once you use the proper mocks you might easily forget about the stub’s boilerplate at all.</p>
<p>[EDIT:] <code>Repatch</code> is a great tutorial of how to tweak Elixir macros, but it’s by no mean a proper mocking library. It simply guides you by hand to an abyss.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="388999" 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/how-do-i-write-elixir-tests/75335/35">Post #34</a>
	                </div>
	            </div>
              <div id="likers-container-388999" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="388999"
                     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 #34"></div>
  </section>
</div>
    <div class="postbit" id="389001" data-post-id="389001">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Asd" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Asd
                  </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="35" data-topic="75335">
<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>it’s by no mean a proper mocking library</p>
</blockquote>
</aside>
<p>It is one, it provides functionality of both Mox and Protomox, and a bunch of other features (like patching functions) too.</p>
<p>See <a href="https://hexdocs.pm/repatch/Repatch.Mock.html" class="inline-onebox" rel="noopener nofollow ugc">Repatch.Mock — Repatch v1.6.1</a> and <a href="https://hexdocs.pm/repatch/Repatch.Expectations.html" class="inline-onebox" rel="noopener nofollow ugc">Repatch.Expectations — Repatch v1.6.1</a> for more info. These two modules basically recreate what Mox does, but with better performance, better isolation and no hacks like patching <code>cover.erl</code> in runtime in order to make coverage work</p>
<aside class="quote no-group" data-username="mudasobwa" data-post="35" data-topic="75335">
<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>It simply guides you by hand to an abyss</p>
</blockquote>
</aside>
<p>I am not a developer who thinks that I have to guide my library users somewhere, I just create a best tool there is and then users are free to use it for the best or for the worst. It’s called “freedom”, you should try it sometime.</p>
<p>For example, I haven’t seen a tool which can isolate application env in different tests, but Repatch can and it just works.</p>
<hr>
<p>UPD, I will update the Repatch documentation with examples on how to use it in the style of Mox</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="389001" 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/how-do-i-write-elixir-tests/75335/36">Post #35</a>
	                </div>
	            </div>
              <div id="likers-container-389001" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="389001"
                     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 #35"></div>
  </section>
</div>
    <div class="postbit" id="389002" data-post-id="389002">
  <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="Asd" data-post="36" data-topic="75335">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/a/c68b51/48.png" class="avatar"> Asd:</div>
<blockquote>
<p>I will update the Repatch documentation with examples on how to use it in the style of Mox</p>
</blockquote>
</aside>
<p>I don’t think that’s really necessary.</p>
<p>Don’t get me wrong, I admire the work done on <code>Repatch</code>. It’s a piece of code, simultaneously elegant and complex. I love it.</p>
<p>I just cannot resist the feeling it’s everything but a mocking library. My coffee machine makes a perfect coffee. My vacuum cleaner sucks (disregard this sentence, I just needed to have complained to someone.) I frankly don’t need a coffee machine to be grinding the grains, I do it myself. Same goes to adding milk. Who ever drinks coffee with milk, huh?</p>
<p>That said, I want a mocking library that allows me to mock behaviorally declared injectable dependencies, period.</p>
<p>Maybe it’s just me, I dunno.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="389002" 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/how-do-i-write-elixir-tests/75335/37">Post #36</a>
	                </div>
	            </div>
              <div id="likers-container-389002" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="389002"
                     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 #36"></div>
  </section>
</div>
    <div class="postbit" id="389003" data-post-id="389003">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hauleth" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/120/18942_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hauleth
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </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="37" data-topic="75335">
<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>That said, I want a mocking library that allows me to mock behaviorally declared injectable dependencies, period.</p>
</blockquote>
</aside>
<p>The question is - do you need mocking library for that at all. Because that is what I also want and what I do. It just happen, that for this, I do not need any library at 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="389003" 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/how-do-i-write-elixir-tests/75335/38">Post #37</a>
	                </div>
	            </div>
              <div id="likers-container-389003" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="389003"
                     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 #37"></div>
  </section>
</div>
    <div class="postbit" id="389004" data-post-id="389004">
  <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>Sure I do.</p>
<p>Mocks are a perfect flow controller for interprocess communication. One might both totally prevent flakiness provoked by race conditions in tests <em>and</em> introduce a race condition to test it in particular.</p>
<p>Also, mocks might simulate whatever unexpected behaviour, from timeouts to spawning dozens of concurrent processes in between of request-response loop.</p>
<p>Mocks themselves are a very powerful mechanism to test the code under different circumstances. I have sophisticated mocks, as an opposite to stubs.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="389004" 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/how-do-i-write-elixir-tests/75335/39">Post #38</a>
	                </div>
	            </div>
              <div id="likers-container-389004" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="389004"
                     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 #38"></div>
  </section>
</div>
    <div class="postbit" id="389005" data-post-id="389005">
  <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>Here is how <a href="https://github.com/am-kantox/finitomata/blob/main/lib/finitomata/test/ex_unit.ex#L469-L478" rel="noopener nofollow ugc">I do test that FSM starts as expected</a> in <code>Finitomata</code> tests:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">mock
|&gt; allow(parent, fn -&gt; GenServer.whereis(fsm_name) end)
|&gt; expect(:after_transition, transition_count, fn id, state, payload -&gt;
  parent |&gt; send({:on_transition, id, state, payload}) |&gt; then(fn _ -&gt; :ok end)
end)

{:ok, _fsm_pid} = Finitomata.start_fsm(id, impl, name, payload)

assert_receive {:on_transition, ^fsm_name, ^entry_state, ^payload}, 1_000
</code></pre>
<p>My tests are fully based on mock (here I test that <code>after_transition</code> callback has ever been called.)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="389005" 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/how-do-i-write-elixir-tests/75335/40">Post #39</a>
	                </div>
	            </div>
              <div id="likers-container-389005" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="389005"
                     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 #39"></div>
  </section>
</div>
    <div class="postbit" id="389087" data-post-id="389087">
  <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">
								<p>I have the impression that many people encountered really bad mock usage early in their programming careers and ended up hating mocks because of that. That was my story too - I hated mocks so much that at one point I reduced them to zero.</p>
<p>Later, I had to learn how to use them properly so they wouldn’t hurt me. It’s not an easy art.</p>
<p>Mocks are just a tool, and like any other tool, they should be used for their intended purpose.<br>
When used correctly, they can be very helpful.</p>
<p>I think the same story applies to things like DI. For the record, I love DI &lt;3,  but like any other tool can be overused, and I’ve seen DI misused to the point where a function was passed through dozens of layers just to be used deep down the call stack, and usage&amp;refactoring that later was a nightmare (that was before AI <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">).<br>
But we don’t say that DI should be destroyed because of that.</p>
<p>That’s my few cents <img src="https://forum.elixirforum.com/images/emoji/apple/slightly_smiling_face.png?v=15" title=":slightly_smiling_face:" class="emoji" alt=":slightly_smiling_face:" 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="389087" 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/how-do-i-write-elixir-tests/75335/41">Post #40</a>
	                </div>
	            </div>
              <div id="likers-container-389087" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="389087"
                     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 #40"></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/75335/load_more?page=5">Load more posts (1 remaining)</a>
</div></template></turbo-stream>