Sha256: 1cc98882aedbe02d68ec5f5286c04782c6d8a62bcb2eed41f81e8cf413f04753
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
#!/usr/bin/env ruby require "test/unit" require File.dirname(__FILE__) + "/../lib/robots" module Kernel alias_method :open_old, :open def set_open(key, value) @fake_open_values ||= {} @fake_open_values[key] = value end def open(*args) @fake_open_values ||= {} @fake_open_values[args.first] || open_old(*args) end end class TestRobots < Test::Unit::TestCase def setup @robots = Robots.new "Ruby-Robot.txt Parser Test Script" end def test_allowed_if_no_robots assert @robots.allowed?("http://www.yahoo.com") end def test_reddit assert @robots.allowed?("http://reddit.com") end def test_other assert @robots.allowed?("http://www.yelp.com/foo") assert !@robots.allowed?("http://www.yelp.com/mail?foo=bar") end def test_site_with_disallowed assert @robots.allowed?("http://www.google.com/") end def test_other_values sitemap = {"Sitemap" => ["http://www.eventbrite.com/sitemap_index.xml", "http://www.eventbrite.com/sitemap_index.xml"]} assert_equal(sitemap, @robots.other_values("http://eventbrite.com")) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
robots-0.8.0 | test/test_robots.rb |