mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Allow mysql and mysql2 tests run by database user with password
This commit is contained in:
parent
2a2473fd71
commit
329642325e
2 changed files with 5 additions and 5 deletions
|
@ -88,15 +88,15 @@ namespace :db do
|
|||
desc 'Build the MySQL test databases'
|
||||
task :build do
|
||||
config = ARTest.config['connections']['mysql']
|
||||
%x( mysql --user=#{config['arunit']['username']} -e "create DATABASE #{config['arunit']['database']} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci ")
|
||||
%x( mysql --user=#{config['arunit2']['username']} -e "create DATABASE #{config['arunit2']['database']} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci ")
|
||||
%x( mysql --user=#{config['arunit']['username']} --password=#{config['arunit']['password']} -e "create DATABASE #{config['arunit']['database']} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci ")
|
||||
%x( mysql --user=#{config['arunit2']['username']} --password=#{config['arunit2']['password']} -e "create DATABASE #{config['arunit2']['database']} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci ")
|
||||
end
|
||||
|
||||
desc 'Drop the MySQL test databases'
|
||||
task :drop do
|
||||
config = ARTest.config['connections']['mysql']
|
||||
%x( mysqladmin --user=#{config['arunit']['username']} -f drop #{config['arunit']['database']} )
|
||||
%x( mysqladmin --user=#{config['arunit2']['username']} -f drop #{config['arunit2']['database']} )
|
||||
%x( mysqladmin --user=#{config['arunit']['username']} --password=#{config['arunit']['password']} -f drop #{config['arunit']['database']} )
|
||||
%x( mysqladmin --user=#{config['arunit2']['username']} --password=#{config['arunit2']['password']} -f drop #{config['arunit2']['database']} )
|
||||
end
|
||||
|
||||
desc 'Rebuild the MySQL test databases'
|
||||
|
|
|
@ -26,7 +26,7 @@ class MysqlConnectionTest < ActiveRecord::MysqlTestCase
|
|||
run_without_connection do
|
||||
ar_config = ARTest.connection_config['arunit']
|
||||
|
||||
url = "mysql://#{ar_config["username"]}@localhost/#{ar_config["database"]}"
|
||||
url = "mysql://#{ar_config["username"]}:#{ar_config["password"]}@localhost/#{ar_config["database"]}"
|
||||
Klass.establish_connection(url)
|
||||
assert_equal ar_config['database'], Klass.connection.current_database
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue