From 70840d4b7fcd16c45b7be69c51b0bd1d27c7cbff Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 1 Nov 2006 20:28:48 +0000 Subject: Oracle: resolve test failures, use prefetched primary key for inserts, check for null defaults. Factor out some common methods from all adapters. Closes #6515. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5384 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/associations/eager_test.rb | 7 ++++--- activerecord/test/associations_test.rb | 6 +++--- activerecord/test/fixtures/db_definitions/schema.rb | 2 +- activerecord/test/locking_test.rb | 1 + 4 files changed, 9 insertions(+), 7 deletions(-) (limited to 'activerecord/test') diff --git a/activerecord/test/associations/eager_test.rb b/activerecord/test/associations/eager_test.rb index 909083fd28..e8e14c2c50 100644 --- a/activerecord/test/associations/eager_test.rb +++ b/activerecord/test/associations/eager_test.rb @@ -121,10 +121,11 @@ class EagerAssociationTest < Test::Unit::TestCase author = Author.find(:first, :include => :special_nonexistant_post_comments, :order => 'authors.id') assert_equal [], author.special_nonexistant_post_comments end - + def test_eager_with_has_many_through_join_model_with_conditions - assert_equal Author.find(:first, :include => :hello_post_comments).hello_post_comments, - Author.find(:first).hello_post_comments + assert_equal Author.find(:first, :include => :hello_post_comments, + :order => 'authors.id').hello_post_comments.sort_by(&:id), + Author.find(:first, :order => 'authors.id').hello_post_comments.sort_by(&:id) end def test_eager_with_has_many_and_limit diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb index d033ef087a..0be63fccbf 100755 --- a/activerecord/test/associations_test.rb +++ b/activerecord/test/associations_test.rb @@ -1782,7 +1782,7 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase assert_equal projects(:active_record), developer.projects[0] assert_equal projects(:action_controller), developer.projects[1] end - + def test_select_limited_ids_list # Set timestamps Developer.transaction do @@ -1790,10 +1790,10 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase record.update_attributes(:created_at => 5.years.ago + (i * 5.minutes)) end end - + join_base = ActiveRecord::Associations::ClassMethods::JoinDependency::JoinBase.new(Project) join_dep = ActiveRecord::Associations::ClassMethods::JoinDependency.new(join_base, :developers, nil) projects = Project.send(:select_limited_ids_list, {:order => 'developers.created_at'}, join_dep) - assert_equal "'1', '2'", projects + assert_equal %w(1 2), projects.scan(/\d/).sort end end diff --git a/activerecord/test/fixtures/db_definitions/schema.rb b/activerecord/test/fixtures/db_definitions/schema.rb index 6f4aca971e..9c851817ec 100644 --- a/activerecord/test/fixtures/db_definitions/schema.rb +++ b/activerecord/test/fixtures/db_definitions/schema.rb @@ -54,7 +54,7 @@ ActiveRecord::Schema.define do t.column :lock_version, :integer end - create_table :lock_with_custom_column_without_defaults, :force => true do |t| + create_table :lock_without_defaults_cust, :force => true do |t| t.column :custom_lock_version, :integer end end diff --git a/activerecord/test/locking_test.rb b/activerecord/test/locking_test.rb index 80f0dc8496..b5bec031e2 100644 --- a/activerecord/test/locking_test.rb +++ b/activerecord/test/locking_test.rb @@ -5,6 +5,7 @@ require 'fixtures/legacy_thing' class LockWithoutDefault < ActiveRecord::Base; end class LockWithCustomColumnWithoutDefault < ActiveRecord::Base + set_table_name :lock_without_defaults_cust set_locking_column :custom_lock_version end -- cgit v1.2.3