title: Rack::Test resulting in ActiveRecord::AssociationTypeMismatch
body: <p>I have a problem when running all of my specs.</p>
  
  <pre>
      ActiveRecord::AssociationTypeMismatch:
         Affiliate(#2154746360) expected, got Affiliate(#2199508660)
  </pre>
  
  <p>It would appear that my models are being loaded twice.</p>
  
  <p>I have isolated the problem to be introduced with Rack::Test's requirement to define an "app" method.</p>
  
  <pre><code>require 'rack/test'
  include Rack::Test::Methods
  
  # app method is needed for rack-test
  def app
    Rails.application
  end
  </code></pre>
  
  <p>If I comment out <code>Rails.application</code> my rack specs do not work, but all of my other specs work fine.  The use of <code>Rails.application</code> in the "app" method introduces the error above.</p>
  
  <p>If I run my specs individually, everything works.  I am preloading my environment with Spork and I think that the models are loaded first by Spork and then they are redefined when <code>Rails.application</code> is called in my "app" method.</p>
  
  <p>Any ideas on how I can resolve this problem?  I am not sure if there is another way to set my Rails app in the "app" method.</p>