blob: 7f512e06fbcc3e789e95be36079ac6dda7f46345 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
If you don't have the environment set make sure to read
http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#testing-active-record.
== 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).
Create a mysql superuser named 'rails' that does not have a password.
You can build postgres and mysql databases using the postgresql:build_databases and mysql:build_databases rake tasks.
== Running the tests
You can run a particular test file from the command line, e.g.
$ ruby -Itest test/cases/base_test.rb
To run a specific test:
$ 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:
$ ARCONN=postgresql ruby -Itest test/cases/base_test.rb
You can run all the tests for a given database via rake:
$ rake test_mysql
The 'rake test' task will run all the tests for mysql, mysql2, sqlite3 and postgresql.
== Config file
By default, the config file is expected to be at the path test/config.yml. You can specify a
custom location with the ARCONFIG environment variable.
|