Skip to content

Commit

Permalink
Merge pull request #6377 from samvera/rm-dep-collection-type
Browse files Browse the repository at this point in the history
Remove deprecated `Collection#collection_type`
  • Loading branch information
dlpierce authored Oct 20, 2023
2 parents f6554a1 + 853212d commit 2d91145
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
10 changes: 0 additions & 10 deletions app/models/concerns/hyrax/collection_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@ def collection_type_gid=(new_collection_type_gid)
end
end

delegate(*Hyrax::CollectionType.settings_attributes, to: :collection_type)
ActiveSupport::Deprecation.deprecate_methods(self, *Hyrax::CollectionType.settings_attributes)

# Get the collection_type when accessed
def collection_type
Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " \
"Instead, use Hyrax::CollectionType.for(collection: collection).")
@collection_type ||= Hyrax::CollectionType.find_by_gid!(collection_type_gid)
end

def collection_type=(new_collection_type)
self.collection_type_gid = new_collection_type.to_global_id
end
Expand Down
24 changes: 0 additions & 24 deletions spec/models/collection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,30 +170,6 @@ class Member < ActiveFedora::Base
end
end

describe '#collection_type' do
let(:collection) { described_class.new(collection_type: collection_type) }
let(:collection_type) { create(:collection_type) }

it 'returns a collection_type instance from the collection_type_gid' do
expect(collection.collection_type).to be_kind_of(Hyrax::CollectionType)
expect(collection.collection_type).to eq collection_type
end
end

describe 'collection type delegated methods' do
subject { build(:collection_lw) }

it { is_expected.to delegate_method(:nestable?).to(:collection_type) }
it { is_expected.to delegate_method(:discoverable?).to(:collection_type) }
it { is_expected.to delegate_method(:brandable?).to(:collection_type) }
it { is_expected.to delegate_method(:sharable?).to(:collection_type) }
it { is_expected.to delegate_method(:share_applies_to_new_works?).to(:collection_type) }
it { is_expected.to delegate_method(:allow_multiple_membership?).to(:collection_type) }
it { is_expected.to delegate_method(:require_membership?).to(:collection_type) }
it { is_expected.to delegate_method(:assigns_workflow?).to(:collection_type) }
it { is_expected.to delegate_method(:assigns_visibility?).to(:collection_type) }
end

describe '.after_destroy' do
it 'will destroy the associated permission template' do
collection = build(:collection_lw, with_permission_template: true)
Expand Down

0 comments on commit 2d91145

Please sign in to comment.