Skip to content
Browse files

Avoid PostgreSQL and MySQL tests warnings.

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent 03be270 commit 4b4a548a60236ccfb68c91f53386459bcb1751ab @miloops miloops committed with josevalim Jun 8, 2010
View
8 activerecord/test/cases/active_schema_test_mysql.rb
@@ -4,6 +4,7 @@ class ActiveSchemaTest < ActiveRecord::TestCase
def setup
ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do
alias_method :execute_without_stub, :execute
+ remove_method :execute
def execute(sql, name = nil) return sql end
end
end
@@ -66,7 +67,7 @@ def test_drop_table_with_specific_database
assert_equal "DROP TABLE `otherdb`.`people`", drop_table('otherdb.people')
end
- def test_add_timestamps
+ def test_add_timestamps
with_real_execute do
begin
ActiveRecord::Base.connection.create_table :delete_me do |t|
@@ -79,8 +80,8 @@ def test_add_timestamps
end
end
end
-
- def test_remove_timestamps
+
+ def test_remove_timestamps
with_real_execute do
begin
ActiveRecord::Base.connection.create_table :delete_me do |t|
@@ -106,6 +107,7 @@ def with_real_execute
ensure
#before finishing, we restore the alias to the mock-up method
ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do
+ remove_method :execute
alias_method :execute, :execute_with_stub
end
end
View
1 activerecord/test/cases/active_schema_test_postgresql.rb
@@ -4,6 +4,7 @@ class PostgresqlActiveSchemaTest < Test::Unit::TestCase
def setup
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do
alias_method :real_execute, :execute
+ remove_method :execute
def execute(sql, name = nil) sql end
end
end

0 comments on commit 4b4a548

Please sign in to comment.
Something went wrong with that request. Please try again.