mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use a git-ignored database.yml file for test DB configuration
This commit is contained in:
parent
3967bd524d
commit
8feaf2b8bd
3 changed files with 10 additions and 9 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
coverage/*
|
||||
config/database.yml
|
||||
*.DS_Store
|
||||
|
|
6
config/database.yml.example
Normal file
6
config/database.yml.example
Normal file
|
@ -0,0 +1,6 @@
|
|||
test:
|
||||
adapter: mysql
|
||||
username: root
|
||||
password: password
|
||||
encoding: utf8
|
||||
database: sql_algebra_test
|
|
@ -6,15 +6,9 @@ $LOAD_PATH.unshift "#{dir}/../lib"
|
|||
Dir["#{dir}/matchers/*"].each { |m| require "#{dir}/matchers/#{File.basename(m)}" }
|
||||
require 'active_relation'
|
||||
|
||||
ActiveRecord::Base.configurations = {
|
||||
'test' => {
|
||||
:adapter => 'mysql',
|
||||
:username => 'root',
|
||||
:password => 'password',
|
||||
:encoding => 'utf8',
|
||||
:database => 'sql_algebra_test',
|
||||
},
|
||||
}
|
||||
FileUtils.cp("#{dir}/../config/database.yml.example", "#{dir}/../config/database.yml") unless File.exist?("#{dir}/../config/database.yml")
|
||||
|
||||
ActiveRecord::Base.configurations = YAML::load(IO.read("#{dir}/../config/database.yml"))
|
||||
ActiveRecord::Base.establish_connection 'test'
|
||||
|
||||
class Hash
|
||||
|
|
Loading…
Reference in a new issue