PageRenderTime 78ms CodeModel.GetById 30ms RepoModel.GetById 4ms app.codeStats 0ms

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

https://github.com/leskiger/lovd-by-less
Ruby | 31 lines | 25 code | 6 blank | 0 comment | 2 complexity | 447e15cbb478e99f179351619035b95d MD5 | raw file
Possible License(s): MIT
  1. ENV['RAILS_ENV'] = 'test'
  2. require File.expand_path(File.join(File.dirname(__FILE__), '../../../../config/environment.rb'))
  3. require 'test_help'
  4. require File.dirname(__FILE__) + '/../init'
  5. ActiveRecord::Base.class_eval do
  6. include SymetrieCom::Acts::NestedSet
  7. end
  8. config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
  9. ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/debug.log')
  10. cs = ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'mysql'])
  11. puts "Using #{cs.config[:adapter]} adapter"
  12. load(File.dirname(__FILE__) + '/schema.rb')
  13. Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + '/fixtures/'
  14. $LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
  15. class Test::Unit::TestCase #:nodoc:
  16. def create_fixtures(*table_names)
  17. if block_given?
  18. Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) { yield }
  19. else
  20. Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names)
  21. end
  22. end
  23. self.use_transactional_fixtures = true
  24. self.use_instantiated_fixtures = false
  25. end