2012-07-13 17:52:22 +00:00
|
|
|
== Setup
|
2004-11-24 01:04:44 +00:00
|
|
|
|
2012-07-13 17:52:22 +00:00
|
|
|
If you don't have the environment set make sure to read
|
2012-07-13 17:24:48 +00:00
|
|
|
|
2012-07-13 17:52:22 +00:00
|
|
|
http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#testing-active-record.
|
2004-11-24 01:04:44 +00:00
|
|
|
|
2012-07-13 17:52:22 +00:00
|
|
|
== Running the Tests
|
2004-11-24 01:04:44 +00:00
|
|
|
|
2011-06-04 22:19:17 +00:00
|
|
|
You can run a particular test file from the command line, e.g.
|
2004-11-24 01:04:44 +00:00
|
|
|
|
2011-06-09 08:11:26 +00:00
|
|
|
$ ruby -Itest test/cases/base_test.rb
|
2004-11-24 01:04:44 +00:00
|
|
|
|
2011-06-04 22:19:17 +00:00
|
|
|
To run a specific test:
|
2004-11-24 01:04:44 +00:00
|
|
|
|
2011-06-09 08:11:26 +00:00
|
|
|
$ ruby -Itest test/cases/base_test.rb -n test_something_works
|
2004-11-24 01:04:44 +00:00
|
|
|
|
2011-06-04 22:19:17 +00:00
|
|
|
You can run with a database other than the default you set in test/config.yml, using the ARCONN
|
|
|
|
environment variable:
|
2010-08-14 05:13:00 +00:00
|
|
|
|
2011-06-09 08:11:26 +00:00
|
|
|
$ ARCONN=postgresql ruby -Itest test/cases/base_test.rb
|
2008-05-03 16:29:47 +00:00
|
|
|
|
2011-06-04 22:19:17 +00:00
|
|
|
You can run all the tests for a given database via rake:
|
2006-07-05 02:54:19 +00:00
|
|
|
|
2011-06-09 08:11:26 +00:00
|
|
|
$ rake test_mysql
|
2006-07-05 02:54:19 +00:00
|
|
|
|
2011-06-09 08:11:26 +00:00
|
|
|
The 'rake test' task will run all the tests for mysql, mysql2, sqlite3 and postgresql.
|
2011-06-09 19:15:34 +00:00
|
|
|
|
2012-07-13 17:52:22 +00:00
|
|
|
== Custom Config file
|
2011-06-12 18:08:16 +00:00
|
|
|
|
|
|
|
By default, the config file is expected to be at the path test/config.yml. You can specify a
|
|
|
|
custom location with the ARCONFIG environment variable.
|