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

FactoryGirl.define do
  factory :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|
      FactoryGirl.create(:tenant_membership,
        :tenant_id => instance.user_group.tenant.id,
        :user_id   => instance.user.id
      )
    end
  end
end