File: RUNNING_UNIT_TESTS.rdoc

package info (click to toggle)
rails 2%3A4.2.7.1-1%2Bdeb9u2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,416 kB
  • sloc: ruby: 186,673; yacc: 45; sql: 43; sh: 14; makefile: 12
file content (44 lines) | stat: -rw-r--r-- 1,322 bytes parent folder | download
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
38
39
40
41
42
43
44
== 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.