3 plugin_test_dir = File.dirname(__FILE__)
5 # Load the Rails environment
6 require File.join(plugin_test_dir, '../../../../config/environment')
7 require 'active_record/fixtures'
8 databases = YAML::load(IO.read(plugin_test_dir + '/database.yml'))
9 ActiveRecord::Base.logger = Logger.new(plugin_test_dir + "/debug.log")
11 # A specific database can be used by setting the DB environment variable
12 ActiveRecord::Base.establish_connection(databases[ENV['DB'] || 'mysql'])
14 # Load the test schema into the database
15 load(File.join(plugin_test_dir, 'schema.rb'))
17 # Load fixtures from the plugin
18 Test::Unit::TestCase.fixture_path = File.join(plugin_test_dir, 'fixtures/')