annotate .svn/pristine/6a/6a042b60ae039f1f3e97486dd768e4cda28fdc3f.svn-base @ 1519:afce8026aaeb redmine-2.4-integration

Merge from branch "live"
author Chris Cannam
date Tue, 09 Sep 2014 09:34:53 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 == Creating the test database
Chris@909 2
Chris@909 3 The default name for the test databases is "activerecord_versioned". If you
Chris@909 4 want to use another database name then be sure to update the connection
Chris@909 5 adapter setups you want to test with in test/connections/<your database>/connection.rb.
Chris@909 6 When you have the database online, you can import the fixture tables with
Chris@909 7 the test/fixtures/db_definitions/*.sql files.
Chris@909 8
Chris@909 9 Make sure that you create database objects with the same user that you specified in i
Chris@909 10 connection.rb otherwise (on Postgres, at least) tests for default values will fail.
Chris@909 11
Chris@909 12 == Running with Rake
Chris@909 13
Chris@909 14 The easiest way to run the unit tests is through Rake. The default task runs
Chris@909 15 the entire test suite for all the adapters. You can also run the suite on just
Chris@909 16 one adapter by using the tasks test_mysql_ruby, test_ruby_mysql, test_sqlite,
Chris@909 17 or test_postresql. For more information, checkout the full array of rake tasks with "rake -T"
Chris@909 18
Chris@909 19 Rake can be found at http://rake.rubyforge.org
Chris@909 20
Chris@909 21 == Running by hand
Chris@909 22
Chris@909 23 Unit tests are located in test directory. If you only want to run a single test suite,
Chris@909 24 or don't want to bother with Rake, you can do so with something like:
Chris@909 25
Chris@909 26 cd test; ruby -I "connections/native_mysql" base_test.rb
Chris@909 27
Chris@909 28 That'll run the base suite using the MySQL-Ruby adapter. Change the adapter
Chris@909 29 and test suite name as needed.
Chris@909 30
Chris@909 31 == Faster tests
Chris@909 32
Chris@909 33 If you are using a database that supports transactions, you can set the
Chris@909 34 "AR_TX_FIXTURES" environment variable to "yes" to use transactional fixtures.
Chris@909 35 This gives a very large speed boost. With rake:
Chris@909 36
Chris@909 37 rake AR_TX_FIXTURES=yes
Chris@909 38
Chris@909 39 Or, by hand:
Chris@909 40
Chris@909 41 AR_TX_FIXTURES=yes ruby -I connections/native_sqlite3 base_test.rb