Comments (2)
Thanks for opening the issue @LandonSchropp! Currently, sequences use Agents to hold the state for the sequence. Your suggestion means we'd have to switch to saving the state in some other way. I'm not sure how we would be accomplish that. But if you have ideas, I'd be happy to review a pull-request.
In the meantime, I know it's probably not ideal, but you could modify the factory when you do manual testing to pass the start_at
option to the sequence. You can see that in the sequence docs:
def user_factory do
%{
# Will generate "[email protected]" then "[email protected]", etc.
email: sequence(:email, &"me-#{&1}@foo.com", start_at: 100),
}
end
Do you think that would help?
from ex_machina.
Thanks for the reply @germsvel! Your suggestion is definitely helpful in quickly solving my problem. 🙂
What I've done in the past with Fabricator
in Ruby was to patch the sequence generator and store the index to a temp file on every index generation. When the Fabricator first loaded, I would read the last sequence index from the disk and start it there.
I totally understand if this isn't something you're interested in adding to your package. I realize this isn't standard usage for factories—although it's useful!—so I'm content in closing this if you feel like it's out of scope.
If it's functionality you're interested in, I'm happy to create a draft PR around it.
Thanks!
from ex_machina.
Related Issues (20)
- def build/2 defines defaults multiple times HOT 2
- Use of `build( ... )` with Ecto 3.4+ leads to many association preload warnings HOT 7
- Compiler warning when using an a project using Elixir 1.11 HOT 3
- Insert with assocs fails constraint HOT 1
- Proposal: Introduce build_lazy/2 HOT 3
- Test-only implementation fails HOT 4
- Cast polymorphic embeds HOT 10
- Inserted data breaks manual test HOT 3
- Allow sequence in attributes passed to `insert_list` HOT 5
- Hundreds of depreciation compiler warnings when running tests HOT 4
- insert/2 doesn't work with compound primary keys HOT 3
- sequence starting with 0
- Is this project maintained? HOT 17
- Sequence reset doesn't respect the `start_at` option
- sequence(:example_id, & &1) put chars instead of integer HOT 3
- Stringify `Ecto.Enum` values when using `string_params`/`string_params_with_assocs`
- Option to have `insert_list` leverage Ecto's `insert_all`
- an intermittent error on async false tests HOT 1
- nvim diagnostics error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ex_machina.