Sha256: 97425692f7a9e82b78f7a68258252d23483d4ec505410fc04e6247e3a47fca82

Contents?: true

Size: 1.76 KB

Versions: 4

Compression:

Stored size: 1.76 KB

Contents

# encoding: utf-8
require 'spec_helper'
require 'contact-data'

describe ContactData::Contact do
  let(:name) { 'Derek Jones III' }
  let(:source) { 'angel_list' }
  let(:slug) { 'derek-jones' }
  let(:domain) { 'anthemis.com' }

  it 'searches for a contact by name' do
    VCR.use_cassette('name_search') do
      result = ContactData::Contact.search(name, verbose: true)
      expect(result).to be_a(Hash)
      expect(result[:slug]).to eq('derek-jones')
      expect(result[:identities].count).to eq(15)
    end
  end

  it 'retrieves a contact from a source' do
    VCR.use_cassette('source_slug') do
      result = ContactData::Contact.from(source, slug, verbose: true)
      expect(result).to be_a(Hash)
      expect(result[:slug]).to eq(slug)
      expect(result[:data].first[:source_identities].count).to eq(5)
    end
  end

  it 'retrieves an organization contact from a domain name' do
    VCR.use_cassette('domain_name') do
      result = ContactData::Contact.from_domain(domain, verbose: true)
      expect(result).to be_a(Hash)
      expect(result[:contacts].first[:slug]).to eq('anthemis-group')
      expect(result[:contacts].count).to eq(1)
    end
  end

  it 'retrieves a person contact from a domain name' do
    VCR.use_cassette('domain_name') do
      result = ContactData::Contact.from_domain(domain, contact_type: 'person', verbose: true)
      expect(result).to be_a(Hash)
      expect(result[:contacts].first[:slug]).to eq('sean-park')
      expect(result[:contacts].count).to eq(1)
    end
  end

  it 'retrieves all contacts for a domain name' do
    VCR.use_cassette('domain_name') do
      result = ContactData::Contact.from_domain(domain, contact_type: 'all', verbose: true)
      expect(result).to be_a(Hash)
      expect(result[:contacts].count).to eq(2)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
contact-data-0.4.9 spec/contact-data_contact_spec.rb
contact-data-0.4.8 spec/contact-data_contact_spec.rb
contact-data-0.4.6 spec/contact-data_contact_spec.rb
contact-data-0.4.5 spec/contact-data_contact_spec.rb