2012-07-14 01:52:22 +08:00
|
|
|
== Setup
|
2004-11-24 09:04:44 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
If you don't have an environment for running tests, read
|
|
|
|
http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#setting-up-a-development-environment
|
2004-11-24 09:04:44 +08:00
|
|
|
|
2012-07-14 01:52:22 +08:00
|
|
|
== Running the Tests
|
2004-11-24 09:04:44 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
To run a specific test:
|
|
|
|
|
|
|
|
$ ruby -Itest test/cases/base_test.rb -n method_name
|
|
|
|
|
|
|
|
To run a set of tests:
|
2004-11-24 09:04:44 +08:00
|
|
|
|
2011-06-09 16:11:26 +08:00
|
|
|
$ ruby -Itest test/cases/base_test.rb
|
2004-11-24 09:04:44 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
You can also run tests that depend upon a specific database backend. For
|
|
|
|
example:
|
2004-11-24 09:04:44 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
$ bundle exec rake test_sqlite3
|
2004-11-24 09:04:44 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
Simply executing <tt>bundle exec rake test</tt> is equivalent to the following:
|
2010-08-14 13:13:00 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
$ bundle exec rake test_mysql
|
|
|
|
$ bundle exec rake test_mysql2
|
|
|
|
$ bundle exec rake test_postgresql
|
|
|
|
$ bundle exec rake test_sqlite3
|
2013-08-28 16:21:51 +08:00
|
|
|
$ bundle exec rake test_sqlite3_mem
|
2008-05-04 00:29:47 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
There should be tests available for each database backend listed in the {Config
|
|
|
|
File}[rdoc-label:label-Config+File]. (the exact set of available tests is
|
|
|
|
defined in +Rakefile+)
|
2006-07-05 10:54:19 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
== Config File
|
2006-07-05 10:54:19 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
If +test/config.yml+ is present, it's parameters are obeyed. Otherwise, the
|
|
|
|
parameters in +test/config.example.yml+ are obeyed.
|
2011-06-10 03:15:34 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
You can override the +connections:+ parameter in either file using the +ARCONN+
|
|
|
|
(Active Record CONNection) environment variable:
|
|
|
|
|
|
|
|
$ ARCONN=postgresql ruby -Itest test/cases/base_test.rb
|
2011-06-13 02:08:16 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
You can specify a custom location for the config file using the +ARCONFIG+
|
|
|
|
environment variable.
|