paulelliott / fabrication

This project has moved to GitLab! Please check there for the latest updates.
https://gitlab.com/fabrication-gem/fabrication
MIT License
998 stars 97 forks source link

Fabricator rand minimum? #292

Closed pedroadame closed 6 years ago

pedroadame commented 7 years ago

It's OK to have a parameter that randomizes count between 1 and N, but it could be great to have the possibility of specify a minimum other than one.

paulelliott commented 7 years ago

It would be cool if you could pass it a range as well as just an integer. Any interest in making a PR?

jaysonvirissimo commented 7 years ago

Does this existing functionality work for your use case @pedroadame?

ixti commented 6 years ago

@pedroadame, as @jaysonvirissimo said, you can achieve that by:

children(:start_range => 42, :end_range => 69) { ... }

But I'm gonna open a PR with allowing to pass range to rand like this:

children(:rand => 42..69) { ... }