Retrospring/spec/factories/list.rb

19 lines
436 B
Ruby
Raw Normal View History

# frozen_string_literal: true
FactoryBot.define do
factory :list do
sequence(:display_name) { |i| "#{Faker::Internet.username(specifier: 0..12, separators: %w[_])}#{i}" }
user { FactoryBot.build(:user) }
2020-04-30 15:05:41 -07:00
transient do
members { [] }
end
after(:create) do |list, evaluator|
2020-04-30 15:05:41 -07:00
evaluator.members.each do |member|
ListMember.create(list_id: list.id, user_id: member.id)
2020-04-30 15:05:41 -07:00
end
end
end
end