title: Database Testing in Rails
body: <p>I'm using Rails 4 and the testing framework with which it ships.</p>
  
  <p>I'm using a relational database that needs to be rigorously tested for internal consistency. In this case, it's a sports statistics database with player stats that are updated nightly.</p>
  
  <p>I need to run tests like the following when new data arrives each night: 
  <br>--That the sum of player stats equals the team's. 
  <br>--That the sum of team stats equals the league's. 
  <br>--That the sum of wins and losses equals games played. 
  <br>--etc.</p>
  
  <p>For now I'm copying my development database over to testing and running these alongside my unit tests in the <code>/test/models/</code> directory.</p>
  
  <p>This is an awkward set-up as my database testing code isn't comprised of unit tests in their proper sense, and it doesn't rely on fixtures as the Rails documentation suggests this folder be used for.</p>
  
  <p>My question is: In Rails, what is the best practice for database testing like that which I describe above?</p>