<commit_before>describe Unidom::Party::PartyRelation, type: :model do

  before :each do
  end

  after :each do
  end

  context do

    tim_attributes = { name: 'Tim' }
    tom_attributes = { name: 'Tom' }
    friendship_attributes = { linkage_code: 'FRND', priority: 1, grade: 5 }

    it_behaves_like 'Unidom::Common::Concerns::ModelExtension', friendship_attributes.merge({
        source_party_id:   Unidom::Common::NULL_UUID,
        source_party_type: 'Unidom::Party::Person',
        target_party_id:   Unidom::Common::NULL_UUID,
        target_party_type: 'Unidom::Party::Person'
        #priority:          nil,
        #grade:             nil
      })

    it_behaves_like 'belongs_to', friendship_attributes.merge({ target_party_id: Unidom::Common::NULL_UUID, target_party_type: 'Unidom::Party::Person' }),
      :source_party, Unidom::Party::Person, tim_attributes
    it_behaves_like 'belongs_to', friendship_attributes.merge({ source_party_id: Unidom::Common::NULL_UUID, source_party_type: 'Unidom::Party::Person' }),
      :target_party, Unidom::Party::Person, tom_attributes

  end

end<commit_msg>1, Improve the Party Relation spec for the source_party_is scope, & the target_party_is scope.<commit_after>describe Unidom::Party::PartyRelation, type: :model do

  before :each do
  end

  after :each do
  end

  context do

    tim_attributes = { name: 'Tim' }
    tom_attributes = { name: 'Tom' }
    friendship_attributes = { linkage_code: 'FRND', priority: 1, grade: 5 }

    it_behaves_like 'Unidom::Common::Concerns::ModelExtension', friendship_attributes.merge({
        source_party_id:   Unidom::Common::NULL_UUID,
        source_party_type: 'Unidom::Party::Person',
        target_party_id:   Unidom::Common::NULL_UUID,
        target_party_type: 'Unidom::Party::Person'
        #priority:          nil,
        #grade:             nil
      })

    it_behaves_like 'belongs_to', friendship_attributes.merge({ target_party_id: Unidom::Common::NULL_UUID, target_party_type: 'Unidom::Party::Person' }),
      :source_party, Unidom::Party::Person, tim_attributes
    it_behaves_like 'belongs_to', friendship_attributes.merge({ source_party_id: Unidom::Common::NULL_UUID, source_party_type: 'Unidom::Party::Person' }),
      :target_party, Unidom::Party::Person, tom_attributes

    model_attributes = {
      source_party_id:   SecureRandom.uuid,
      source_party_type: 'Unidom::Party::Person',
      target_party_id:   SecureRandom.uuid,
      target_party_type: 'Unidom::Party::Person',
      linkage_code:      'FRND',
      priority:          1,
      grade:             5
    }

    it_behaves_like 'polymorphic scope', model_attributes, :source_party_is, :source_party, [ Unidom::Party::Company, Unidom::Party::GovernmentAgency, Unidom::Party::Person, Unidom::Party::Shop ]
    it_behaves_like 'polymorphic scope', model_attributes, :target_party_is, :target_party, [ Unidom::Party::Company, Unidom::Party::GovernmentAgency, Unidom::Party::Person, Unidom::Party::Shop ]

  end

end
{'fraction_non_alphanumeric': 0.12276045122760451, 'fraction_numerical': 0.00232249502322495, 'mean_word_length': 4.225303292894281, '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': '2363462', 'n_tokens_mistral': 1039, 'n_tokens_neox': 985, 'n_words': 176}