-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathidentifier_schemes.rb
More file actions
46 lines (41 loc) · 1.14 KB
/
identifier_schemes.rb
File metadata and controls
46 lines (41 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# frozen_string_literal: true
# == Schema Information
#
# Table name: identifier_schemes
#
# id :integer not null, primary key
# active :boolean
# description :string
# context :integer
# logo_url :text
# name :string
# identifier_prefix :string
# created_at :datetime
# updated_at :datetime
#
FactoryBot.define do
factory :identifier_scheme do
name { Faker::Company.unique.name[0..29] }
description { Faker::Movies::StarWars.quote }
logo_url { Faker::Internet.url }
identifier_prefix { "#{Faker::Internet.url}/" }
active { true }
transient do
context_count { 1 }
end
# Add a trait for Shibboleth
trait :shibboleth do
name { 'shibboleth' }
context { 11 }
description { 'Institutional Sign In (Shibboleth)' }
logo_url { nil }
identifier_prefix { nil }
active { true }
end
after(:create) do |identifier_scheme, evaluator|
(0..(evaluator.context_count - 1)).each do |idx|
identifier_scheme.update("#{identifier_scheme.all_context[idx]}": true)
end
end
end
end