From 8b5f4e474f30560da85f52dd64dc3b45d0338b93 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 22 Dec 2007 11:26:03 +0000 Subject: Ruby 1.9 compat: fix warnings, shadowed block vars, and unitialized instance vars git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8481 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/active_schema_test_mysql.rb | 7 +++++-- activerecord/test/adapter_test.rb | 1 + activerecord/test/associations/callbacks_test.rb | 2 +- activerecord/test/associations/join_model_test.rb | 6 +++--- 4 files changed, 10 insertions(+), 6 deletions(-) (limited to 'activerecord/test') diff --git a/activerecord/test/active_schema_test_mysql.rb b/activerecord/test/active_schema_test_mysql.rb index 673c86c7ce..f00dfd7902 100644 --- a/activerecord/test/active_schema_test_mysql.rb +++ b/activerecord/test/active_schema_test_mysql.rb @@ -3,13 +3,16 @@ require 'abstract_unit' class ActiveSchemaTest < Test::Unit::TestCase def setup ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do - alias_method :real_execute, :execute + alias_method :execute_without_stub, :execute def execute(sql, name = nil) return sql end end end def teardown - ActiveRecord::ConnectionAdapters::MysqlAdapter.send(:alias_method, :execute, :real_execute) + ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do + remove_method :execute + alias_method :execute, :execute_without_stub + end end def test_drop_table diff --git a/activerecord/test/adapter_test.rb b/activerecord/test/adapter_test.rb index 84af72bfa5..4247bf8618 100644 --- a/activerecord/test/adapter_test.rb +++ b/activerecord/test/adapter_test.rb @@ -76,6 +76,7 @@ class AdapterTest < Test::Unit::TestCase assert_equal 'dbo_posts', @connection.table_alias_for('dbo.posts') class << @connection + remove_method :table_alias_length alias_method :table_alias_length, :old_table_alias_length end end diff --git a/activerecord/test/associations/callbacks_test.rb b/activerecord/test/associations/callbacks_test.rb index 4b6b7f4123..6df8718e28 100644 --- a/activerecord/test/associations/callbacks_test.rb +++ b/activerecord/test/associations/callbacks_test.rb @@ -128,7 +128,7 @@ class AssociationCallbacksTest < Test::Unit::TestCase callback_log = ["before_adding", "after_adding"] assert_equal callback_log, project.developers_log assert project.save - assert_equal 1, project.developers_with_callbacks.count + assert_equal 1, project.developers_with_callbacks.size assert_equal callback_log, project.developers_log end diff --git a/activerecord/test/associations/join_model_test.rb b/activerecord/test/associations/join_model_test.rb index aaef40ebf1..b970d054c4 100644 --- a/activerecord/test/associations/join_model_test.rb +++ b/activerecord/test/associations/join_model_test.rb @@ -304,7 +304,7 @@ class AssociationsJoinModelTest < Test::Unit::TestCase end def test_unavailable_through_reflection - assert_raises (ActiveRecord::HasManyThroughAssociationNotFoundError) { authors(:david).nothings } + assert_raise(ActiveRecord::HasManyThroughAssociationNotFoundError) { authors(:david).nothings } end def test_has_many_through_join_model_with_conditions @@ -313,10 +313,10 @@ class AssociationsJoinModelTest < Test::Unit::TestCase end def test_has_many_polymorphic - assert_raises ActiveRecord::HasManyThroughAssociationPolymorphicError do + assert_raise ActiveRecord::HasManyThroughAssociationPolymorphicError do assert_equal posts(:welcome, :thinking), tags(:general).taggables end - assert_raises ActiveRecord::EagerLoadPolymorphicError do + assert_raise ActiveRecord::EagerLoadPolymorphicError do assert_equal posts(:welcome, :thinking), tags(:general).taggings.find(:all, :include => :taggable) end end -- cgit v1.2.3