Sha256: f36b2b6d1bf857fbf7615c5ee2fdd0607fa7825e5ea0083e06cd0382a5940881

Contents?: true

Size: 724 Bytes

Versions: 1

Compression:

Stored size: 724 Bytes

Contents

require 'test_helper'

class HttpTest < MiniTest::Test
  include Crawler::Http

  def test_request
    domain = 'https://www.digitalocean.com'
    response = request domain
    assert_equal 'SSD Cloud Server, VPS Server, Simple Cloud Hosting | DigitalOcean', Nokogiri::HTML(response).css('title').text
  end

  def test_request_follows_redirect
    domain = 'https://www.digitalocean.com/redirect'
    response = request domain
    assert_equal 'SSD Cloud Server, VPS Server, Simple Cloud Hosting | DigitalOcean', Nokogiri::HTML(response).css('title').text
  end

  def test_bad_request_is_rescued
    domain = 'https://www.digitalocean.com/bad_request'
    response = request domain
    assert_equal '', response
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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