Sha256: 11d2773b2e458cc9b2867cff6b24ec457aa38fee0af5ddf1915f3f9faa248242

Contents?: true

Size: 1.33 KB

Versions: 16

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe Party do
  before(:each) do
    @party = Factory.create(:individual_party)
    @party_relationship = Factory.create(:party_relationship, :from_party => @party)
  end

  it "relationships count should be 1" do
    @relationships = @party.relationships
    @relationships.count.should eq 1
  end

  it "Create a new relationship, and count of relationships should be 2" do
    @party2 = Factory.create(:individual_party)
    @party.create_relationship("Created a new relationship for a test", @party2.id)
    @party.relationships.count.should eq 2
  end

  it "Should find relationships by type and get an array with 1 relationship" do
    @relationship_type = Factory.create(:relationship_type,
                                        :internal_identifier => "Test Relationship Type")

    @relationship1 = Factory.create(:party_relationship,
                                    :from_party => @party,
                                    :relationship_type => @relationship_type
                                   )
    @party.find_relationships_by_type("Test Relationship Type").count.should eq 1
  end

  it "find_relationships_by_type should return no relationships, no error" do
    PartyRelationship.destroy(@party_relationship.id)
    @party.find_relationships_by_type("Test Relationship Type").count.should eq 0
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
erp_app-3.0.16 spec/models/extensions/party_spec.rb
erp_app-3.0.15 spec/models/extensions/party_spec.rb
erp_app-3.0.14 spec/models/extensions/party_spec.rb
erp_app-3.0.13 spec/models/extensions/party_spec.rb
erp_app-3.0.12 spec/models/extensions/party_spec.rb
erp_app-3.0.10 spec/models/extensions/party_spec.rb
erp_app-3.0.9 spec/models/extensions/party_spec.rb
erp_app-3.0.8 spec/models/extensions/party_spec.rb
erp_app-3.0.7 spec/models/extensions/party_spec.rb
erp_app-3.0.6 spec/models/extensions/party_spec.rb
erp_app-3.0.5 spec/models/extensions/party_spec.rb
erp_app-3.0.4 spec/models/extensions/party_spec.rb
erp_app-3.0.3 spec/models/extensions/party_spec.rb
erp_app-3.0.2 spec/models/extensions/party_spec.rb
erp_app-3.0.1 spec/models/extensions/party_spec.rb
erp_app-3.0.0 spec/models/extensions/party_spec.rb