Permalink
Browse files

test for eager load of has_one association with condition on the thro…

…ugh table
  • Loading branch information...
1 parent 4cd3302 commit 15984dbe35651e64dcff69f8e48fca156c380df2 Pivotal Labs committed with vijaydev Jan 9, 2009
Showing with 9 additions and 1 deletion.
  1. +9 −1 activerecord/test/cases/associations/eager_test.rb
@@ -17,18 +17,26 @@
require 'models/book'
require 'models/developer'
require 'models/project'
+require 'models/member'
+require 'models/membership'
+require 'models/club'
class EagerAssociationTest < ActiveRecord::TestCase
fixtures :posts, :comments, :authors, :author_addresses, :categories, :categories_posts,
:companies, :accounts, :tags, :taggings, :people, :readers,
:owners, :pets, :author_favorites, :jobs, :references, :subscribers, :subscriptions, :books,
- :developers, :projects, :developers_projects
+ :developers, :projects, :developers_projects, :members, :memberships, :clubs
def setup
# preheat table existence caches
Comment.find_by_id(1)
end
+ def test_eager_with_has_one_through_join_model_with_conditions_on_the_through
+ member = Member.find(members(:some_other_guy).id, :include => :favourite_club)
+ assert_nil member.favourite_club
+ end
+
def test_loading_with_one_association
posts = Post.find(:all, :include => :comments)
post = posts.find { |p| p.id == 1 }

0 comments on commit 15984db

Please sign in to comment.