Commit 7f659a4e authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'expand-migration-testing-docs' into 'master'

Provide extra detail on `table` in migration tests

See merge request gitlab-org/gitlab!48575
parents 7ec82fb1 00b43ef6
...@@ -75,8 +75,9 @@ require_migration!('populate_foo_column') ...@@ -75,8 +75,9 @@ require_migration!('populate_foo_column')
Use the `table` helper to create a temporary `ActiveRecord::Base`-derived model Use the `table` helper to create a temporary `ActiveRecord::Base`-derived model
for a table. [FactoryBot](best_practices.md#factories) for a table. [FactoryBot](best_practices.md#factories)
**should not** be used to create data for migration specs. For example, to **should not** be used to create data for migration specs because it relies on
create a record in the `projects` table: application code which can change after the migration has run, and cause the test
to fail. For example, to create a record in the `projects` table:
```ruby ```ruby
project = table(:projects).create!(id: 1, name: 'gitlab1', path: 'gitlab1') project = table(:projects).create!(id: 1, name: 'gitlab1', path: 'gitlab1')
......
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