/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
- ENV['RAILS_ENV'] = 'test'
- require File.expand_path(File.join(File.dirname(__FILE__), '../../../../config/environment.rb'))
- require 'test_help'
- require File.dirname(__FILE__) + '/../init'
- ActiveRecord::Base.class_eval do
- include SymetrieCom::Acts::NestedSet
- end
- config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
- ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/debug.log')
- cs = ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'mysql'])
- puts "Using #{cs.config[:adapter]} adapter"
- load(File.dirname(__FILE__) + '/schema.rb')
- Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + '/fixtures/'
- $LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
- class Test::Unit::TestCase #:nodoc:
- def create_fixtures(*table_names)
- if block_given?
- Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) { yield }
- else
- Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names)
- end
- end
- self.use_transactional_fixtures = true
- self.use_instantiated_fixtures = false
- end