-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Can use lists in sequences. Fixes #223 ``` def user_factory do %MyApp.User{ name: "Jane Smith", email: sequence(:email, &"email-#{&1}@example.com"), role: sequence(:role, ["admin", "user", "other"]), } end ```
- Loading branch information
1 parent
3776a51
commit 779b4c8
Showing
4 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,7 +135,9 @@ defmodule ExMachina do | |
def user_factory do | ||
%{ | ||
# Will generate "[email protected]" then "[email protected]", etc. | ||
email: sequence(:email, &"me-\#{&1}@foo.com") | ||
email: sequence(:email, &"me-\#{&1}@foo.com"), | ||
# Will generate "admin" then "user", "other", "admin" etc. | ||
role: sequence(:role, ["admin", "user", "other"]) | ||
} | ||
end | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters