To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / .svn / pristine / 38 / 3811122058c03a62723dc5f9b7f68e09577985b6.svn-base @ 1298:4f746d8966dd
History | View | Annotate | Download (1.67 KB)
| 1 |
$:.unshift(File.dirname(__FILE__) + '/../../../rails/activesupport/lib') |
|---|---|
| 2 |
$:.unshift(File.dirname(__FILE__) + '/../../../rails/activerecord/lib') |
| 3 |
$:.unshift(File.dirname(__FILE__) + '/../lib') |
| 4 |
require 'test/unit' |
| 5 |
begin |
| 6 |
require 'active_support' |
| 7 |
require 'active_record' |
| 8 |
require 'active_record/fixtures' |
| 9 |
rescue LoadError |
| 10 |
require 'rubygems' |
| 11 |
retry |
| 12 |
end |
| 13 |
require 'acts_as_versioned' |
| 14 |
|
| 15 |
config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml')) |
| 16 |
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log") |
| 17 |
ActiveRecord::Base.configurations = {'test' => config[ENV['DB'] || 'sqlite3']}
|
| 18 |
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test']) |
| 19 |
|
| 20 |
load(File.dirname(__FILE__) + "/schema.rb") |
| 21 |
|
| 22 |
# set up custom sequence on widget_versions for DBs that support sequences |
| 23 |
if ENV['DB'] == 'postgresql' |
| 24 |
ActiveRecord::Base.connection.execute "DROP SEQUENCE widgets_seq;" rescue nil |
| 25 |
ActiveRecord::Base.connection.remove_column :widget_versions, :id |
| 26 |
ActiveRecord::Base.connection.execute "CREATE SEQUENCE widgets_seq START 101;" |
| 27 |
ActiveRecord::Base.connection.execute "ALTER TABLE widget_versions ADD COLUMN id INTEGER PRIMARY KEY DEFAULT nextval('widgets_seq');"
|
| 28 |
end |
| 29 |
|
| 30 |
Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/" |
| 31 |
$:.unshift(Test::Unit::TestCase.fixture_path) |
| 32 |
|
| 33 |
class Test::Unit::TestCase #:nodoc: |
| 34 |
# Turn off transactional fixtures if you're working with MyISAM tables in MySQL |
| 35 |
self.use_transactional_fixtures = true |
| 36 |
|
| 37 |
# Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david) |
| 38 |
self.use_instantiated_fixtures = false |
| 39 |
|
| 40 |
# Add more helper methods to be used by all tests here... |
| 41 |
end |