Sha256: e424fa6782fe0fb3355f24fbf3dec1e79b7069cb7ee5298eef0803140870dbdb

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

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

describe ContactData::Text do
  let(:text) do
    <<-HTML
      <span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);"
      class=""><b class="">From: </b></span>
      <span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;"
      class="">Max Williams<a href="mailto:max.williams@pusher-4.mail.intercom.io"
      class="">max.williams@pusher-4.mail.intercom.io</a>&gt;<br class=""></span>
    HTML
  end

  it 'gets metadata about text' do
    VCR.use_cassette('text_search') do
      result = ContactData::Text.search text, verbose: true
      expect(result).to be_a(Hash)
      expect(result[:contacts]).to include('neue')
      expect(result[:contacts]).not_to include('max-williams')
    end
  end

  it 'gets metadata about html, correctly identifying the text elements' do
    VCR.use_cassette('text_search') do
      result = ContactData::Text.search text, input_format: :html, verbose: true
      expect(result).to be_a(Hash)
      expect(result[:contacts]).not_to include('neue')
      expect(result[:contacts]).to include('max-williams')
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
contact-data-0.3.3 spec/contact-data_text_spec.rb
contact-data-0.3.2 spec/contact-data_text_spec.rb
contact-data-0.3.1 spec/contact-data_text_spec.rb
contact-data-0.3.0 spec/contact-data_text_spec.rb