PageRenderTime 47ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/plugins/betternestedset/test/abstract_unit.rb

https://bitbucket.org/Wgaffa/forum
Ruby | 25 lines | 21 code | 4 blank | 0 comment | 2 complexity | dc4f334224fda192ec226d29176889d8 MD5 | raw file
  1. ENV['RAILS_ENV'] = 'test'
  2. require File.expand_path(File.join(File.dirname(__FILE__), '../../../../config/environment.rb'))
  3. require 'test_help'
  4. config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
  5. ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/debug.log')
  6. cs = ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'mysql'])
  7. puts "Using #{cs.config[:adapter]} adapter"
  8. load(File.dirname(__FILE__) + '/schema.rb')
  9. Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + '/fixtures/'
  10. $LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
  11. class Test::Unit::TestCase #:nodoc:
  12. def create_fixtures(*table_names)
  13. if block_given?
  14. Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) { yield }
  15. else
  16. Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names)
  17. end
  18. end
  19. self.use_transactional_fixtures = true
  20. self.use_instantiated_fixtures = false
  21. end