Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

quick refacotring

  • Loading branch information...
commit 9552ae9894eda2104674647ff414f62df970c7b9 1 parent 5a40d78
@jamesgolick authored
Showing with 10 additions and 7 deletions.
  1. +10 −7 lib/trample/session.rb
View
17 lib/trample/session.rb
@@ -14,21 +14,24 @@ def initialize(config)
def trample
@config.iterations.times do
@config.pages.each do |p|
- request p
+ hit p
end
end
end
protected
+ def hit(page)
+ response_times << request(page)
+ # this is ugly, but it's the only way that I could get the test to pass
+ # because rr keeps a reference to the arguments, not a copy. ah well.
+ @cookies = cookies.merge(last_response.cookies)
+ logger.info "#{page.request_method.to_s.upcase} #{page.url} #{response_times.last}s"
+ end
+
def request(page)
- length = time do
+ time do
@last_response = RestClient.send(page.request_method, page.url, :cookies => cookies)
- # this is ugly, but it's the only way that I could get the test to pass
- # because rr keeps a reference to the arguments, not a copy. ah well.
end
- @cookies = cookies.merge(last_response.cookies)
- response_times << length
- logger.info "#{page.request_method.to_s.upcase} #{page.url} #{length}s"
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.