annotate vendor/plugins/embedded/test/test_helper.rb @ 1477:f2ad2199b49a bibplugin_integration

Close obsolete branch bibplugin_integration
author Chris Cannam
date Fri, 30 Nov 2012 14:41:31 +0000
parents 317821dd92c9
children
rev   line source
Chris@154 1 ENV["RAILS_ENV"] ||= "test"
Chris@154 2 require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment")
Chris@154 3 require 'test_help'
Chris@154 4
Chris@154 5 class Test::Unit::TestCase
Chris@154 6 # Transactional fixtures accelerate your tests by wrapping each test method
Chris@154 7 # in a transaction that's rolled back on completion. This ensures that the
Chris@154 8 # test database remains unchanged so your fixtures don't have to be reloaded
Chris@154 9 # between every test method. Fewer database queries means faster tests.
Chris@154 10 #
Chris@154 11 # Read Mike Clark's excellent walkthrough at
Chris@154 12 # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
Chris@154 13 #
Chris@154 14 # Every Active Record database supports transactions except MyISAM tables
Chris@154 15 # in MySQL. Turn off transactional fixtures in this case; however, if you
Chris@154 16 # don't care one way or the other, switching from MyISAM to InnoDB tables
Chris@154 17 # is recommended.
Chris@154 18 #
Chris@154 19 # The only drawback to using transactional fixtures is when you actually
Chris@154 20 # need to test transactions. Since your test is bracketed by a transaction,
Chris@154 21 # any transactions started in your code will be automatically rolled back.
Chris@154 22 self.use_transactional_fixtures = true
Chris@154 23
Chris@154 24 # Instantiated fixtures are slow, but give you @david where otherwise you
Chris@154 25 # would need people(:david). If you don't want to migrate your existing
Chris@154 26 # test cases which use the @david style and don't mind the speed hit (each
Chris@154 27 # instantiated fixtures translates to a database query per test method),
Chris@154 28 # then set this back to true.
Chris@154 29 self.use_instantiated_fixtures = false
Chris@154 30
Chris@154 31 # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
Chris@154 32 #
Chris@154 33 # Note: You'll currently still have to declare fixtures explicitly in integration tests
Chris@154 34 # -- they do not yet inherit this setting
Chris@154 35 fixtures :all
Chris@154 36
Chris@154 37 # Add more helper methods to be used by all tests here...
Chris@154 38 end