aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/adapter_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/adapter_test.rb')
-rw-r--r--activerecord/test/adapter_test.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/activerecord/test/adapter_test.rb b/activerecord/test/adapter_test.rb
index 2c98045cee..af94904eee 100644
--- a/activerecord/test/adapter_test.rb
+++ b/activerecord/test/adapter_test.rb
@@ -47,16 +47,18 @@ class AdapterTest < Test::Unit::TestCase
end
def test_table_alias
- old = @connection.table_alias_length
- def @connection.table_alias_length() 10; end
+ def @connection.test_table_alias_length() 10; end
+ class << @connection
+ alias_method :old_table_alias_length, :table_alias_length
+ alias_method :table_alias_length, :test_table_alias_length
+ end
assert_equal 'posts', @connection.table_alias_for('posts')
- assert_equal 'posts', @connection.table_alias_for('posts', 1)
- assert_equal 'posts_2', @connection.table_alias_for('posts', 2)
assert_equal 'posts_comm', @connection.table_alias_for('posts_comments')
- assert_equal 'posts_co_2', @connection.table_alias_for('posts_comments', 2)
- def @connection.table_alias_length() old; end
+ class << @connection
+ alias_method :table_alias_length, :old_table_alias_length
+ end
end
# test resetting sequences in odd tables in postgreSQL