summaryrefslogtreecommitdiff
path: root/test/factories/user_group_memberships.rb
blob: 7904f2f8d5ac5645217d5c07ed7eeb67ad2be8dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Read about factories at http://github.com/thoughtbot/factory_girl

Factory.define :user_group_membership do |f|
  f.association :user_group
  f.association :user
  
  # Make sure that the User is a member of the Tenant.
  f.after_build do |instance|
    Factory.create(:tenant_membership,
      :tenant_id => instance.user_group.tenant.id,
      :user_id   => instance.user.id
    )
  end
end