email = "[email protected]"
user = User.find_by(email: email)
account = user.account
team = account.team
def stub_with_random_traits(model, params={})
FactoryGirl.create(model, *random_traits_for(model), params)
end
def random_traits_for(model)
traits = FactoryGirl.factories[model].definition.defined_traits.map{|t| t.name }
number_of_traits = (rand*traits.length).floor
number_of_traits.times.map{ traits[(rand*traits.length).floor] }.uniq
end
Cause making data is so boring and forever taking. https://www.youtube.com/watch?v=IS8-viUNP7k
cadence = FactoryGirl.create(:cadence, :with_email_step, :with_phone_step, account: account)
5000.times { stub_with_random_traits(:person, account: account, cadence: cadence) rescue nil; }