Created
May 2, 2018 23:12
-
-
Save alvinsng/675a9e3d3b0bf95465cc4d53af8e5bba 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
| # In spec/factories/account.rb | |
| FactoryBot.define do | |
| sequence(:email) { |n| "test_email_#{n}@example.com" } | |
| end | |
| # In Spring parent | |
| def seed_db | |
| 100.times { create(:account) } | |
| end | |
| seed_db # creates 100 accounts with sequences 1 to 100 | |
| MySpecHelper.factory_sequences = FactoryGirl.sequences | |
| # In Spring fork's spec run | |
| FactoryGirl.configuration.instance_variable_set( | |
| :@sequences, | |
| MySpecHelper.factory_sequences | |
| ) | |
| let(:account) { create(:account) } # this now starts at 101 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment