rails--rails/activerecord/RUNNING_UNIT_TESTS

28 lines
863 B
Plaintext
Raw Normal View History

== Configure databases
Copy test/config.example.yml to test/config.yml and edit as needed. Or just run the tests for
the first time, which will do the copy automatically and use the default (sqlite3).
You can build postgres and mysql databases using the build_postgresql and build_mysql rake tasks.
== Running the tests
You can run a particular test file from the command line, e.g.
2011-06-09 08:11:26 +00:00
$ ruby -Itest test/cases/base_test.rb
To run a specific test:
2011-06-09 08:11:26 +00:00
$ ruby -Itest test/cases/base_test.rb -n test_something_works
You can run with a database other than the default you set in test/config.yml, using the ARCONN
environment variable:
2011-06-09 08:11:26 +00:00
$ ARCONN=postgresql ruby -Itest test/cases/base_test.rb
You can run all the tests for a given database via rake:
2011-06-09 08:11:26 +00:00
$ rake test_mysql
2011-06-09 08:11:26 +00:00
The 'rake test' task will run all the tests for mysql, mysql2, sqlite3 and postgresql.