##drop -> create -> 接続まで
require "active_record"
config = {
:adapter => "mysql2",
:encoding => "utf8",
:reconnect => true,
:pool => 5,
:database => "__test__"
}
ActiveRecord::Base.establish_connection(config.merge(:database => "mysql"))
ActiveRecord::Base.connection.drop_database config[:database] rescue nil
ActiveRecord::Base.connection.create_database config[:database]
ActiveRecord::Base.establish_connection(config)