Skip to content
Browse files

Fix AR tests due to Mysql constant not being defined

  • Loading branch information...
1 parent 2549a3b commit 6581d798e830a7820dd54fe95d40014c0e2057fe @carlosantoniodasilva carlosantoniodasilva committed Jan 12, 2013
View
10 activerecord/lib/active_record/tasks/mysql_database_tasks.rb
@@ -1,7 +1,6 @@
module ActiveRecord
module Tasks # :nodoc:
class MySQLDatabaseTasks # :nodoc:
-
DEFAULT_CHARSET = ENV['CHARSET'] || 'utf8'
DEFAULT_COLLATION = ENV['COLLATION'] || 'utf8_unicode_ci'
ACCESS_DENIED_ERROR = 1045
@@ -24,7 +23,7 @@ def create
connection.create_database configuration['database'], creation_options
connection.execute grant_statement.gsub(/\s+/, ' ').strip
establish_connection configuration
- rescue error_class, ActiveRecord::StatementInvalid => error
+ rescue ActiveRecord::StatementInvalid, error_class => error
if /database exists/ === error.message
raise DatabaseAlreadyExists
else
@@ -93,8 +92,10 @@ def error_class
if configuration['adapter'] =~ /jdbc/
require 'active_record/railties/jdbcmysql_error'
ArJdbcMySQL::Error
- else
- defined?(Mysql2) ? Mysql2::Error : Mysql::Error
+ elsif defined?(Mysql2)
+ Mysql2::Error
+ elsif defined?(Mysql)
+ Mysql::Error
end
end
@@ -128,7 +129,6 @@ def prepare_command_options(command)
end
args
end
-
end
end
end
View
1 activerecord/lib/active_record/tasks/postgresql_database_tasks.rb
@@ -3,7 +3,6 @@
module ActiveRecord
module Tasks # :nodoc:
class PostgreSQLDatabaseTasks # :nodoc:
-
DEFAULT_ENCODING = ENV['CHARSET'] || 'utf8'
delegate :connection, :establish_connection, :clear_active_connections!,
View
1 activerecord/lib/active_record/tasks/sqlite_database_tasks.rb
@@ -1,7 +1,6 @@
module ActiveRecord
module Tasks # :nodoc:
class SQLiteDatabaseTasks # :nodoc:
-
delegate :connection, :establish_connection, to: ActiveRecord::Base
def initialize(configuration, root = Rails.root)

0 comments on commit 6581d79

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