I am trying to put a conditional piece of logic into a factory that will only run if a specific trait has been passed in as an argument. I am inside the to_create
block so have access to the instance and the evaluator. Do either of them have a method that returns which traits, if any, have been passed in?
FactoryBot: Check if trait has been passed in
Asked Answered
Also interested in this! I have 4 traits and the model can be any one of those 4 choices. I want to randomly instantiate one of those four traits IFF those fields or a specific trait was not provided by the caller. Not sure how to accomplish this. –
Operant
© 2022 - 2024 — McMap. All rights reserved.