Sha256: c7704930e460bae0bc3dc19490011ba73dda79485535b7a13bc2ce45ea45dc3f
Contents?: true
Size: 1.44 KB
Versions: 3
Compression:
Stored size: 1.44 KB
Contents
require 'test/unit' require 'rubygems' require 'active_record' require 'active_record/fixtures' config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml')) RAILS_DEFAULT_LOGGER = ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log") ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'sqlite3']) load(File.dirname(__FILE__) + "/schema.rb") if File.exist?(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 def self.load_all_fixtures all_fixtures = Dir.glob("#{File.dirname(__FILE__)}/fixtures/*.yml").collect do |f| puts "Loading fixture '#{f}'" File.basename(f).gsub(/\.yml$/, "").to_sym end Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, all_fixtures) end # Turn off transactional fixtures if you're working with MyISAM tables in MySQL self.use_transactional_fixtures = true # Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david) self.use_instantiated_fixtures = false # Add more helper methods to be used by all tests here... end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sprsquish-conditions_fu-0.2.0 | test/test_helper.rb |
sprsquish-conditions_fu-0.2.1 | test/test_helper.rb |
sprsquish-conditions_fu-0.3.0 | test/test_helper.rb |