-
-
Save will-in-wi/9f167d21877d6a5b8bd7 to your computer and use it in GitHub Desktop.
Compare pages for testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'colorize' | |
require 'net/http' | |
require 'uri' | |
require 'digest' | |
oldDomain = 'http://classicalmusicinitiative.publicradio.org' | |
newDomain = 'http://classicalmusicinitiative.hqwebdev01.publicradio.org' | |
pages = [ | |
'/', | |
'/fund/', | |
'/workshops/', | |
'/radio_partnerships/', | |
'/production/', | |
] | |
def comparePage(old_url, new_url) | |
puts 'Comparing ' + old_url + ' and ' + new_url | |
old_page = Net::HTTP.get_response(URI(old_url)) | |
old_output_hash = Digest::MD5.hexdigest(old_page.body) | |
# old_page.status_code = old_page.code | |
new_page = Net::HTTP.get_response(URI(new_url)) | |
new_output_hash = Digest::MD5.hexdigest(new_page.body) | |
# new_page.status_code = new_page.code | |
if new_output_hash == old_output_hash | |
puts 'Body is same'.green | |
else | |
puts 'Body is different'.red | |
end | |
puts | |
end | |
pages.each do |page| | |
comparePage(oldDomain + page, newDomain + page) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment