lib/buildmaster/site_tester.rb in BuildMaster-0.7.0 vs lib/buildmaster/site_tester.rb in BuildMaster-0.8.0
- old
+ new
@@ -1,9 +1,10 @@
module BuildMaster
require 'watir'
require 'set'
+require 'uri'
class SiteTester
URL_PATTERN = /^https?\:\/\/([^\/]*)/
def SiteTester.test(url)
@@ -42,18 +43,29 @@
url =~ URL_PATTERN
return $1
end
def check_page
- if (@visited_pages.include?(@ie.url))
+ if (url_visited?(@ie.url))
return
end
- @visited_pages.add(@ie.url)
check_links
errors = @errors[@ie.url]
if (errors && errors.length > 0)
report(@ie.url, errors)
end
+ end
+
+ def url_visited?(url)
+ index = url.index('#')
+ if (index)
+ url = url[0, index]
+ end
+ if (@visited_pages.include?(url))
+ return true
+ end
+ @visited_pages.add(url)
+ return false
end
def check_links
current = @ie.url
@ie.links.each do |link|
\ No newline at end of file