Retrospring/spec/factories/group.rb

19 lines
441 B
Ruby
Raw Normal View History

# frozen_string_literal: true
FactoryBot.define do
factory :group 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 |group, evaluator|
evaluator.members.each do |member|
GroupMember.create(group_id: group.id, user_id: member.id)
end
end
end
end