Commit d85cfead authored by Amy Qualls's avatar Amy Qualls

Merge branch 'pl-doc-let-it-be-aliases' into 'master'

Mention `let_it_be` aliases in the testing guide docs

See merge request gitlab-org/gitlab!44144
parents e59ab871 9be7f2e4
......@@ -484,17 +484,22 @@ This will result in only one `Project`, `User`, and `ProjectMember` created for
is handled automatically using a transaction rollback.
Note that if you modify an object defined inside a `let_it_be` block,
then you will need to reload the object as needed, or specify the `reload`
option to reload for every example.
then you must do one of the following:
- Reload the object as needed.
- Use the `let_it_be_with_reload` alias.
- Specify the `reload` option to reload for every example.
```ruby
let_it_be_with_reload(:project) { create(:project) }
let_it_be(:project, reload: true) { create(:project) }
```
You can also specify the `refind` option as well to completely load a
new object.
You can also use the `let_it_be_with_refind` alias, or specify the `refind`
option as well to completely load a new object.
```ruby
let_it_be_with_refind(:project) { create(:project) }
let_it_be(:project, refind: true) { create(:project) }
```
......
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