<commit_before># frozen_string_literal: true
RSpec.describe Hyrax::CollectionType, type: :model do
  let(:collection_type) { build(:collection_type) }

  shared_context 'with a collection' do
    let(:collection_type) { create(:collection_type) }

    before do
      FactoryBot.valkyrie_create(:hyrax_collection, collection_type_gid: collection_type.gid)
    end
  end

  describe '.collection_type_settings_methods' do
    subject { described_class.collection_type_settings_methods }

    it { is_expected.to be_a(Array) }
  end

  describe '#collection_type_settings_methods' do
    subject { described_class.new.collection_type_settings_methods }

    it { is_expected.to be_a(Array) }
  end

  it "has basic metadata" do
    expect(collection_type).to respond_to(:title)
    expect(collection_type.title).not_to be_empty
    expect(collection_type).to respond_to(:description)
    expect(collection_type.description).not_to be_empty
    expect(collection_type).to respond_to(:machine_id)
  end

  it "has configuration properties with defaults" do
    expect(collection_type).to be_nestable
    expect(collection_type).to be_brandable
    expect(collection_type).to be_discoverable
    expect(collection_type).to be_sharable
    expect(collection_type).to be_share_applies_to_new_works
    expect(collection_type).to allow_multiple_membership
    expect(collection_type).not_to require_membership
    expect(collection_type).not_to assign_workflow
    expect(collection_type).not_to assign_visibility
  end

  describe '#gid' do
    it 'returns the gid when id exists' do
      collection_type.id = 5
      expect(collection_type.gid.to_s).to eq 'gid://internal/hyrax-collectiontype/5'<commit_msg>generalize test for CollectionType#gid<commit_after># frozen_string_literal: true
RSpec.describe Hyrax::CollectionType, type: :model do
  let(:collection_type) { build(:collection_type) }

  shared_context 'with a collection' do
    let(:collection_type) { create(:collection_type) }

    before do
      FactoryBot.valkyrie_create(:hyrax_collection, collection_type_gid: collection_type.gid)
    end
  end

  describe '.collection_type_settings_methods' do
    subject { described_class.collection_type_settings_methods }

    it { is_expected.to be_a(Array) }
  end

  describe '#collection_type_settings_methods' do
    subject { described_class.new.collection_type_settings_methods }

    it { is_expected.to be_a(Array) }
  end

  it "has basic metadata" do
    expect(collection_type).to respond_to(:title)
    expect(collection_type.title).not_to be_empty
    expect(collection_type).to respond_to(:description)
    expect(collection_type.description).not_to be_empty
    expect(collection_type).to respond_to(:machine_id)
  end

  it "has configuration properties with defaults" do
    expect(collection_type).to be_nestable
    expect(collection_type).to be_brandable
    expect(collection_type).to be_discoverable
    expect(collection_type).to be_sharable
    expect(collection_type).to be_share_applies_to_new_works
    expect(collection_type).to allow_multiple_membership
    expect(collection_type).not_to require_membership
    expect(collection_type).not_to assign_workflow
    expect(collection_type).not_to assign_visibility
  end

  describe '#gid' do
    it 'returns the gid when id exists' do
      collection_type.id = 5
      expect(collection_type.gid.to_s).to eq "gid://#{GlobalID.app}/hyrax-collectiontype/5"
{'fraction_non_alphanumeric': 0.08061699650756694, 'fraction_numerical': 0.0011641443538998836, 'mean_word_length': 4.977391304347826, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4428739', 'n_tokens_mistral': 1071, 'n_tokens_neox': 1028, 'n_words': 202}