Sha256: 0a1df3a475223e00ec658af6cb5fbc23232ee6a07776b0c50fa1b2da8f355540

Contents?: true

Size: 1.63 KB

Versions: 18

Compression:

Stored size: 1.63 KB

Contents

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

describe ContactData::Deprecated do
  let(:name) { 'Derek Jones III' }
  let(:name_xml_bug) { 'XXXXXXXXXX ?' }

  context 'contact' do
    it 'searches by name' do
      VCR.use_cassette('deprecated_contact_search') do
        result = ContactData::Deprecated.search(name)
        expect(result).to be_a(Hash)
        expect(result[:count]).to eq(10)
      end
    end

    it 'searches by name with a contact type' do
      VCR.use_cassette('deprecated_contact_search') do
        result = ContactData::Deprecated.search(name, :person)
        expect(result).to be_a(Hash)
        expect(result[:count]).to eq(10)
      end
    end

    it 'searches successfully with name that gave XML bug' do
      VCR.use_cassette('deprecated_contact_search') do
        result = ContactData::Deprecated.search(name_xml_bug)
        expect(result).to be_a(Hash)
      end
    end
  end

  context 'contact name' do
    it 'finds contact names in text' do
      text = 'lorem ipsum john smith dolor sit amet'

      VCR.use_cassette('deprecated_contact_name_search') do
        result = ContactData::Deprecated.find_contacts_in(text)
        expect(result).to be_a(Hash)
        expect(result[:contacts]).to eq(['lorem-ipsum', 'john-smith'])
      end
    end
  end

  context 'link' do
    it 'finds information about a url' do
      url = 'http://www.iana.org/numbers'

      VCR.use_cassette('deprecated_link_metadata') do
        result = ContactData::Deprecated.link_metadata(url)
        expect(result).to be_a(Hash)
        expect(result[:title]).to eq('IANA — Number Resources')
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
contact-data-0.4.9 spec/contact-data_deprecated_spec.rb
contact-data-0.4.8 spec/contact-data_deprecated_spec.rb
contact-data-0.4.6 spec/contact-data_deprecated_spec.rb
contact-data-0.4.5 spec/contact-data_deprecated_spec.rb
contact-data-0.4.4 spec/contact-data_deprecated_spec.rb
contact-data-0.4.3 spec/contact-data_deprecated_spec.rb
contact-data-0.4.2 spec/contact-data_deprecated_spec.rb
contact-data-0.4.1 spec/contact-data_deprecated_spec.rb
contact-data-0.3.4 spec/contact-data_deprecated_spec.rb
contact-data-0.4.0 spec/contact-data_deprecated_spec.rb
contact-data-0.3.3 spec/contact-data_deprecated_spec.rb
contact-data-0.3.2 spec/contact-data_deprecated_spec.rb
contact-data-0.3.1 spec/contact-data_deprecated_spec.rb
contact-data-0.3.0 spec/contact-data_deprecated_spec.rb
contact-data-0.2.3 spec/contact-data_deprecated_spec.rb
contact-data-0.2.2 spec/contact-data_deprecated_spec.rb
contact-data-0.2.1 spec/contact-data_deprecated_spec.rb
contact-data-0.2.0 spec/contact-data_deprecated_spec.rb