File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -6,4 +6,12 @@ class AdminSetResource < Hyrax::AdministrativeSet
6
6
Hyrax ::ValkyrieLazyMigration . migrating ( self , from : ::AdminSet )
7
7
8
8
include WithPermissionTemplateShim
9
+
10
+ def member_of
11
+ Hyrax . query_service . find_inverse_references_by ( resource : self , property : :admin_set_id )
12
+ end
13
+
14
+ def member_collection_ids
15
+ member_of . map ( &:id )
16
+ end
9
17
end
Original file line number Diff line number Diff line change 3
3
require 'spec_helper'
4
4
5
5
RSpec . describe AdminSetResource do
6
- subject ( :admin_set ) { described_class . new }
6
+ subject ( :admin_set ) { FactoryBot . valkyrie_create ( :hyku_admin_set ) }
7
+ let! ( :resource ) { FactoryBot . valkyrie_create ( :generic_work_resource , admin_set_id : admin_set . id ) }
7
8
8
9
it_behaves_like 'a Hyrax::AdministrativeSet'
9
10
19
20
subject { described_class }
20
21
its ( :to_rdf_representation ) { is_expected . to eq ( 'AdminSet' ) }
21
22
end
23
+
24
+ describe '#member_of' do
25
+ it 'returns the resources in the admin set' do
26
+ expect ( subject . member_of ) . to eq [ resource ]
27
+ end
28
+ end
29
+
30
+ describe '#member_collection_ids' do
31
+ it 'returns the collection ids of the resources in the admin set' do
32
+ expect ( subject . member_collection_ids ) . to eq [ resource . id ]
33
+ end
34
+ end
22
35
end
You can’t perform that action at this time.
0 commit comments