Sha256: bf383cde6d710611a74cf866f39184e11a77f495f5925c9071c10f7f7f715d24

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

require 'test/unit'
require 'spieker.rb'

class TestLinkScraper < Test::Unit::TestCase
  def setup
    @scraper = Spieker::LinkScraper.new('http://www.google.com')
  end

  def test_apphost
    assert_equal 'http://www.google.com', @scraper.app_host
  end

  def test_result
    return
    assert @scraper.result.any?
  end

  def test_filter_local
    found_links = [
      'http://www.google.com/local',
      '/local',
      '/local#justahash',
      '#justahash',
      'http://www.remote.com',
      'mailto:timonv@gmail.com'
    ]
    expected_links = [
      'http://www.google.com/local',
      '/local',
      ''
    ]

    @scraper.links = found_links
    assert_equal expected_links, @scraper.result
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spieker-0.0.2 test/link_scraper_test.rb
spieker-0.0.1 test/link_scraper_test.rb