Permalink
Browse files

Hack to keep column metadata queries out of test query counts

  • Loading branch information...
1 parent 5de3698 commit 30f5f955448c67aaa6a92b7e1704aa837aa536f8 @jeremy jeremy committed Mar 15, 2010
Showing with 7 additions and 3 deletions.
  1. +7 −3 activerecord/test/cases/associations/has_many_through_associations_test.rb
@@ -18,10 +18,14 @@
class HasManyThroughAssociationsTest < ActiveRecord::TestCase
fixtures :posts, :readers, :people, :comments, :authors, :owners, :pets, :toys, :jobs, :references, :companies
- def test_associate_existing
- assert_queries(2) { posts(:thinking);people(:david) }
+ # Dummies to force column loads so query counts are clean.
+ def setup
+ Person.create :first_name => 'gummy'
+ Reader.create :person_id => 0, :post_id => 0
+ end
- posts(:thinking).people
+ def test_associate_existing
+ assert_queries(2) { posts(:thinking); people(:david) }
assert_queries(1) do
posts(:thinking).people << people(:david)

0 comments on commit 30f5f95

Please sign in to comment.