Skip to content

Commit 332e08d

Browse files
Minor improvements to Testing guide (rails#51418)
[ci skip]
2 parents e9b6185 + 4c3e5d2 commit 332e08d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

guides/source/testing.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ A line by line examination of this file will help get you oriented to Rails test
9595
require "test_helper"
9696
```
9797

98-
By requiring this file, `test_helper.rb` the default configuration to run our tests is loaded. We will include this with all the tests we write, so any methods added to this file are available to all our tests.
98+
By requiring this file, `test_helper.rb`, the default configuration to run our tests is loaded. We will include this with all the tests we write, so any methods added to this file are available to all our tests.
9999

100100
```ruby
101101
class ArticleTest < ActiveSupport::TestCase
@@ -548,7 +548,7 @@ process. The databases will be suffixed with the number corresponding to the wor
548548
have 2 workers the tests will create `test-database-0` and `test-database-1` respectively.
549549

550550
If the number of workers passed is 1 or fewer the processes will not be forked and the tests will not
551-
be parallelized and the tests will use the original `test-database` database.
551+
be parallelized and they will use the original `test-database` database.
552552

553553
Two hooks are provided, one runs when the process is forked, and one runs before the forked process is closed.
554554
These can be useful if your app uses multiple databases or performs other tasks that depend on the number of
@@ -578,7 +578,7 @@ These methods are not needed or available when using parallel testing with threa
578578
If you prefer using threads or are using JRuby, a threaded parallelization option is provided. The threaded
579579
parallelizer is backed by Minitest's `Parallel::Executor`.
580580

581-
To change the parallelization method to use threads over forks put the following in your `test_helper.rb`
581+
To change the parallelization method to use threads over forks put the following in your `test_helper.rb`:
582582

583583
```ruby
584584
class ActiveSupport::TestCase
@@ -738,7 +738,7 @@ Consider an `Article` model that has an associated image as a `thumbnail`
738738
attachment, along with fixture data YAML:
739739

740740
```ruby
741-
class Article
741+
class Article < ApplicationRecord
742742
has_one_attached :thumbnail
743743
end
744744
```
@@ -1167,7 +1167,7 @@ class BlogFlowTest < ActionDispatch::IntegrationTest
11671167
end
11681168
```
11691169

1170-
We will take a look at `assert_select` to query the resulting HTML of a request in the "Testing Views" section below. It is used for testing the response of our request by asserting the presence of key HTML elements and their content.
1170+
We will take a look at `assert_select` to query the resulting HTML of a request in the [Testing Views](#testing-views) section below. It is used for testing the response of our request by asserting the presence of key HTML elements and their content.
11711171

11721172
When we visit our root path, we should see `welcome/index.html.erb` rendered for the view. So this assertion should pass.
11731173

@@ -2174,7 +2174,7 @@ end
21742174

21752175
### Testing that Exceptions are Raised
21762176

2177-
Testing that your job raises an exception in certain cases can be tricky, especially when you have retries configured. The `perform_enqueued_jobs` helper fails any test where a job raises an exception, so to have the test succeed when the exception is raised you have call the job's `perform` method directly.
2177+
Testing that your job raises an exception in certain cases can be tricky, especially when you have retries configured. The `perform_enqueued_jobs` helper fails any test where a job raises an exception, so to have the test succeed when the exception is raised you have to call the job's `perform` method directly.
21782178

21792179
```ruby
21802180
require "test_helper"
@@ -2200,7 +2200,7 @@ entities broadcast correct messages.
22002200

22012201
### Connection Test Case
22022202

2203-
By default, when you generate new Rails application with Action Cable, a test for the base connection class (`ApplicationCable::Connection`) is generated as well under `test/channels/application_cable` directory.
2203+
By default, when you generate a new Rails application with Action Cable, a test for the base connection class (`ApplicationCable::Connection`) is generated as well under `test/channels/application_cable` directory.
22042204

22052205
Connection tests aim to check whether a connection's identifiers get assigned properly
22062206
or that any improper connection requests are rejected. Here is an example:

0 commit comments

Comments
 (0)