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
* feat: add fixtures_path
* test: add test for fixtures_path
* docs: expand test docs with fixtures_path
* test: add new test instead of co-opting and old one.
* feat: add explicit path operating mode for fixtures parameters and allow combining multiple fixtures parameters
* fix: require .sql extension for explicit path fixtures
* feat: add custom relative path style to fixtures argument
* fix: missing cfg feature
* docs: update
* fix: explicit fixtures styling checks for paths. Remove strict sql extension requirement for explicit path, they still need an extension. Add .sql extension to implicit fixtures style only if missing.
* style: cargo fmt
* docs: update documentation
Copy file name to clipboardexpand all lines: src/macros/test.md
+12-2
Original file line number
Diff line number
Diff line change
@@ -185,7 +185,13 @@ similarly to migrations but are solely intended to insert test data and be arbit
185
185
Imagine a basic social app that has users, posts and comments. To test the comment routes, you'd want
186
186
the database to already have users and posts in it so the comments tests don't have to duplicate that work.
187
187
188
-
You can pass a list of fixture names to the attribute like so, and they will be applied in the given order<sup>3</sup>:
188
+
You can either pass a list of fixture to the attribute `fixtures` in three different operating modes:
189
+
190
+
1) Pass a list of references files in `./fixtures` (resolved as `./fixtures/{name}.sql`, `.sql` added only if extension is missing);
191
+
2) Pass a list of file paths (including associated extension), in which case they can either be absolute, or relative to the current file;
192
+
3) Pass a `path = <path to folder>` parameter and a `scripts(<filename_1>, <filename_2>, ...)` parameter that are relative to the provided path (resolved as `{path}/{filename_x}.sql`, `.sql` added only if extension is missing).
193
+
194
+
In any case they will be applied in the given order<sup>3</sup>:
0 commit comments