title: Phoenix Framework: What's the correct way to seed database for testing?
body: <p>I am building my first Phoenix app and am trying to write a test that will verify that the user retrieved from a JWT in a connection's Authentication header is the correct user, is authenticated, etc.</p>
  
  <p>What is the correct way to seed the database with a single record for this test?</p>
  
  <p>Should it be done:</p>
  
  <ul>
  <li>globally, using the <code>test/test_helper.exs</code> file, by requiring <code>priv/repo/seeds.exs</code> and executing manual Ecto operations</li>
  </ul>
  
  <p><em>OR</em></p>
  
  <ul>
  <li>per test (in which case I am not certain how best to proceed)</li>
  </ul>
  
  <p><strong>Finally</strong>, what is the correct way to clean out the test database after successfully running my tests, so I can avoid trying to create the same record every time I run a test?</p>