Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Hack to keep column metadata queries out of test query counts

  • Loading branch information...
commit 30f5f955448c67aaa6a92b7e1704aa837aa536f8 1 parent 5de3698
@jeremy jeremy authored
View
10 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)
Please sign in to comment.
Something went wrong with that request. Please try again.