aboutsummaryrefslogtreecommitdiff
blob: 40c715b4a435cb5750f807370eaab7b6c8c4445b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
def users_factory(*roles)
  roles.flatten!
  r = []
  for role in roles
    case role
      when :guest
        r.push Guest.new
      when :user
        r.push Factory(:user)
      when :council
        r.push Factory(:user, :council_member => true)
      when :admin
        r.push Factory(:user, :administrator => true)
      when :council_admin
        r.push Factory(:user, :council_member => true, :administrator => true)
    end
  end
  (r.count < 2) ? r.first : r
end

AllRoles = [:guest, :user, :council, :admin, :council_admin]