diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-08-17 11:59:00 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-08-17 11:59:00 +0200 |
commit | d1cfa79dfc6c3bcec289d6951e08fd19ae155bdf (patch) | |
tree | 3ae9faf684a195000b1f91a92cf8f5994eb403b7 /spec/migrations | |
parent | 1066d8ba77ba242851c906aa523bd7548dad1d15 (diff) | |
parent | 56d24bcf80c7b6e93e298adb8214f4b2e97d094b (diff) | |
download | gitlab-ce-d1cfa79dfc6c3bcec289d6951e08fd19ae155bdf.tar.gz |
Merge branch 'backstage/gb/migrations-tests-schema-version' into backstage/gb/migrate-stages-statuses
* backstage/gb/migrations-tests-schema-version:
Migrate down before each migration unit test
Disable db_cleaner tables caching in migrations tests
Extend migrations testing documentation
Make it possible to provide schema version in tests
Migrate db schema for context in :migration specs
Diffstat (limited to 'spec/migrations')
-rw-r--r-- | spec/migrations/README.md | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/migrations/README.md b/spec/migrations/README.md index 05d4f35db72..45cf25b96de 100644 --- a/spec/migrations/README.md +++ b/spec/migrations/README.md @@ -28,6 +28,14 @@ The `after` hook will migrate the database **up** and reinstitutes the latest schema version, so that the process does not affect subsequent specs and ensures proper isolation. +## Testing a class that is not an ActiveRecord::Migration + +In order to test a class that is not a migration itself, 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. + +Example: `describe SomeClass, :migration, schema: 20170608152748`. + ## Available helpers Use `table` helper to create a temporary `ActiveRecord::Base` derived model @@ -80,8 +88,6 @@ end ## Best practices -1. Use only one test example per migration unless there is a good reason to -use more. 1. Note that this type of tests do not run within the transaction, we use a truncation database cleanup strategy. Do not depend on transaction being present. |