Commit c3aa4235 authored by Rémy Coutable's avatar Rémy Coutable

Document that 'schema: :latest' is added to background migration specs

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 56eaec7b
......@@ -301,12 +301,13 @@ It is required to write tests for:
- The background migration itself.
- A cleanup migration.
You can use the `:migration` RSpec tag when testing the migrations.
The `:migration` and `schema: :latest` RSpec tags are automatically set for
background migration specs.
See the
[Testing Rails migrations](testing_guide/testing_migrations_guide.md#testing-a-non-activerecordmigration-class)
style guide.
When you do that, keep in mind that `before` and `after` RSpec hooks are going
Keep in mind that `before` and `after` RSpec hooks are going
to migrate you database down and up, which can result in other background
migrations being called. That means that using `spy` test doubles with
`have_received` is encouraged, instead of using regular test doubles, because
......
......@@ -158,7 +158,9 @@ end
To test a non-`ActiveRecord::Migration` test (a background migration),
you will need to manually provide a required schema version. Please add a
schema tag to a context that you want to switch the database schema within.
`schema` tag to a context that you want to switch the database schema within.
If not set, `schema` defaults to `:latest`.
Example:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment