Skip to content

Latest commit

 

History

History
44 lines (28 loc) · 1.29 KB

RUNNING_UNIT_TESTS.rdoc

File metadata and controls

44 lines (28 loc) · 1.29 KB

Setup

If you don’t have an environment for running tests, read 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 bundle exec rake test 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. (the exact set of available tests is defined in Rakefile)

Config File

If test/config.yml is present, it’s parameters are obeyed. Otherwise, the parameters in test/config.example.yml are obeyed.

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.