PageRenderTime 58ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/plugins/dom_id/test/test_helper.rb

https://github.com/juarlex/inventory
Ruby | 38 lines | 24 code | 9 blank | 5 comment | 3 complexity | 640c89b3d8b1927fa88870657ff8b173 MD5 | raw file
  1. # Include this file in your test by copying the following line to your test:
  2. # require File.expand_path(File.dirname(__FILE__) + "/test_helper")
  3. $:.unshift(File.dirname(__FILE__) + '/../lib')
  4. RAILS_ROOT = File.dirname(__FILE__)
  5. require 'rubygems'
  6. require 'test/unit'
  7. require 'active_record'
  8. require 'active_record/fixtures'
  9. require "#{File.dirname(__FILE__)}/../init"
  10. config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
  11. ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
  12. ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'sqlite3'])
  13. load(File.dirname(__FILE__) + "/schema.rb") if File.exist?(File.dirname(__FILE__) + "/schema.rb")
  14. Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/"
  15. $LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
  16. class Test::Unit::TestCase #:nodoc:
  17. def create_fixtures(*table_names)
  18. if block_given?
  19. Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) { yield }
  20. else
  21. Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names)
  22. end
  23. end
  24. # Turn off transactional fixtures if you're working with MyISAM tables in MySQL
  25. self.use_transactional_fixtures = true
  26. # Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david)
  27. self.use_instantiated_fixtures = false
  28. # Add more helper methods to be used by all tests here...
  29. end