test/test_helper.rb in mass_insert-0.2.2 vs test/test_helper.rb in mass_insert-0.2.3

- old
+ new

@@ -15,11 +15,21 @@ FileUtils.mkdir_p('tmp') FileUtils.mkdir_p('log') ActiveRecord::Base.logger = Logger.new('log/test.log') ActiveRecord::Base.logger.level = Logger::DEBUG -ActiveRecord::Base.configurations['test'] = YAML.load_file(File.dirname(__FILE__) + '/database.yml')[adapter] + +database_configuration = YAML.load_file(File.dirname(__FILE__) + '/database.yml')[adapter] +ActiveRecord::Base.configurations['test'] = database_configuration ActiveRecord::Base.establish_connection(:test) + +begin + ActiveRecord::Base.connection +rescue + # Ensures database exists. + ActiveRecord::Tasks::DatabaseTasks.database_configuration = database_configuration + ActiveRecord::Tasks::DatabaseTasks.create_current('test') +end require File.dirname(__FILE__) + '/schema.rb' Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each{ |file| require file } Dir[File.dirname(__FILE__) + "/models/**/*.rb"].each{ |file| require file }