Created
April 9, 2021 14:39
-
-
Save benoittgt/f3be13d8e325d49f37cdaf8a1e7a13e5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # start FactoryBot id sequence at a different number. Naive approach. | |
| # other idea https://github.com/thoughtbot/factory_bot/issues/350#issuecomment-14475441 | |
| FactoryBot.define do | |
| factory :app do | |
| sequence(:id) { |n| 1.to_s.ljust(self.instance.class.name.size, "0").to_i + n } | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment