Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding: utf-8
- require 'test_helper'
- class TestGoogleDoodler < Test::Unit::TestCase
- def doodlestring_herausfilten(doc)
- # coding: utf-8
- exists = 0
- subject = doc.at_css("div#lga") #.at_css("function")#['function'] #"lga" ist eine id
- subject2 = subject.to_s.split('search?q=')
- if subject2[1].nil?
- subject = "Kein Doodle"
- else
- querystring_mitplus = subject2[1].split('&')[0] #ct=')[0]
- subject = querystring_mitplus.gsub(/\+/, " ")
- end
- end
- def test_google_mit_roentgenstrahlung_crawlen
- require 'rubygems'
- require 'nokogiri'
- require 'open-uri'
- doc = Nokogiri::HTML(File.open("/Users/google-doodle/test/roentgenstrahlung.html"))
- assert_equal "Röntgenstrahlung", doodlestring_herausfilten(doc)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement