Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c3aa4235
Commit
c3aa4235
authored
Mar 12, 2020
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document that 'schema: :latest' is added to background migration specs
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
56eaec7b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
doc/development/background_migrations.md
doc/development/background_migrations.md
+3
-2
doc/development/testing_guide/testing_migrations_guide.md
doc/development/testing_guide/testing_migrations_guide.md
+3
-1
No files found.
doc/development/background_migrations.md
View file @
c3aa4235
...
@@ -301,12 +301,13 @@ It is required to write tests for:
...
@@ -301,12 +301,13 @@ It is required to write tests for:
-
The background migration itself.
-
The background migration itself.
-
A cleanup migration.
-
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
See the
[
Testing Rails migrations
](
testing_guide/testing_migrations_guide.md#testing-a-non-activerecordmigration-class
)
[
Testing Rails migrations
](
testing_guide/testing_migrations_guide.md#testing-a-non-activerecordmigration-class
)
style guide.
style guide.
When you do that, k
eep in mind that
`before`
and
`after`
RSpec hooks are going
K
eep in mind that
`before`
and
`after`
RSpec hooks are going
to migrate you database down and up, which can result in other background
to migrate you database down and up, which can result in other background
migrations being called. That means that using
`spy`
test doubles with
migrations being called. That means that using
`spy`
test doubles with
`have_received`
is encouraged, instead of using regular test doubles, because
`have_received`
is encouraged, instead of using regular test doubles, because
...
...
doc/development/testing_guide/testing_migrations_guide.md
View file @
c3aa4235
...
@@ -158,7 +158,9 @@ end
...
@@ -158,7 +158,9 @@ end
To test a non-
`ActiveRecord::Migration`
test (a background migration),
To test a non-
`ActiveRecord::Migration`
test (a background migration),
you will need to manually provide a required schema version. Please add a
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:
Example:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment