Skip to content

Commit 396f55f

Browse files
committed
Fix mysql config.
1 parent 50b5b50 commit 396f55f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/activerecord_test.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
'mysql2' => {
1818
'adapter' => 'mysql2',
1919
'host' => '127.0.0.1',
20-
'username' => 'root',
21-
'password' => ENV['MYSQL_ROOT_PASSWORD'],
20+
'username' => 'sammy',
21+
'password' => 'password',
2222
'database' => 'enumerize_test',
2323
'encoding' => 'utf8mb4',
2424
'charset' => 'utf8mb4'
@@ -38,12 +38,18 @@
3838
'schema_search_path' => 'public'
3939
}
4040
}
41+
4142
case db
4243
when :postgresql
4344
ActiveRecord::Base.establish_connection(:postgresql_master)
4445
ActiveRecord::Base.connection.recreate_database('enumerize_test')
4546
when :mysql2
46-
ActiveRecord::Tasks::DatabaseTasks.create ActiveRecord::Base.configurations[db.to_s]
47+
if ActiveRecord::Base.configurations.respond_to?(:[])
48+
ActiveRecord::Tasks::DatabaseTasks.create ActiveRecord::Base.configurations[db.to_s]
49+
else
50+
ActiveRecord::Tasks::DatabaseTasks.create ActiveRecord::Base.configurations.find_db_config(db.to_s)
51+
end
52+
4753
ActiveRecord::Base.establish_connection(db)
4854
else
4955
ActiveRecord::Base.establish_connection(db)

0 commit comments

Comments
 (0)