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:
|
|
|
|
|
2016-03-02 11:34:40 -05:00
|
|
|
$ bundle exec ruby -Itest test/cases/base_test.rb -n method_name
|
2013-05-13 13:26:39 -04:00
|
|
|
|
|
|
|
To run a set of tests:
|
2004-11-23 20:04:44 -05:00
|
|
|
|
2016-03-02 11:34:40 -05:00
|
|
|
$ bundle exec 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
|
|
|
|
2015-01-15 17:25:28 -05: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
|
|
|
|
2014-12-21 11:13:54 -05:00
|
|
|
$ bundle exec rake test:mysql2
|
|
|
|
$ bundle exec rake test:postgresql
|
|
|
|
$ bundle exec rake test:sqlite3
|
2015-01-15 17:25:28 -05:00
|
|
|
|
|
|
|
Using the SQLite3 adapter with an in-memory database is the fastest way
|
|
|
|
to run the tests:
|
|
|
|
|
2014-12-21 11:13:54 -05: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:
|
|
|
|
|
2016-03-02 11:34:40 -05:00
|
|
|
$ ARCONN=postgresql bundle exec 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.
|