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