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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="gophertroll" data-post="12" data-topic="26249">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/a9adbd/48.png" class="avatar"> gophertroll:</div>
<blockquote>
<p>No, I didn’t see that. However, that solution seems to produce test run times very similar to those I achieved with the behaviour approach, and, as you pointed out, it has the advantage of not requiring any additional code.</p>
</blockquote>
</aside>
<p>For anyone stumbling upon this topic: for a project, I’ve been using <code>argon2_elixir</code> as a <code>bcrypt</code> alternative. For that library, there are also test-specific settings that really speed up the test suite. Documentation here:</p>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://argon2-elixir.hexdocs.pm/Argon2.Stats.html">
  <header class="source">

      <a href="https://argon2-elixir.hexdocs.pm/Argon2.Stats.html" target="_blank" rel="noopener nofollow ugc">argon2-elixir.hexdocs.pm</a>
  </header>

  <article class="onebox-body">
    

<h3><a href="https://argon2-elixir.hexdocs.pm/Argon2.Stats.html" target="_blank" rel="noopener nofollow ugc">Argon2.Stats — argon2_elixir v4.1.3</a></h3>



  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>
 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="148313" 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/tdd-in-elixir-with-tests-that-hit-the-database/26249/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-148313" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="148313"
                     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="165668" data-post-id="165668">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/lostkobrakai" rel="nofollow">@LostKobrakai</a> thank you so much for the hint about bcrypt!! I got 14x better test time just because of that.</p>
<p>If you’re using a mock user for example, put the password hash as a module attribute<br>
In my case, I use exMachnia and every time a user is generated, this line was called (in the <code>Factory</code>)</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">Bcrypt.hash_pwd_salt("password123$")
</code></pre>
<p>What I just did is add this value as a module attribute (since it’s constant anyways)</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule MyApp.Factory do
# ...
@password_hash Bcrypt.hash_pwd_salt("password123$")
# ...
</code></pre>
<p>and then just use the <code>@password_hash</code> whenever the factory makes a user.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="165668" 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/tdd-in-elixir-with-tests-that-hit-the-database/26249/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-165668" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="165668"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>