Sha256: 0a11cf1f440bbf4c4302c1bd646da08e7410d67b8c2be2e28cf98261ff8a2abc

Contents?: true

Size: 1.75 KB

Versions: 7

Compression:

Stored size: 1.75 KB

Contents

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
unidom-party-2.0 lib/rspec/models/unidom/party/party_relation_spec.rb
unidom-party-1.9.8 lib/rspec/models/unidom/party/party_relation_spec.rb
unidom-party-1.9.7 lib/rspec/models/unidom/party/party_relation_spec.rb
unidom-party-1.9.6 lib/rspec/models/unidom/party/party_relation_spec.rb
unidom-party-1.9.5 lib/rspec/models/unidom/party/party_relation_spec.rb
unidom-party-1.9.4 lib/rspec/models/unidom/party/party_relation_spec.rb
unidom-party-1.9.3 lib/rspec/models/unidom/party/party_relation_spec.rb