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