aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/join_model_test.rb
diff options
context:
space:
mode:
authorRaimonds Simanovskis <raimonds.simanovskis@gmail.com>2009-03-22 23:57:24 +0200
committerRaimonds Simanovskis <raimonds.simanovskis@gmail.com>2009-08-06 23:40:59 +0300
commit5666a3ad065469f12e5b3a4de0be823c9ae4ff7d (patch)
tree6ba9b619af7e860a50fcac66aa751f88eafa7d90 /activerecord/test/cases/associations/join_model_test.rb
parent963570b51ce4d95b046a441dd1c413dc6fcec8b4 (diff)
downloadrails-5666a3ad065469f12e5b3a4de0be823c9ae4ff7d.tar.gz
rails-5666a3ad065469f12e5b3a4de0be823c9ae4ff7d.tar.bz2
rails-5666a3ad065469f12e5b3a4de0be823c9ae4ff7d.zip
added :order option to find :first methods and associations as otherwise Oracle tests were failing
Oracle stores '' string as NULL Oracle cannot have identifiers larger than 30 characters added missing fixtures to test setup method
Diffstat (limited to 'activerecord/test/cases/associations/join_model_test.rb')
-rw-r--r--activerecord/test/cases/associations/join_model_test.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb
index b1060d01af..9da7fc2639 100644
--- a/activerecord/test/cases/associations/join_model_test.rb
+++ b/activerecord/test/cases/associations/join_model_test.rb
@@ -14,7 +14,9 @@ require 'models/citation'
class AssociationsJoinModelTest < ActiveRecord::TestCase
self.use_transactional_fixtures = false
- fixtures :posts, :authors, :categories, :categorizations, :comments, :tags, :taggings, :author_favorites, :vertices, :items, :books
+ fixtures :posts, :authors, :categories, :categorizations, :comments, :tags, :taggings, :author_favorites, :vertices, :items, :books,
+ # Reload edges table from fixtures as otherwise repeated test was failing
+ :edges
def test_has_many
assert authors(:david).categories.include?(categories(:general))
@@ -343,14 +345,16 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase
end
def test_has_many_polymorphic_with_source_type
- assert_equal posts(:welcome, :thinking), tags(:general).tagged_posts
+ # added sort by ID as otherwise Oracle select sometimes returned rows in different order
+ assert_equal posts(:welcome, :thinking).sort_by(&:id), tags(:general).tagged_posts.sort_by(&:id)
end
def test_eager_has_many_polymorphic_with_source_type
tag_with_include = Tag.find(tags(:general).id, :include => :tagged_posts)
desired = posts(:welcome, :thinking)
assert_no_queries do
- assert_equal desired, tag_with_include.tagged_posts
+ # added sort by ID as otherwise test using JRuby was failing as array elements were in different order
+ assert_equal desired.sort_by(&:id), tag_with_include.tagged_posts.sort_by(&:id)
end
assert_equal 5, tag_with_include.taggings.length
end