forked from webmachine/webmachine-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmemory_test.rb
More file actions
37 lines (29 loc) · 756 Bytes
/
memory_test.rb
File metadata and controls
37 lines (29 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
$:.push File.expand_path("../lib", __FILE__)
require 'webmachine'
class Constantized < Webmachine::Resource
HELLO_WORLD = "Hello World".freeze
ALLOWED_METHODS = ['GET'.freeze].freeze
CONTENT_TYPES_PROVIDED = [['text/html'.freeze, :to_html].freeze].freeze
def allowed_methods
ALLOWED_METHODS
end
def content_types_provided
CONTENT_TYPES_PROVIDED
end
def to_html
HELLO_WORLD
end
end
Webmachine.application.routes do
add ['constantized'], Constantized
end
require 'webmachine/test'
session = Webmachine::Test::Session.new(Webmachine.application)
CONSTANTIZED = '/constantized'.freeze
require 'memory_profiler'
report = MemoryProfiler.report do
100.times do
session.get(CONSTANTIZED)
end
end
report.pretty_print