2012-07-13 13:52:22 -04:00
|
|
|
== Setup
|
2004-11-23 20:04:44 -05:00
|
|
|
|
2013-05-13 13:26:39 -04: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-23 20:04:44 -05:00
|
|
|
|
2012-07-13 13:52:22 -04:00
|
|
|
== Running the Tests
|
2004-11-23 20:04:44 -05:00
|
|
|
|
2013-05-13 13:26:39 -04:00
|
|
|
To run a specific test:
|
|
|
|
|
|
|
|
$ ruby -Itest test/cases/base_test.rb -n method_name
|
|
|
|
|
|
|
|
To run a set of tests:
|
2004-11-23 20:04:44 -05:00
|
|
|
|
2011-06-09 04:11:26 -04:00
|
|
|
$ ruby -Itest test/cases/base_test.rb
|
2004-11-23 20:04:44 -05:00
|
|
|
|
2013-05-13 13:26:39 -04:00
|
|
|
You can also run tests that depend upon a specific database backend. For
|
|
|
|
example:
|
2004-11-23 20:04:44 -05:00
|
|
|
|
2013-05-13 13:26:39 -04:00
|
|
|
$ bundle exec rake test_sqlite3
|
2004-11-23 20:04:44 -05:00
|
|
|
|
2013-05-13 13:26:39 -04:00
|
|
|
Simply executing <tt>bundle exec rake test</tt> is equivalent to the following:
|
2010-08-14 01:13:00 -04:00
|
|
|
|
2013-05-13 13:26:39 -04:00
|
|
|
$ bundle exec rake test_mysql
|
|
|
|
$ bundle exec rake test_mysql2
|
|
|
|
$ bundle exec rake test_postgresql
|
|
|
|
$ bundle exec rake test_sqlite3
|
2013-08-28 04:21:51 -04:00
|
|
|
$ bundle exec rake test_sqlite3_mem
|
2008-05-03 12:29:47 -04:00
|
|
|
|
2013-05-13 13:26:39 -04: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-04 22:54:19 -04:00
|
|
|
|
2013-05-13 13:26:39 -04:00
|
|
|
== Config File
|
2006-07-04 22:54:19 -04:00
|
|
|
|
2014-08-22 03:45:25 -04:00
|
|
|
If +test/config.yml+ is present, then its parameters are obeyed; otherwise, the
|
|
|
|
parameters in +test/config.example.yml+ are.
|
2011-06-09 15:15:34 -04:00
|
|
|
|
2013-05-13 13:26:39 -04: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-12 14:08:16 -04:00
|
|
|
|
2013-05-13 13:26:39 -04:00
|
|
|
You can specify a custom location for the config file using the +ARCONFIG+
|
|
|
|
environment variable.
|