Chris@154: ENV["RAILS_ENV"] ||= "test" Chris@154: require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment") Chris@154: require 'test_help' Chris@154: Chris@154: class Test::Unit::TestCase Chris@154: # Transactional fixtures accelerate your tests by wrapping each test method Chris@154: # in a transaction that's rolled back on completion. This ensures that the Chris@154: # test database remains unchanged so your fixtures don't have to be reloaded Chris@154: # between every test method. Fewer database queries means faster tests. Chris@154: # Chris@154: # Read Mike Clark's excellent walkthrough at Chris@154: # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting Chris@154: # Chris@154: # Every Active Record database supports transactions except MyISAM tables Chris@154: # in MySQL. Turn off transactional fixtures in this case; however, if you Chris@154: # don't care one way or the other, switching from MyISAM to InnoDB tables Chris@154: # is recommended. Chris@154: # Chris@154: # The only drawback to using transactional fixtures is when you actually Chris@154: # need to test transactions. Since your test is bracketed by a transaction, Chris@154: # any transactions started in your code will be automatically rolled back. Chris@154: self.use_transactional_fixtures = true Chris@154: Chris@154: # Instantiated fixtures are slow, but give you @david where otherwise you Chris@154: # would need people(:david). If you don't want to migrate your existing Chris@154: # test cases which use the @david style and don't mind the speed hit (each Chris@154: # instantiated fixtures translates to a database query per test method), Chris@154: # then set this back to true. Chris@154: self.use_instantiated_fixtures = false Chris@154: Chris@154: # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. Chris@154: # Chris@154: # Note: You'll currently still have to declare fixtures explicitly in integration tests Chris@154: # -- they do not yet inherit this setting Chris@154: fixtures :all Chris@154: Chris@154: # Add more helper methods to be used by all tests here... Chris@154: end