Skip to content

Commit

Permalink
Fix AR tests due to Mysql constant not being defined
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosantoniodasilva committed Jan 12, 2013
1 parent 2549a3b commit 6581d79
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
10 changes: 5 additions & 5 deletions activerecord/lib/active_record/tasks/mysql_database_tasks.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -128,7 +129,6 @@ def prepare_command_options(command)
end
args
end

end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module ActiveRecord
module Tasks # :nodoc:
class PostgreSQLDatabaseTasks # :nodoc:

DEFAULT_ENCODING = ENV['CHARSET'] || 'utf8'

delegate :connection, :establish_connection, :clear_active_connections!,
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 6581d79

Please sign in to comment.