diff options
author | Robin Dupret <robin.dupret@gmail.com> | 2015-08-25 16:11:34 +0200 |
---|---|---|
committer | Robin Dupret <robin.dupret@gmail.com> | 2015-08-25 16:13:34 +0200 |
commit | f150decfe2d7374fe5b511cbd0e85ea5bebfb3d7 (patch) | |
tree | 649427658b0432134b6d354e39811e52e69205c0 /guides/source | |
parent | a70e6f1cb3108d7644ea87ecfa1e914b6bd1eee8 (diff) | |
download | rails-f150decfe2d7374fe5b511cbd0e85ea5bebfb3d7.tar.gz rails-f150decfe2d7374fe5b511cbd0e85ea5bebfb3d7.tar.bz2 rails-f150decfe2d7374fe5b511cbd0e85ea5bebfb3d7.zip |
A quick pass over the testing guide
* Fixtures are loaded for all the tests by default (not only model and
controller tests).
* Fix a few typos and improve the markup at some levels.
* Wrap changes to 80 chars
[ci skip]
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/testing.md | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/guides/source/testing.md b/guides/source/testing.md index 3a691220cf..1cc49a36d2 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -50,7 +50,7 @@ By default, every Rails application has three environments: development, test, a Each environment's configuration can be modified similarly. In this case, we can modify our test environment by changing the options found in `config/environments/test.rb`. -NOTE: Your test are run under RAILS_ENV=test. +NOTE: Your tests are run under `RAILS_ENV=test`. ### Rails meets Minitest @@ -336,7 +336,8 @@ All the basic assertions such as `assert_equal` defined in `Minitest::Assertions Each of these classes include `Minitest::Assertions`, allowing us to use all of the basic assertions in our tests. -NOTE: For more information on `Minitest`, refer to [Minitest](http://docs.seattlerb.org/minitest) +NOTE: For more information on `Minitest`, refer to [its +documentation](http://docs.seattlerb.org/minitest). ### The Rails Test Runner @@ -355,7 +356,8 @@ Finished tests in 0.009262s, 107.9680 tests/s, 107.9680 assertions/s. This will run all test methods from the test case. -You can also run a particular test method from the test case by providing the `-n` or `--name` flag and the `test method name`. +You can also run a particular test method from the test case by providing the +`-n` or `--name` flag and the test's method name. ```bash $ bin/rails test test/models/article_test.rb -n test_the_truth @@ -469,7 +471,8 @@ user_<%= n %>: #### Fixtures in Action -Rails by default automatically loads all fixtures from the `test/fixtures` directory for your models and controllers test. Loading involves three steps: +Rails automatically loads all fixtures from the `test/fixtures` directory by +default. Loading involves three steps: 1. Remove any existing data from the table corresponding to the fixture 2. Load the fixture data into the table @@ -505,7 +508,8 @@ Model Testing Model tests are used to test the various models of your application. -For creating Rails model tests, we use the 'test/model' directory for your application. Rails provides a generator to create an model test skeleton for you. +Rails model tests are stored under the `test/models` directory. Rails provides +a generator to create a model test skeleton for you. ```bash $ bin/rails generate test_unit:model article title:string body:text @@ -563,7 +567,8 @@ We'll start by generating our integration test skeleton: $ bin/rails generate integration_test blog_flow ``` -It should have created a test file placeholder for us, with the output of the previous command you should see: +It should have created a test file placeholder for us. With the output of the +previous command you should see: ```bash invoke test_unit |