Sha256: 3723fdf66b3d6d35ebd9013f798dfcfee6fe4299569c719efbbd3399aaf157bb

Contents?: true

Size: 730 Bytes

Versions: 7

Compression:

Stored size: 730 Bytes

Contents

FactoryBot.define do
  factory :user do
    transient do
      exhibit { FactoryBot.create(:exhibit) }
    end
    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 :exhibit_admin do
      after(:create) do |user, evaluator|
        user.roles.create role: 'admin', resource: evaluator.exhibit
      end
    end
    factory :exhibit_curator do
      after(:create) do |user, evaluator|
        user.roles.create role: 'curator', resource: evaluator.exhibit
      end
    end

    factory :exhibit_visitor do
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
blacklight-spotlight-2.4.1 spec/factories/users.rb
blacklight-spotlight-2.4.0 spec/factories/users.rb
blacklight-spotlight-2.3.3 spec/factories/users.rb
blacklight-spotlight-2.3.2 spec/factories/users.rb
blacklight-spotlight-2.3.1 spec/factories/users.rb
blacklight-spotlight-2.3.0 spec/factories/users.rb
blacklight-spotlight-2.2.1 spec/factories/users.rb