diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-06-22 17:36:20 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-06-22 17:36:20 +0000 |
commit | dae61089982d079d4ea57ad83340bf5cbdd83d3a (patch) | |
tree | 5ed20da186cb983ddceabce1718e95f8191be383 /activerecord/test/associations | |
parent | 989332c734149a7f350a0dd7d483c820552c0267 (diff) | |
download | rails-dae61089982d079d4ea57ad83340bf5cbdd83d3a.tar.gz rails-dae61089982d079d4ea57ad83340bf5cbdd83d3a.tar.bz2 rails-dae61089982d079d4ea57ad83340bf5cbdd83d3a.zip |
Update tests' use of fixtures for the new collections api. Closes #8726.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7081 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations')
-rw-r--r-- | activerecord/test/associations/cascaded_eager_loading_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/associations/eager_test.rb | 8 | ||||
-rw-r--r-- | activerecord/test/associations/join_model_test.rb | 12 |
3 files changed, 12 insertions, 12 deletions
diff --git a/activerecord/test/associations/cascaded_eager_loading_test.rb b/activerecord/test/associations/cascaded_eager_loading_test.rb index 863af199ce..78b9861d54 100644 --- a/activerecord/test/associations/cascaded_eager_loading_test.rb +++ b/activerecord/test/associations/cascaded_eager_loading_test.rb @@ -55,7 +55,7 @@ class CascadedEagerLoadingTest < Test::Unit::TestCase def test_eager_association_loading_with_acts_as_tree roots = TreeMixin.find(:all, :include=>"children", :conditions=>"mixins.parent_id IS NULL", :order=>"mixins.id") - assert_equal [mixins(:tree_1), mixins(:tree2_1), mixins(:tree3_1)], roots + assert_equal mixins(:tree_1, :tree2_1, :tree3_1), roots assert_no_queries do assert_equal 2, roots[0].children.size assert_equal 0, roots[1].children.size @@ -73,7 +73,7 @@ class CascadedEagerLoadingTest < Test::Unit::TestCase def test_eager_association_loading_with_has_many_sti topics = Topic.find(:all, :include => :replies, :order => 'topics.id') - assert_equal [topics(:first), topics(:second)], topics + assert_equal topics(:first, :second), topics assert_no_queries do assert_equal 1, topics[0].replies.size assert_equal 0, topics[1].replies.size diff --git a/activerecord/test/associations/eager_test.rb b/activerecord/test/associations/eager_test.rb index 0d69af1c10..d48821ce0a 100644 --- a/activerecord/test/associations/eager_test.rb +++ b/activerecord/test/associations/eager_test.rb @@ -292,13 +292,13 @@ class EagerAssociationTest < Test::Unit::TestCase end def test_limited_eager_with_order - assert_equal [posts(:thinking), posts(:sti_comments)], Post.find(:all, :include => [:author, :comments], :conditions => "authors.name = 'David'", :order => 'UPPER(posts.title)', :limit => 2, :offset => 1) - assert_equal [posts(:sti_post_and_comments), posts(:sti_comments)], Post.find(:all, :include => [:author, :comments], :conditions => "authors.name = 'David'", :order => 'UPPER(posts.title) DESC', :limit => 2, :offset => 1) + assert_equal posts(:thinking, :sti_comments), Post.find(:all, :include => [:author, :comments], :conditions => "authors.name = 'David'", :order => 'UPPER(posts.title)', :limit => 2, :offset => 1) + assert_equal posts(:sti_post_and_comments, :sti_comments), Post.find(:all, :include => [:author, :comments], :conditions => "authors.name = 'David'", :order => 'UPPER(posts.title) DESC', :limit => 2, :offset => 1) end def test_limited_eager_with_multiple_order_columns - assert_equal [posts(:thinking), posts(:sti_comments)], Post.find(:all, :include => [:author, :comments], :conditions => "authors.name = 'David'", :order => 'UPPER(posts.title), posts.id', :limit => 2, :offset => 1) - assert_equal [posts(:sti_post_and_comments), posts(:sti_comments)], Post.find(:all, :include => [:author, :comments], :conditions => "authors.name = 'David'", :order => 'UPPER(posts.title) DESC, posts.id', :limit => 2, :offset => 1) + assert_equal posts(:thinking, :sti_comments), Post.find(:all, :include => [:author, :comments], :conditions => "authors.name = 'David'", :order => 'UPPER(posts.title), posts.id', :limit => 2, :offset => 1) + assert_equal posts(:sti_post_and_comments, :sti_comments), Post.find(:all, :include => [:author, :comments], :conditions => "authors.name = 'David'", :order => 'UPPER(posts.title) DESC, posts.id', :limit => 2, :offset => 1) end def test_eager_with_multiple_associations_with_same_table_has_many_and_habtm diff --git a/activerecord/test/associations/join_model_test.rb b/activerecord/test/associations/join_model_test.rb index a5e525c670..84078e6fff 100644 --- a/activerecord/test/associations/join_model_test.rb +++ b/activerecord/test/associations/join_model_test.rb @@ -294,20 +294,20 @@ class AssociationsJoinModelTest < Test::Unit::TestCase def test_has_many_polymorphic assert_raises ActiveRecord::HasManyThroughAssociationPolymorphicError do - assert_equal [posts(:welcome), posts(:thinking)], tags(:general).taggables + assert_equal posts(:welcome, :thinking), tags(:general).taggables end assert_raises ActiveRecord::EagerLoadPolymorphicError do - assert_equal [posts(:welcome), posts(:thinking)], tags(:general).taggings.find(:all, :include => :taggable) + assert_equal posts(:welcome, :thinking), tags(:general).taggings.find(:all, :include => :taggable) end end def test_has_many_polymorphic_with_source_type - assert_equal [posts(:welcome), posts(:thinking)], tags(:general).tagged_posts + assert_equal posts(:welcome, :thinking), tags(:general).tagged_posts end def test_eager_has_many_polymorphic_with_source_type tag_with_include = Tag.find(tags(:general).id, :include => :tagged_posts) - desired = [posts(:welcome), posts(:thinking)] + desired = posts(:welcome, :thinking) assert_no_queries do assert_equal desired, tag_with_include.tagged_posts end @@ -339,12 +339,12 @@ class AssociationsJoinModelTest < Test::Unit::TestCase end def test_has_many_through_polymorphic_has_many - assert_equal [taggings(:welcome_general), taggings(:thinking_general)], authors(:david).taggings.uniq.sort_by { |t| t.id } + assert_equal taggings(:welcome_general, :thinking_general), authors(:david).taggings.uniq.sort_by { |t| t.id } end def test_include_has_many_through_polymorphic_has_many author = Author.find_by_id(authors(:david).id, :include => :taggings) - expected_taggings = [taggings(:welcome_general), taggings(:thinking_general)] + expected_taggings = taggings(:welcome_general, :thinking_general) assert_no_queries do assert_equal expected_taggings, author.taggings.uniq.sort_by { |t| t.id } end |