Skip to content

Commit

Permalink
Changes MembersController to use RepositoryObject.
Browse files Browse the repository at this point in the history
closes #4995
  • Loading branch information
justinlittman committed May 17, 2024
1 parent b536e3b commit 9b96f34
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/controllers/members_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
class MembersController < ApplicationController
# Return the members of this collection
def index
@members = Dro.members_of_collection(params[:object_id]).select(:external_identifier, :version)
@members = RepositoryObject.currently_members_of_collection(params[:object_id]).select(:external_identifier, :version)
end
end
14 changes: 9 additions & 5 deletions spec/requests/members_for_collection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@

RSpec.describe 'Get the members' do
let(:collection_druid) { 'druid:mk420bs7601' }

let!(:dro) { create(:ar_dro, isMemberOf: [collection_druid]) }

let(:expected) do
{
members: [
{
externalIdentifier: dro.external_identifier,
version: dro.version
externalIdentifier: repository_object.external_identifier,
version: repository_object.head_version.version
}
]
}
end

let(:repository_object) { create(:repository_object) }

before do
repository_object_version = create(:repository_object_version, version: 2, is_member_of: [collection_druid], repository_object:)
repository_object.update!(head_version: repository_object_version, opened_version: repository_object_version)
end

it 'returns the druids' do
get "/v1/objects/#{collection_druid}/members",
headers: { 'Authorization' => "Bearer #{jwt}" }
Expand Down

0 comments on commit 9b96f34

Please sign in to comment.