Sha256: 814ced4b6d4817a87c7d0737e38a66e595b07690a44d23f4268322bf77069886
Contents?: true
Size: 1.16 KB
Versions: 63
Compression:
Stored size: 1.16 KB
Contents
module Pageflow FactoryBot.define do factory :membership, class: Membership do user association :entity, factory: :entry role { :previewer } before(:create) do |membership| if membership.entity_type != 'Pageflow::Account' && !membership.user.accounts.include?(membership.entity.account) && !membership.entity.account.nil? create(:membership, user: membership.user, entity: membership.entity.account, role: :member) end end end factory :entry_membership, class: Membership do user association :entity, factory: :entry role { :previewer } before(:create) do |membership| if !membership.user.accounts.include?(membership.entity.account) && !membership.entity.account.nil? create(:membership, user: membership.user, entity: membership.entity.account, role: :member) end end end factory :account_membership, class: Membership do user association :entity, factory: :account role { :member } end end end
Version data entries
63 entries across 63 versions & 1 rubygems