fixed i guess
[has_many_polymorphs.git] / test / test_helper.rb
blob887bd86d03ebcfb6661a966068bbb55957f5e83f
2 $VERBOSE = nil
3 require 'rubygems'
4 require 'echoe'
5 require 'test/unit'
6 require 'multi_rails_init'
7 require 'ruby-debug'
9 if defined? ENV['MULTIRAILS_RAILS_VERSION']
10   ENV['RAILS_GEM_VERSION'] = ENV['MULTIRAILS_RAILS_VERSION']
11 end
13 Echoe.silence do
14   HERE = File.expand_path(File.dirname(__FILE__))
15   $LOAD_PATH << HERE
16   # $LOAD_PATH << "#{HERE}/integration/app"
17 end
19 LOG = "#{HERE}/integration/app/log/development.log"     
21 ### For unit tests
23 require 'integration/app/config/environment'
24 require 'test_help'
26 Inflector.inflections {|i| i.irregular 'fish', 'fish' }
28 $LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path = HERE + "/fixtures")
29 $LOAD_PATH.unshift(HERE + "/models")
30 $LOAD_PATH.unshift(HERE + "/modules")
32 class Test::Unit::TestCase
33   self.use_transactional_fixtures = !(ActiveRecord::Base.connection.is_a? ActiveRecord::ConnectionAdapters::MysqlAdapter rescue false)
34   self.use_instantiated_fixtures  = false
35 end
37 Echoe.silence do
38   load(HERE + "/schema.rb")
39 end
41 ### For integration tests
43 def truncate
44   system("> #{LOG}")
45 end
47 def log
48   File.open(LOG, 'r') do |f|
49     f.read
50   end
51 end