Sha256: 996fb516b3b923b3674950429368357c80617e7f3d4db82391d71a1f3bafcfda

Contents?: true

Size: 746 Bytes

Versions: 1

Compression:

Stored size: 746 Bytes

Contents

require 'test_helper'

class DocumentTest < MiniTest::Test

  def test_document_parsing
    document = Crawler::Document.new('https://www.digitalocean.com/')

    # Test link discovery
    ['http://techcrunch.com/article/', 'https://cloud.digitalocean.com/login', '/company/careers/'].each do |link|
      assert_includes document.links, link
    end

    # Test domain specific link discovery
    assert_includes document.domain_specific_paths, '/company/careers/'

    ['https://twitter.com/digitalocean', 'https://status.digitalocean.com/', '#'].each do |link|
      refute_includes document.domain_specific_paths, link
    end

    # Test assest discovery
    assert_includes document.static_assets, '/assets/images/techcrunch.png'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-crawler-0.0.1 test/crawler/document_test.rb