Sha256: d717e08288f60625b30850c481a8bc742922956c6f24ad1f83eaef5a9282ed06
Contents?: true
Size: 1.13 KB
Versions: 50
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true FactoryBot.define do factory :user do sequence(:email) { |n| "user#{n}@example.com" } password { 'insecure' } factory :site_admin do after(:create) do |user, _evaluator| user.roles.create role: 'admin', resource: Spotlight::Site.instance end end factory :named_exhibit_roles do transient do exhibit { FactoryBot.create(:exhibit) } role { nil } end after(:create) do |user, evaluator| user.roles.create role: evaluator.role, resource: evaluator.exhibit if evaluator.role end factory :exhibit_admin do transient do role { 'admin' } end end factory :exhibit_curator do transient do role { 'curator' } end end end trait :with_exhibit_role do transient do exhibit { FactoryBot.create(:exhibit) } role { nil } end after(:create) do |user, evaluator| user.roles.create role: evaluator.role, resource: evaluator.exhibit if evaluator.role end end factory :exhibit_visitor do end end end
Version data entries
50 entries across 50 versions & 1 rubygems