PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/plugins/shoulda/test/test_helper.rb

https://github.com/technicalpickles/flockup
Ruby | 33 lines | 21 code | 8 blank | 4 comment | 1 complexity | 030247ea995884f184505b45555748e1 MD5 | raw file
Possible License(s): GPL-2.0
  1. require 'fileutils'
  2. # Load the environment
  3. ENV['RAILS_ENV'] = 'sqlite3'
  4. rails_root = File.dirname(__FILE__) + '/rails_root'
  5. require "#{rails_root}/config/environment.rb"
  6. # Load the testing framework
  7. require 'test_help'
  8. silence_warnings { RAILS_ENV = ENV['RAILS_ENV'] }
  9. # Run the migrations
  10. ActiveRecord::Migration.verbose = false
  11. ActiveRecord::Migrator.migrate("#{RAILS_ROOT}/db/migrate")
  12. # Setup the fixtures path
  13. Test::Unit::TestCase.fixture_path = File.join(File.dirname(__FILE__), "fixtures")
  14. class Test::Unit::TestCase #:nodoc:
  15. def create_fixtures(*table_names)
  16. if block_given?
  17. Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) { yield }
  18. else
  19. Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names)
  20. end
  21. end
  22. self.use_transactional_fixtures = false
  23. self.use_instantiated_fixtures = false
  24. end
  25. require 'test/fail_macros'