Add a user_role factory

Naming the association in the model makes the relationship easier
to express in the factory.
This commit is contained in:
Andy Allan 2017-02-02 12:35:29 +00:00
parent 9e591d8ccb
commit c55169659c
2 changed files with 7 additions and 0 deletions

View file

@ -1,5 +1,6 @@
class UserRole < ActiveRecord::Base class UserRole < ActiveRecord::Base
belongs_to :user belongs_to :user
belongs_to :granter, :class_name => "User"
ALL_ROLES = %w(administrator moderator).freeze ALL_ROLES = %w(administrator moderator).freeze

View file

@ -0,0 +1,6 @@
FactoryGirl.define do
factory :user_role do
user
association :granter, :factory => :user
end
end