mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
f5489f9ab4
1. Specify that you need to create the test databases, and that no special Rails command needs to be run to do that. 2. Although the underscore style of `rake test_mysql` works, make the documentation of running the tests in RUNNING_UNIT_TESTS.rdoc consistent with the "Contributing..." guide. 3. Promote "Testing Active Record" to not be a subsection of "Running a Single Test," since it doesn't make sense as a subsection of that.
44 lines
1.3 KiB
Text
44 lines
1.3 KiB
Text
== Setup
|
|
|
|
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
|
|
|
|
== Running the Tests
|
|
|
|
To run a specific test:
|
|
|
|
$ ruby -Itest test/cases/base_test.rb -n method_name
|
|
|
|
To run a set of tests:
|
|
|
|
$ ruby -Itest test/cases/base_test.rb
|
|
|
|
You can also run tests that depend upon a specific database backend. For
|
|
example:
|
|
|
|
$ bundle exec rake test_sqlite3
|
|
|
|
Simply executing <tt>bundle exec rake test</tt> is equivalent to the following:
|
|
|
|
$ bundle exec rake test:mysql
|
|
$ bundle exec rake test:mysql2
|
|
$ bundle exec rake test:postgresql
|
|
$ bundle exec rake test:sqlite3
|
|
$ bundle exec rake test:sqlite3_mem
|
|
|
|
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+)
|
|
|
|
== Config File
|
|
|
|
If +test/config.yml+ is present, then its parameters are obeyed; otherwise, the
|
|
parameters in +test/config.example.yml+ are.
|
|
|
|
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
|
|
|
|
You can specify a custom location for the config file using the +ARCONFIG+
|
|
environment variable.
|