]> git.openstreetmap.org Git - rails.git/blob - vendor/plugins/validates_email_format_of/test/test_helper.rb
5d200787442d8ec723199364a9339aeb3c33b6c8
[rails.git] / vendor / plugins / validates_email_format_of / test / test_helper.rb
1 $:.unshift(File.dirname(__FILE__) + '/../lib')
2 RAILS_ROOT = File.dirname(__FILE__)
3
4 require 'rubygems'
5 require 'test/unit'
6 require 'active_record'
7 require 'active_record/fixtures'
8 require "#{File.dirname(__FILE__)}/../init"
9
10
11 config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
12 ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
13 ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'plugin_test'])
14
15 load(File.dirname(__FILE__) + "/schema.rb") if File.exist?(File.dirname(__FILE__) + "/schema.rb")
16
17 if ActiveSupport.const_defined?(:TestCase)
18   ActiveSupport::TestCase.send(:include, ActiveRecord::TestFixtures)
19   TEST_CASE = ActiveSupport::TestCase
20 else
21   TEST_CASE = Test::Unit::TestCase
22 end
23
24 TEST_CASE.fixture_path = File.dirname(__FILE__) + "/fixtures/"
25 $LOAD_PATH.unshift(TEST_CASE.fixture_path)
26
27 class TEST_CASE #:nodoc:
28   def create_fixtures(*table_names)
29     if block_given?
30       Fixtures.create_fixtures(TEST_CASE.fixture_path, table_names) { yield }
31     else
32       Fixtures.create_fixtures(TEST_CASE.fixture_path, table_names)
33     end
34   end
35
36   self.use_transactional_fixtures = false
37   
38   self.use_instantiated_fixtures  = false
39 end
40