Skip to content

Commit c6f2da5

Browse files
committed
add memory test [no ci]
1 parent aa2ae6a commit c6f2da5

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

memory_test.rb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
$:.push File.expand_path("../lib", __FILE__)
2+
require 'webmachine'
3+
4+
class Constantized < Webmachine::Resource
5+
HELLO_WORLD = "Hello World".freeze
6+
ALLOWED_METHODS = [Webmachine::GET_METHOD].freeze
7+
CONTENT_TYPES_PROVIDED = [[Webmachine::TEXT_HTML, :to_html]].freeze
8+
9+
def allowed_methods
10+
ALLOWED_METHODS
11+
end
12+
13+
def content_types_provided
14+
CONTENT_TYPES_PROVIDED
15+
end
16+
17+
def to_html
18+
HELLO_WORLD
19+
end
20+
end
21+
22+
Webmachine.application.routes do
23+
add ['constantized'], Constantized
24+
end
25+
26+
require 'webmachine/test'
27+
session = Webmachine::Test::Session.new(Webmachine.application)
28+
29+
require 'memory_profiler'
30+
report = MemoryProfiler.report do
31+
session.get('/constantized')
32+
end
33+
34+
report.pretty_print
35+

0 commit comments

Comments
 (0)