Skip to content

Instantly share code, notes, and snippets.

@kennethkalmer
Created April 16, 2009 14:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kennethkalmer/96446 to your computer and use it in GitHub Desktop.
Save kennethkalmer/96446 to your computer and use it in GitHub Desktop.
Automate scrap testing your Rails app
require 'rubygems'
require 'mechanize'
agent = WWW::Mechanize.new
puts "Memory Usage Delta "
puts "============ ========"
loop do
agent.get('http://172.16.133.100:3000/session/new')
scrap = agent.get('http://172.16.133.100:3000/stats/scrap')
usage = scrap.search('/html/body/table/tr/td[2]').first.content
delta = scrap.search('/html/body/table/tr[2]/td[2]').first.content
puts "#{usage.rjust(12, ' ')} #{delta.rjust(8, ' ')}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment