Skip to content

Commit

Permalink
remove deprecated class attribute from CollectionType
Browse files Browse the repository at this point in the history
  • Loading branch information
tamsin johnson authored and dlpierce committed Nov 11, 2022
1 parent 62565fa commit 46c3bd2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 31 deletions.
16 changes: 0 additions & 16 deletions app/models/hyrax/collection_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ def title=(value)
assign_machine_id
end

# this class attribute is deprecated in favor of {.settings_attributes}
# these need to carefully align with boolean flag attributes/table columns,
# so making it settable is a liability. deprecating is challenging because
# +class_attribute+ calls +singleton_class.class_eval { redefine_method }+
# as the +name=+ implementation. there should be few callers outside hyrax.
class_attribute :collection_type_settings_methods, instance_writer: false
self.collection_type_settings_methods = SETTINGS_ATTRIBUTES

# These are provided as a convenience method based on prior design discussions.
alias_attribute :discovery, :discoverable
alias_attribute :sharing, :sharable
Expand Down Expand Up @@ -123,14 +115,6 @@ def collections(use_valkyrie: Hyrax.config.use_valkyrie?)
ActiveFedora::Base.where(Hyrax.config.collection_type_index_field.to_sym => to_global_id.to_s)
end

##
# @deprecated Use #collections.any? instead
#
# @return [Boolean] True if there is at least one collection of this type
def collections?
Deprecation.warn('Use #collections.any? instead.') && collections.any?
end

# @return [Boolean] True if this is the Admin Set type
def admin_set?
machine_id == ADMIN_SET_MACHINE_ID
Expand Down
14 changes: 0 additions & 14 deletions spec/models/hyrax/collection_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,6 @@
let!(:collection) { FactoryBot.valkyrie_create(:hyrax_collection, collection_type_gid: collection_type.to_global_id.to_s) }
end

describe '.collection_type_settings_methods' do
it 'lists collection settings methods' do # deprecated
expect(described_class.collection_type_settings_methods)
.to include(:nestable?, :discoverable?, :brandable?)
end
end

describe '#collection_type_settings_methods' do
it 'lists collection settings methods' do # deprecated
expect(collection_type.collection_type_settings_methods)
.to include(:nestable?, :discoverable?, :brandable?)
end
end

describe '.settings_attributes' do
it 'lists collection settings methods' do
expect(described_class.settings_attributes)
Expand Down
2 changes: 1 addition & 1 deletion spec/support/matchers/collection_type_property_matchers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@

RSpec::Matchers.define :have_collections do
match do |actual|
actual&.collections?
actual&.collections&.any?
end
end

0 comments on commit 46c3bd2

Please sign in to comment.