|
1 | 1 | FactoryBot.define do |
2 | 2 | factory :base_resource, class: 'Hashie::Mash' do |
3 | 3 | transient do |
| 4 | + ctid { Envelope.generate_ctid } |
4 | 5 | provisional { false } |
5 | 6 | end |
6 | 7 |
|
7 | 8 | add_attribute(:'adms:status') do |
8 | 9 | 'graphPublicationStatus:Provisional' if provisional |
9 | 10 | end |
| 11 | + |
| 12 | + add_attribute(:'ceterms:ctid') { ctid } |
10 | 13 | end |
11 | 14 |
|
12 | 15 | factory :resource, parent: :base_resource do |
|
19 | 22 | factory :cer_org, parent: :base_resource do |
20 | 23 | add_attribute(:@type) { 'ceterms:CredentialOrganization' } |
21 | 24 | add_attribute(:@context) { 'http://credreg.net/ctdl/schema/context/json' } |
22 | | - transient { ctid { Envelope.generate_ctid } } |
23 | 25 | add_attribute(:@id) do |
24 | 26 | "http://credentialengineregistry.org/resources/#{ctid}" |
25 | 27 | end |
26 | | - add_attribute(:'ceterms:ctid') { ctid } |
27 | 28 | add_attribute(:'ceterms:name') { 'Test Org' } |
28 | 29 | add_attribute(:'ceterms:description') { 'Org Description' } |
29 | 30 | add_attribute(:'ceterms:subjectWebpage') { 'http://example.com/test-org' } |
|
51 | 52 | end |
52 | 53 | add_attribute(:@type) { 'ceterms:Certificate' } |
53 | 54 | add_attribute(:@context) { 'http://credreg.net/ctdl/schema/context/json' } |
54 | | - transient { ctid { Envelope.generate_ctid } } |
55 | | - add_attribute(:'ceterms:ctid') { ctid } |
56 | 55 | add_attribute(:'ceterms:name') { 'Test Cred' } |
57 | 56 | add_attribute(:'ceterms:description') { 'Test Cred Description' } |
58 | 57 | add_attribute(:'ceterms:subjectWebpage') { 'http://example.com/test-cred' } |
|
69 | 68 | factory :cer_ass_prof, parent: :base_resource do |
70 | 69 | add_attribute(:@type) { 'ceterms:AssessmentProfile' } |
71 | 70 | add_attribute(:@context) { 'http://credreg.net/ctdl/schema/context/json' } |
72 | | - transient { ctid { Envelope.generate_ctid } } |
73 | 71 | add_attribute(:@id) do |
74 | 72 | "http://credentialengineregistry.org/resources/#{ctid}" |
75 | 73 | end |
76 | | - add_attribute(:'ceterms:ctid') { ctid } |
77 | 74 | add_attribute(:'ceterms:name') { 'Test Assessment Profile' } |
78 | 75 | end |
79 | 76 |
|
80 | 77 | factory :cer_cond_man, parent: :base_resource do |
81 | 78 | add_attribute(:@type) { 'ceterms:ConditionManifest' } |
82 | 79 | add_attribute(:@context) { 'http://credreg.net/ctdl/schema/context/json' } |
83 | | - transient { ctid { Envelope.generate_ctid } } |
84 | 80 | add_attribute(:@id) do |
85 | 81 | "http://credentialengineregistry.org/resources/#{ctid}" |
86 | 82 | end |
87 | | - add_attribute(:'ceterms:ctid') { ctid } |
88 | 83 | add_attribute(:'ceterms:name') { 'Test Cond Man' } |
89 | 84 | add_attribute(:'ceterms:conditionManifestOf') { [{ '@id' => 'AgentID' }] } |
90 | 85 | end |
91 | 86 |
|
92 | 87 | factory :cer_cost_man, parent: :base_resource do |
93 | 88 | add_attribute(:@type) { 'ceterms:CostManifest' } |
94 | 89 | add_attribute(:@context) { 'http://credreg.net/ctdl/schema/context/json' } |
95 | | - transient { ctid { Envelope.generate_ctid } } |
96 | 90 | add_attribute(:@id) do |
97 | 91 | "http://credentialengineregistry.org/resources/#{ctid}" |
98 | 92 | end |
99 | | - add_attribute(:'ceterms:ctid') { ctid } |
100 | 93 | add_attribute(:'ceterms:name') { 'Test Cost Man' } |
101 | 94 | add_attribute(:'ceterms:costDetails') { 'CostDetails' } |
102 | 95 | add_attribute(:'ceterms:costManifestOf') { [{ '@id' => 'AgentID' }] } |
|
105 | 98 | factory :cer_lrn_opp_prof, parent: :base_resource do |
106 | 99 | add_attribute(:@type) { 'ceterms:CostManifest' } |
107 | 100 | add_attribute(:@context) { 'http://credreg.net/ctdl/schema/context/json' } |
108 | | - transient { ctid { Envelope.generate_ctid } } |
109 | 101 | add_attribute(:@id) do |
110 | 102 | "http://credentialengineregistry.org/resources/#{ctid}" |
111 | 103 | end |
112 | | - add_attribute(:'ceterms:ctid') { ctid } |
113 | 104 | add_attribute(:'ceterms:name') { 'Test Lrn Opp Prof' } |
114 | 105 | add_attribute(:'ceterms:costDetails') { 'CostDetails' } |
115 | 106 | add_attribute(:'ceterms:costManifestOf') { [{ '@id' => 'AgentID' }] } |
|
141 | 132 | add_attribute(:@id) { ctid } |
142 | 133 | add_attribute(:@type) { 'ceterms:AssessmentProfile' } |
143 | 134 | add_attribute(:@context) { 'http://credreg.net/ctdl/schema/context/json' } |
144 | | - add_attribute(:'ceterms:ctid') { ctid } |
145 | 135 | add_attribute(:'ceterms:name') { 'Test Assessment Profile' } |
146 | 136 | add_attribute(:'ceasn:isPartOf') { part_of } |
147 | 137 | end |
148 | 138 |
|
149 | 139 | factory :cer_competency, parent: :base_resource do |
150 | 140 | transient { part_of { nil } } |
151 | 141 | transient { competency_text { 'This is the competency text...' } } |
152 | | - transient { ctid { Envelope.generate_ctid } } |
153 | 142 | id { "http://credentialengineregistry.org/resources/#{ctid}" } |
154 | 143 | add_attribute(:@id) { id } |
155 | 144 | add_attribute(:@type) { 'ceasn:Competency' } |
156 | | - add_attribute(:'ceterms:ctid') { ctid } |
157 | 145 | add_attribute(:'ceasn:isPartOf') { part_of } |
158 | 146 | add_attribute(:'ceasn:inLanguage') { ['en'] } |
159 | 147 | add_attribute(:'ceasn:competencyText') { { 'en-us' => competency_text } } |
160 | 148 | end |
161 | 149 |
|
162 | 150 | factory :cer_competency_framework, parent: :base_resource do |
163 | | - transient { ctid { Envelope.generate_ctid } } |
164 | 151 | id { "http://credentialengineregistry.org/resources/#{ctid}" } |
165 | 152 | add_attribute(:@id) { id } |
166 | 153 | add_attribute(:@type) { 'ceasn:CompetencyFramework' } |
167 | | - add_attribute(:'ceterms:ctid') { ctid } |
168 | 154 | add_attribute(:'ceasn:inLanguage') { ['en'] } |
169 | 155 | add_attribute(:'ceasn:name') { { 'en-us' => 'Competency Framework name' } } |
170 | 156 | add_attribute(:'ceasn:description') { { 'en-us' => 'Competency Framework description' } } |
171 | 157 | end |
172 | 158 |
|
173 | 159 | factory :cer_graph_competency_framework, parent: :base_resource do |
174 | | - transient { ctid { Envelope.generate_ctid } } |
175 | 160 | id { "http://credentialengineregistry.org/resources/#{ctid}" } |
176 | 161 | add_attribute(:@id) { id } |
177 | 162 | add_attribute(:@type) { 'ceasn:CompetencyFramework' } |
|
186 | 171 | attributes_for(:cer_competency_framework, ctid: ctid) |
187 | 172 | ] |
188 | 173 | end |
189 | | - add_attribute(:'ceterms:ctid') { ctid } |
190 | 174 | end |
191 | 175 | end |
0 commit comments