Sha256: fb7393581246da1f7d41eb3941d02cc5a97c98329f07a58091f63d9ba01f9991

Contents?: true

Size: 928 Bytes

Versions: 3

Compression:

Stored size: 928 Bytes

Contents

shared_examples 'Unidom::Party::Concerns::AsSourceParty' do |model_attributes, target_party, linkage_code|

  context do

    target_person_1 = Unidom::Party::Person.create! name: 'Tim'
    target_person_2 = Unidom::Party::Person.create! name: 'Tom'

    target_party_relation_1_attributes = { target_party: target_person_1 }
    target_party_relation_2_attributes = { target_party: target_person_2 }

    it_behaves_like 'has_many', model_attributes, :target_party_relations, Unidom::Party::PartyRelation, [ target_party_relation_1_attributes, target_party_relation_2_attributes ]

    model = described_class.create! model_attributes
    it_behaves_like 'assert_present!', model, :relate!, [ { to: target_party, due_to: linkage_code, at: Time.now } ], [ :to, :due_to, :at ]
    it_behaves_like 'assert_present!', model, :relate?, [ { to: target_party, due_to: linkage_code, at: Time.now } ], [ :to, :due_to, :at ]

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
unidom-party-2.0 lib/rspec/models/unidom/party/concerns/as_source_party_shared_examples.rb
unidom-party-1.9.8 lib/rspec/models/unidom/party/concerns/as_source_party_shared_examples.rb
unidom-party-1.9.7 lib/rspec/models/unidom/party/concerns/as_source_party_shared_examples.rb