or rather reading open source code in general
# rails/actionpack/lib/action_dispatch/testing/integration.rb
%w(get post patch put head delete cookies assigns
xml_http_request xhr get_via_redirect post_via_redirect).each do |method|
define_method(method) do |*args|
# reset the html_document variable, except for cookies/assigns calls
unless method == 'cookies' || method == 'assigns'
@html_document = nil
reset_template_assertion
end
integration_session.__send__(method, *args).tap do
copy_session_variables!
end
end
end
class UserFlowTest < ActionDispatch::IntegrationTest
def test_index
RubyProf.start
get '/users'
result = RubyProf.stop
File.open "a.html", 'w' do |file|
RubyProf::GraphHtmlPrinter.new(result).print(file)
end
assert_equal 200, response.status
end
end
https://github.com/ruby/ruby/tree/trunk/benchmark
https://github.com/discourse/discourse/blob/master/script/bench.rb