@@ -35,6 +35,14 @@ def get_non_caching(on_off = 'on'.freeze)
35
35
get ( "/non_caching/#{ on_off } " )
36
36
end
37
37
38
+ def debug ( msg = '' )
39
+ if block_given? && ENV [ 'DEBUG' ] =~ /\A true|on|0\z /i
40
+ STDERR . puts yield
41
+ else
42
+ STDERR . puts msg
43
+ end
44
+ end
45
+
38
46
private
39
47
40
48
def assert_responses ( caching , non_caching )
@@ -85,33 +93,21 @@ def assert_equal(expected, actual, message)
85
93
STDERR . puts message unless ENV [ 'SUMMARIZE' ]
86
94
end
87
95
end
88
-
89
- def debug ( msg = '' )
90
- if block_given? && ENV [ 'DEBUG' ] =~ /\A true|on|0\z /i
91
- STDERR . puts yield
92
- else
93
- STDERR . puts msg
94
- end
95
- end
96
96
end
97
97
assertion = ApiAssertion . new
98
98
assertion . valid?
99
- # STDERR.puts assertion.get_status
99
+ assertion . debug { assertion . get_status }
100
100
101
101
time = 10
102
102
{
103
103
'caching on: caching serializers: gc off' => { disable_gc : true , send : [ :get_caching , 'on' ] } ,
104
- # 'caching on: caching serializers: gc on' => { disable_gc: false, send: [:get_caching, 'on'] },
105
- 'caching off: caching serializers: gc off' => { disable_gc : true , send : [ :get_caching , 'off' ] } ,
106
- # 'caching off: caching serializers: gc on' => { disable_gc: false, send: [:get_caching, 'off'] },
107
104
'caching on: non-caching serializers: gc off' => { disable_gc : true , send : [ :get_non_caching , 'on' ] } ,
108
- # 'caching on: non- caching serializers: gc on ' => { disable_gc: false , send: [:get_non_caching , 'on '] },
105
+ 'caching off: caching serializers: gc off ' => { disable_gc : true , send : [ :get_caching , 'off ' ] } ,
109
106
'caching off: non-caching serializers: gc off' => { disable_gc : true , send : [ :get_non_caching , 'off' ] }
110
- # 'caching off: non-caching serializers: gc on' => { disable_gc: false, send: [:get_non_caching, 'off'] }
111
107
} . each do |label , options |
112
108
assertion . clear
113
109
Benchmark . ams ( label , time : time , disable_gc : options [ :disable_gc ] ) do
114
110
assertion . send ( *options [ :send ] )
115
111
end
116
- # STDERR.puts assertion.get_status(options[:send][-1])
112
+ assertion . debug { assertion . get_status ( options [ :send ] [ -1 ] ) }
117
113
end
0 commit comments