You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/source/testing.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,7 +95,7 @@ A line by line examination of this file will help get you oriented to Rails test
95
95
require"test_helper"
96
96
```
97
97
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.
99
99
100
100
```ruby
101
101
classArticleTest < ActiveSupport::TestCase
@@ -548,7 +548,7 @@ process. The databases will be suffixed with the number corresponding to the wor
548
548
have 2 workers the tests will create `test-database-0` and `test-database-1` respectively.
549
549
550
550
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.
552
552
553
553
Two hooks are provided, one runs when the process is forked, and one runs before the forked process is closed.
554
554
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
578
578
If you prefer using threads or are using JRuby, a threaded parallelization option is provided. The threaded
579
579
parallelizer is backed by Minitest's `Parallel::Executor`.
580
580
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`:
582
582
583
583
```ruby
584
584
classActiveSupport::TestCase
@@ -738,7 +738,7 @@ Consider an `Article` model that has an associated image as a `thumbnail`
738
738
attachment, along with fixture data YAML:
739
739
740
740
```ruby
741
-
class Article
741
+
class Article < ApplicationRecord
742
742
has_one_attached :thumbnail
743
743
end
744
744
```
@@ -1167,7 +1167,7 @@ class BlogFlowTest < ActionDispatch::IntegrationTest
1167
1167
end
1168
1168
```
1169
1169
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.
1171
1171
1172
1172
When we visit our root path, we should see `welcome/index.html.erb` rendered for the view. So this assertion should pass.
1173
1173
@@ -2174,7 +2174,7 @@ end
2174
2174
2175
2175
### Testing that Exceptions are Raised
2176
2176
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.
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.
2204
2204
2205
2205
Connection tests aim to check whether a connection's identifiers get assigned properly
2206
2206
or that any improper connection requests are rejected. Here is an example:
0 commit comments