PageRenderTime 48ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://github.com/bricooke/my-biz-expenses
Ruby | 41 lines | 27 code | 9 blank | 5 comment | 3 complexity | a7050bc53a4a5509bfc770a8f0f47950 MD5 | raw file
Possible License(s): CC-BY-SA-3.0, BSD-3-Clause
  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 'action_view'
  8. require 'active_record'
  9. require 'active_record/fixtures'
  10. require 'active_support/binding_of_caller'
  11. require 'active_support/breakpoint'
  12. require "#{File.dirname(__FILE__)}/../init"
  13. config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
  14. ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
  15. ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'sqlite3'])
  16. load(File.dirname(__FILE__) + "/schema.rb") if File.exist?(File.dirname(__FILE__) + "/schema.rb")
  17. Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/"
  18. $LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
  19. class Test::Unit::TestCase #:nodoc:
  20. def create_fixtures(*table_names)
  21. if block_given?
  22. Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) { yield }
  23. else
  24. Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names)
  25. end
  26. end
  27. # Turn off transactional fixtures if you're working with MyISAM tables in MySQL
  28. self.use_transactional_fixtures = true
  29. # Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david)
  30. self.use_instantiated_fixtures = false
  31. # Add more helper methods to be used by all tests here...
  32. end