Commit 9be7f2e4 authored by Peter Leitzen's avatar Peter Leitzen Committed by Amy Qualls

Mention `let_it_be` aliases in the testing guide docs

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