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
Use `table` helper to create a temporary `ActiveRecord::Base` derived model
42
32
for a table.
43
33
44
-
Use `migrate!` helper to run the migration that is under test. It will not only
34
+
See `spec/support/helpers/migrations_helpers.rb` for all the available helpers.
35
+
36
+
## Testing a class that is an ActiveRecord::Migration
37
+
38
+
In order to test a class that is an `ActiveRecord::Migration`, you will need to
39
+
manually `require` the migration file because it is not autoloaded with Rails.
40
+
41
+
Use `migrate!` helper to run the migration that is under test. It will not only
45
42
run migration, but will also bump the schema version in the `schema_migrations`
46
43
table. It is necessary because in the `after` hook we trigger the rest of
47
44
the migrations, and we need to know where to start.
48
45
49
-
See `spec/support/migrations_helpers.rb` for all the available helpers.
46
+
### Example
50
47
51
-
## An example
48
+
This spec tests the [`db/post_migrate/20170526185842_migrate_pipeline_stages.rb`](https://gitlab.com/gitlab-org/gitlab-ce/blob/v11.6.5/db/post_migrate/20170526185842_migrate_pipeline_stages.rb) migration. You can find the complete spec on [`spec/migrations/migrate_pipeline_stages_spec.rb`](https://gitlab.com/gitlab-org/gitlab-ce/blob/v11.6.5/spec/migrations/migrate_pipeline_stages_spec.rb).
This spec tests the [`lib/gitlab/background_migration/archive_legacy_traces.rb`](https://gitlab.com/gitlab-org/gitlab-ce/blob/v11.6.5/lib/gitlab/background_migration/archive_legacy_traces.rb)
94
+
background migration. You can find the complete spec on
0 commit comments