Skip to content

Commit

Permalink
test for eager load of has_one association with condition on the thro…
Browse files Browse the repository at this point in the history
…ugh table
  • Loading branch information
Pivotal Labs authored and tenderlove committed Dec 15, 2010
1 parent 5d78b4c commit 6df88f0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion activerecord/test/cases/associations/eager_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit 6df88f0

Please sign in to comment.