Last active
July 12, 2022 19:11
-
-
Save VoltanBro/fa5e09f3e4efae8c8c28091f974ed63e to your computer and use it in GitHub Desktop.
advanced factory transient
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
| trait :my_custom do | |
| transient do | |
| params {{}} | |
| end | |
| after(:build) do |field, evaluator| | |
| field.name = evaluator.params[:name] | |
| end | |
| end | |
| # FactoryBot.create(:custom_field, :my_custom, params: { name: 'foo_bar' }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment