<commit_before>require 'kobza_crm/infrastructure/persistence/mongo/organization_assembler'
require 'kobza_crm/infrastructure/persistence/mongo/person_assembler'
require 'kobza_crm/infrastructure/persistence/mongo/party_repository'
require_relative 'shared_examples_for_mongo_party_repository'

module KobzaCRM module Infrastructure module Persistence module Mongo module Test
  shared_examples 'party repository' do
    include_context 'a mongo repository context'

    let(:assembler_class) { OrganizationAssembler }

    let(:collection_name) { 'parties' }

    it_behaves_like 'a mongo party repository'

    subject { repository }
    let(:repository) do
      role_repository = Mongobzar::Repository::DependentRepository.new(database_name, 'party_roles')
      role_repository.assembler = Mongobzar::Assembler::PolymorphicAssembler.new([
        CustomerRoleAssembler.instance,
        CustomerServiceRepresentativeRoleAssembler.instance
      ])
      role_repository.foreign_key = 'party_id'

      repository = PartyRepository.new(database_name, collection_name)
      repository.role_repository = role_repository
      address_assembler = Mongobzar::Assembler::PolymorphicAssembler.new([
        EmailAddressAssembler.instance,
        WebPageAddressAssembler.instance
      ])

      organization_assembler = OrganizationAssembler.instance(
        address_assembler,
        role_repository
      )
      person_assembler = PersonAssembler.instance(
        address_assembler,
        role_repository<commit_msg>There is no need for shared examples for MongoPartyRepository<commit_after>require 'kobza_crm/domain/email_address'
require 'kobza_crm/domain/web_page_address'
require 'kobza_crm/domain/customer_role'

require 'kobza_crm/infrastructure/persistence/mongo/organization_assembler'
require 'kobza_crm/infrastructure/persistence/mongo/person_assembler'
require 'kobza_crm/infrastructure/persistence/mongo/party_repository'

require 'kobza_crm/infrastructure/persistence/mongo/customer_role_assembler'
require 'kobza_crm/infrastructure/persistence/mongo/customer_service_representative_role_assembler'

require 'kobza_crm/infrastructure/persistence/mongo/email_address_assembler'
require 'kobza_crm/infrastructure/persistence/mongo/web_page_address_assembler'

require_relative 'shared_examples_for_mongo_repository'

module KobzaCRM module Infrastructure module Persistence module Mongo module Test
  shared_examples 'party repository' do
    include_context 'a mongo repository context'

    let(:assembler_class) { OrganizationAssembler }

    let(:collection_name) { 'parties' }

    subject { repository }
    let(:repository) do
      role_repository = Mongobzar::Repository::DependentRepository.new(database_name, 'party_roles')
      role_repository.assembler = Mongobzar::Assembler::PolymorphicAssembler.new([
        CustomerRoleAssembler.instance,
        CustomerServiceRepresentativeRoleAssembler.instance
      ])
      role_repository.foreign_key = 'party_id'

      repository = PartyRepository.new(database_name, collection_name)
      repository.role_repository = role_repository
      address_assembler = Mongobzar::Assembler::PolymorphicAssembler.new([
        EmailAddressAssembler.instance,
        WebPageAddressAssembler.instance
      ])

      organization_assembler = OrganizationAssembler.instance(
        address_assembler,
        role_repository
      )
      person_assembler = PersonAssembler.instance(
        address_assembler,
        role_repository
{'fraction_non_alphanumeric': 0.06906392694063927, 'fraction_numerical': 0.0, 'mean_word_length': 5.053540587219343, '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': '6948217', 'n_tokens_mistral': 1020, 'n_tokens_neox': 1010, 'n_words': 148}