roda 2.20.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/Rakefile +4 -3
- data/doc/release_notes/2.21.0.txt +17 -0
- data/lib/roda/plugins/assets.rb +1 -1
- data/lib/roda/plugins/indifferent_params.rb +2 -0
- data/lib/roda/plugins/static_routing.rb +0 -1
- data/lib/roda/plugins/streaming.rb +29 -1
- data/lib/roda/version.rb +1 -1
- data/spec/integration_spec.rb +1 -1
- data/spec/plugin/caching_spec.rb +4 -4
- data/spec/plugin/chunked_spec.rb +4 -3
- data/spec/plugin/delay_build_spec.rb +1 -1
- data/spec/plugin/drop_body_spec.rb +2 -2
- data/spec/plugin/error_handler_spec.rb +1 -1
- data/spec/plugin/hooks_spec.rb +1 -1
- data/spec/plugin/mailer_spec.rb +2 -2
- data/spec/plugin/not_found_spec.rb +1 -1
- data/spec/plugin/precompile_templates_spec.rb +4 -4
- data/spec/plugin/public_spec.rb +2 -2
- data/spec/plugin/render_spec.rb +5 -5
- data/spec/plugin/sinatra_helpers_spec.rb +1 -1
- data/spec/plugin/status_handler_spec.rb +1 -1
- data/spec/plugin/streaming_spec.rb +69 -0
- data/spec/plugin/type_routing_spec.rb +0 -1
- data/spec/plugin/unescape_path_spec.rb +1 -1
- data/spec/plugin_spec.rb +1 -1
- data/spec/response_spec.rb +5 -5
- data/spec/spec_helper.rb +5 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e6b3cac6d9da3a5df41af141588ad921d4708d8
|
4
|
+
data.tar.gz: 345a82534b2994081e0fde6e7e9552d1d28af295
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44fa6264003e578c1d694737d9658d9b78a7d26274542ddc1fe8057e42684cd2f6dae884cccda81ddcebf0e76310f3ee9b5f283fe48cafd4c5256bb529b0a0b7
|
7
|
+
data.tar.gz: d3b536a7846bd36832d58968192f2bc031215dae669eb09b8351d135aa3ccaffa195032dd429315d40b564c5b61f1e9540678637c6ef57db351e9a8b1c5cfc3c
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
= 2.21.0 (2016-12-16)
|
2
|
+
|
3
|
+
* Add handle_stream_error method to streaming plugin, for handling errors when using stream(:loop=>true) (jeremyevans)
|
4
|
+
|
1
5
|
= 2.20.0 (2016-11-13)
|
2
6
|
|
3
7
|
* Support :escape=>:erubi option in the render plugin to use the erubi template engine (jeremyevans)
|
data/Rakefile
CHANGED
@@ -86,9 +86,10 @@ end
|
|
86
86
|
|
87
87
|
desc "Run specs with -w, some warnings filtered"
|
88
88
|
task "spec_w" do
|
89
|
-
|
90
|
-
|
91
|
-
|
89
|
+
rubyopt = ENV['RUBYOPT']
|
90
|
+
ENV['RUBYOPT'] = "#{rubyopt} -w"
|
91
|
+
spec.call('WARNING'=>'1')
|
92
|
+
ENV['RUBYOPT'] = rubyopt
|
92
93
|
end
|
93
94
|
|
94
95
|
### Other
|
@@ -0,0 +1,17 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* The streaming plugin now supports a handle_stream_error method to
|
4
|
+
handle exceptions when using stream(:loop=>true). This method
|
5
|
+
takes the exception and the stream object, and can be used to log
|
6
|
+
errors, output errors into the stream, close the stream, ignore
|
7
|
+
errors, or any other error handling.
|
8
|
+
|
9
|
+
= Other Improvements
|
10
|
+
|
11
|
+
* A couple of unused variable assignments have been removed, providing
|
12
|
+
a minor speedup.
|
13
|
+
|
14
|
+
* The specs no longer produce deprecation warnings when using Minitest
|
15
|
+
5.10.
|
16
|
+
|
17
|
+
* Some verbose warnings have been removed from the specs.
|
data/lib/roda/plugins/assets.rb
CHANGED
@@ -616,7 +616,7 @@ class Roda
|
|
616
616
|
|
617
617
|
url_prefix = request.script_name if self.class.opts[:add_script_name]
|
618
618
|
|
619
|
-
if
|
619
|
+
if o[:compiled]
|
620
620
|
if ukey = _compiled_assets_hash(type, true)
|
621
621
|
["#{o[:compiled_asset_host]}#{url_prefix}/#{o[:"compiled_#{stype}_prefix"]}.#{ukey}.#{stype}"]
|
622
622
|
else
|
@@ -35,6 +35,7 @@ class Roda
|
|
35
35
|
INDIFFERENT_PROC = lambda{|h,k| h[k.to_s] if k.is_a?(Symbol)}
|
36
36
|
|
37
37
|
if Rack.release > '2'
|
38
|
+
# :nocov:
|
38
39
|
class QueryParser < Rack::QueryParser
|
39
40
|
# Work around for invalid optimization in rack
|
40
41
|
def parse_nested_query(qs, d=nil)
|
@@ -65,6 +66,7 @@ class Roda
|
|
65
66
|
@_request.params
|
66
67
|
end
|
67
68
|
end
|
69
|
+
# :nocov:
|
68
70
|
else
|
69
71
|
module InstanceMethods
|
70
72
|
# A copy of the request params that will automatically
|
@@ -106,7 +106,6 @@ class Roda
|
|
106
106
|
# instead having the routing tree handle the request.
|
107
107
|
def call
|
108
108
|
r = @_request
|
109
|
-
path_info = r.env['PATH_INFO']
|
110
109
|
if route = self.class.static_route_for(r.request_method, r.path_info)
|
111
110
|
catch(:halt){r.static_route(&route)}
|
112
111
|
else
|
@@ -26,6 +26,25 @@ class Roda
|
|
26
26
|
# :loop :: Whether to call the stream block continuously until
|
27
27
|
# the connection is closed.
|
28
28
|
#
|
29
|
+
# If the :loop option is used, you can override the
|
30
|
+
# handle_stream_error method to change how exceptions
|
31
|
+
# are handled during streaming. This method is passed the
|
32
|
+
# exception and the stream. By default, this method
|
33
|
+
# just reraises the exception, but you can choose to output
|
34
|
+
# the an error message to the stream, before raising:
|
35
|
+
#
|
36
|
+
# def handle_stream_error(e, out)
|
37
|
+
# out << 'ERROR!'
|
38
|
+
# raise e
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
# Ignore errors completely while streaming:
|
42
|
+
#
|
43
|
+
# def handle_stream_error(e, out)
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# or handle the errors in some other way.
|
47
|
+
#
|
29
48
|
# The implementation was originally taken from Sinatra,
|
30
49
|
# which is also released under the MIT License:
|
31
50
|
#
|
@@ -159,13 +178,22 @@ class Roda
|
|
159
178
|
if opts[:loop]
|
160
179
|
block = proc do |out|
|
161
180
|
until out.closed?
|
162
|
-
|
181
|
+
begin
|
182
|
+
yield(out)
|
183
|
+
rescue => e
|
184
|
+
handle_stream_error(e, out)
|
185
|
+
end
|
163
186
|
end
|
164
187
|
end
|
165
188
|
end
|
166
189
|
|
167
190
|
throw :halt, @_response.finish_with_body(Stream.new(opts, &block))
|
168
191
|
end
|
192
|
+
|
193
|
+
# Handle exceptions raised while streaming when using :loop
|
194
|
+
def handle_stream_error(e, out)
|
195
|
+
raise e
|
196
|
+
end
|
169
197
|
end
|
170
198
|
end
|
171
199
|
|
data/lib/roda/version.rb
CHANGED
data/spec/integration_spec.rb
CHANGED
@@ -174,7 +174,7 @@ describe "integration" do
|
|
174
174
|
end
|
175
175
|
|
176
176
|
it "should have app return the rack application to call" do
|
177
|
-
app(:bare){}.app.
|
177
|
+
app(:bare){}.app.must_be_nil
|
178
178
|
app.route{|r|}
|
179
179
|
app.app.must_be_kind_of(Proc)
|
180
180
|
c = Class.new{def initialize(app) @app = app end; def call(env) @app.call(env) end}
|
data/spec/plugin/caching_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe 'response.cache_control' do
|
|
12
12
|
app(:caching) do |r|
|
13
13
|
response.cache_control({})
|
14
14
|
end
|
15
|
-
header('Cache-Control').
|
15
|
+
header('Cache-Control').must_be_nil
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -39,8 +39,8 @@ describe 'response.finish' do
|
|
39
39
|
app(:caching) do |r|
|
40
40
|
response.status = 304
|
41
41
|
end
|
42
|
-
header('Content-Type').
|
43
|
-
header('Content-Length').
|
42
|
+
header('Content-Type').must_be_nil
|
43
|
+
header('Content-Length').must_be_nil
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'does not change non-304 responses' do
|
@@ -57,7 +57,7 @@ describe 'request.last_modified' do
|
|
57
57
|
app(:caching) do |r|
|
58
58
|
r.last_modified nil
|
59
59
|
end
|
60
|
-
header('Last-Modified').
|
60
|
+
header('Last-Modified').must_be_nil
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'does not change a status other than 200' do
|
data/spec/plugin/chunked_spec.rb
CHANGED
@@ -31,6 +31,7 @@ describe "chunked plugin" do
|
|
31
31
|
|
32
32
|
it "accepts a block that is called after layout yielding but before content when streaming" do
|
33
33
|
app(:chunked) do |r|
|
34
|
+
@h = nil
|
34
35
|
chunked(:inline=>'m<%= @h %>', :layout=>{:inline=>'<%= @h %><%= yield %>t'}) do
|
35
36
|
@h = 'h'
|
36
37
|
end
|
@@ -113,7 +114,7 @@ describe "chunked plugin" do
|
|
113
114
|
response.write chunked(:inline=>'m', :layout=>{:inline=>'h<%= yield %>t'})
|
114
115
|
end
|
115
116
|
|
116
|
-
header('Content-Length', 'HTTP_VERSION'=>'HTTP/1.1').
|
117
|
+
header('Content-Length', 'HTTP_VERSION'=>'HTTP/1.1').must_be_nil
|
117
118
|
header('Content-Length', 'HTTP_VERSION'=>'HTTP/1.0').must_equal '4'
|
118
119
|
end
|
119
120
|
|
@@ -135,7 +136,7 @@ describe "chunked plugin" do
|
|
135
136
|
end
|
136
137
|
|
137
138
|
header('Transfer-Encoding', 'HTTP_VERSION'=>'HTTP/1.1').must_equal 'chunked'
|
138
|
-
header('Transfer-Encoding', 'HTTP_VERSION'=>'HTTP/1.0').
|
139
|
+
header('Transfer-Encoding', 'HTTP_VERSION'=>'HTTP/1.0').must_be_nil
|
139
140
|
end
|
140
141
|
|
141
142
|
it "uses given :headers when chunking" do
|
@@ -147,7 +148,7 @@ describe "chunked plugin" do
|
|
147
148
|
end
|
148
149
|
|
149
150
|
header('Foo', 'HTTP_VERSION'=>'HTTP/1.1').must_equal 'bar'
|
150
|
-
header('Foo', 'HTTP_VERSION'=>'HTTP/1.0').
|
151
|
+
header('Foo', 'HTTP_VERSION'=>'HTTP/1.0').must_be_nil
|
151
152
|
end
|
152
153
|
|
153
154
|
it "handles multiple arguments to chunked" do
|
@@ -3,7 +3,7 @@ require File.expand_path("spec_helper", File.dirname(File.dirname(__FILE__)))
|
|
3
3
|
describe "delay_build plugin" do
|
4
4
|
it "does not build rack app until app is called" do
|
5
5
|
app(:delay_build){"a"}
|
6
|
-
app.instance_variable_get(:@app).
|
6
|
+
app.instance_variable_get(:@app).must_be_nil
|
7
7
|
body.must_equal "a"
|
8
8
|
# Work around minitest bug
|
9
9
|
refute_equal app.instance_variable_get(:@app), nil
|
@@ -9,8 +9,8 @@ describe "drop_body plugin" do
|
|
9
9
|
|
10
10
|
[101, 102, 204, 205, 304].each do |i|
|
11
11
|
body(i.to_s).must_equal ''
|
12
|
-
header('Content-Type', i.to_s).
|
13
|
-
header('Content-Length', i.to_s).
|
12
|
+
header('Content-Type', i.to_s).must_be_nil
|
13
|
+
header('Content-Length', i.to_s).must_be_nil
|
14
14
|
end
|
15
15
|
|
16
16
|
body('200').must_equal 'a'
|
data/spec/plugin/hooks_spec.rb
CHANGED
data/spec/plugin/mailer_spec.rb
CHANGED
@@ -16,7 +16,7 @@ describe "precompile_templates plugin" do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
app.render_opts[:cache][File.expand_path('spec/views/iv.erb')].
|
19
|
+
app.render_opts[:cache][File.expand_path('spec/views/iv.erb')].must_be_nil
|
20
20
|
app.precompile_templates 'spec/views/iv.erb'
|
21
21
|
app.render_opts[:cache][File.expand_path('spec/views/iv.erb')].wont_equal nil
|
22
22
|
app.render_opts[:cache][File.expand_path('spec/views/iv.erb')].instance_variable_get(:@compiled_method)[[]].wont_equal nil
|
@@ -32,7 +32,7 @@ describe "precompile_templates plugin" do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
app.render_opts[:cache][File.expand_path('spec/views/about.erb')].
|
35
|
+
app.render_opts[:cache][File.expand_path('spec/views/about.erb')].must_be_nil
|
36
36
|
app.precompile_templates 'spec/views/about.erb', :locals=>[:title]
|
37
37
|
app.render_opts[:cache][File.expand_path('spec/views/about.erb')].wont_equal nil
|
38
38
|
app.render_opts[:cache][File.expand_path('spec/views/about.erb')].instance_variable_get(:@compiled_method)[[:title]].wont_equal nil
|
@@ -48,7 +48,7 @@ describe "precompile_templates plugin" do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
app.render_opts[:cache][File.expand_path('spec/views/home.erb')].
|
51
|
+
app.render_opts[:cache][File.expand_path('spec/views/home.erb')].must_be_nil
|
52
52
|
app.precompile_templates 'spec/views/h*.erb', :locals=>[:title, :name]
|
53
53
|
app.render_opts[:cache][File.expand_path('spec/views/home.erb')].wont_equal nil
|
54
54
|
app.render_opts[:cache][File.expand_path('spec/views/home.erb')].instance_variable_get(:@compiled_method)[[:name, :title]].wont_equal nil
|
@@ -64,7 +64,7 @@ describe "precompile_templates plugin" do
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
app.render_opts[:cache]['a'].
|
67
|
+
app.render_opts[:cache]['a'].must_be_nil
|
68
68
|
app.precompile_templates :inline=>'a', :cache_key=>'a'
|
69
69
|
app.render_opts[:cache]['a'].wont_equal nil
|
70
70
|
app.render_opts[:cache]['a'].instance_variable_get(:@compiled_method)[[]].wont_equal nil
|
data/spec/plugin/public_spec.rb
CHANGED
@@ -43,10 +43,10 @@ describe "public plugin" do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
body('/about/_test.erb').must_equal File.read('spec/views/about/_test.erb')
|
46
|
-
header('Content-Encoding', '/about/_test.erb').
|
46
|
+
header('Content-Encoding', '/about/_test.erb').must_be_nil
|
47
47
|
|
48
48
|
body('/about.erb').must_equal File.read('spec/views/about.erb')
|
49
|
-
header('Content-Encoding', '/about.erb').
|
49
|
+
header('Content-Encoding', '/about.erb').must_be_nil
|
50
50
|
|
51
51
|
meth = RUBY_VERSION >= '1.9' ? :binread : :read
|
52
52
|
body('/about/_test.erb', 'HTTP_ACCEPT_ENCODING'=>'deflate, gzip').must_equal File.send(meth, 'spec/views/about/_test.erb.gz')
|
data/spec/plugin/render_spec.rb
CHANGED
@@ -69,8 +69,6 @@ describe "render plugin" do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
describe "render plugin with :layout_opts=>{:merge_locals=>true}" do
|
72
|
-
h = {:a=>1, :b=>2, :c=>3, :d=>4}
|
73
|
-
|
74
72
|
before do
|
75
73
|
app(:bare) do
|
76
74
|
plugin :render, :views=>"./spec/views", :check_paths=>true, :locals=>{:a=>1, :b=>2, :c=>3, :d=>4, :e=>5}, :layout_opts=>{:inline=>'<%= a %>|<%= b %>|<%= c %>|<%= d %>|<%= e %>|<%= f %>|<%= yield %>', :merge_locals=>true, :locals=>{:a=>-1, :f=>6}}
|
@@ -269,6 +267,7 @@ describe "render plugin" do
|
|
269
267
|
app(:bare) do
|
270
268
|
plugin :render, :engine_opts=>{'a.erb'=>{:outvar=>'@a'}}
|
271
269
|
route do |r|
|
270
|
+
@a = nil
|
272
271
|
r.is('a') do
|
273
272
|
render(:inline=>'<%= @a.class.name %>', :engine=>'a.erb')
|
274
273
|
end
|
@@ -344,6 +343,7 @@ describe "render plugin" do
|
|
344
343
|
render(:inline=>template.dup, :locals=>{:b=>2, :c=>4})
|
345
344
|
end
|
346
345
|
r.is "c" do
|
346
|
+
@a = nil
|
347
347
|
render(:inline=>template.dup, :locals=>{:c=>3})
|
348
348
|
end
|
349
349
|
end
|
@@ -357,7 +357,7 @@ describe "render plugin" do
|
|
357
357
|
with_rack_env('development') do
|
358
358
|
app(:render){}
|
359
359
|
end
|
360
|
-
app.render_opts[:cache].
|
360
|
+
app.render_opts[:cache].must_be_nil
|
361
361
|
app(:render){}
|
362
362
|
app.render_opts[:cache].wont_equal nil
|
363
363
|
end
|
@@ -374,7 +374,7 @@ describe "render plugin" do
|
|
374
374
|
end
|
375
375
|
|
376
376
|
body('/a').strip.must_equal "a"
|
377
|
-
app.render_opts[:cache][File.expand_path('spec/views/iv.erb')].
|
377
|
+
app.render_opts[:cache][File.expand_path('spec/views/iv.erb')].must_be_nil
|
378
378
|
body('/b').strip.must_equal "a"
|
379
379
|
app.render_opts[:cache][File.expand_path('spec/views/iv.erb')].wont_equal nil
|
380
380
|
end
|
@@ -403,7 +403,7 @@ describe "render plugin" do
|
|
403
403
|
end
|
404
404
|
|
405
405
|
body('/a').strip.must_equal "iv-a"
|
406
|
-
app.render_opts[:cache][['iv', c, nil, nil, proca]].
|
406
|
+
app.render_opts[:cache][['iv', c, nil, nil, proca]].must_be_nil
|
407
407
|
body('/b').strip.must_equal "iv-a"
|
408
408
|
app.render_opts[:cache][['iv', c, nil, nil, proca]].wont_equal nil
|
409
409
|
end
|
@@ -378,7 +378,7 @@ describe "sinatra_helpers plugin" do
|
|
378
378
|
end
|
379
379
|
|
380
380
|
it "does not set the Content-Disposition header by default" do
|
381
|
-
header('Content-Disposition').
|
381
|
+
header('Content-Disposition').must_be_nil
|
382
382
|
end
|
383
383
|
|
384
384
|
it "sets the Content-Disposition header when :disposition set to 'attachment'" do
|
@@ -49,4 +49,73 @@ describe "streaming plugin" do
|
|
49
49
|
proc{b.each{|v| a << v}}.must_raise(Roda::RodaError)
|
50
50
|
a.must_equal %w'a b e d'
|
51
51
|
end
|
52
|
+
|
53
|
+
it "uses handle_stream_error for handling errors when streaming" do
|
54
|
+
a = []
|
55
|
+
app(:streaming) do |r|
|
56
|
+
b = %w'a b c'
|
57
|
+
stream(:loop=>true, :callback=>proc{a << 'e'}) do |out|
|
58
|
+
out << b.shift
|
59
|
+
raise Roda::RodaError, 'foo' if b.length == 1
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
app.send(:define_method, :handle_stream_error) do |error, out|
|
64
|
+
out << '1'
|
65
|
+
raise error
|
66
|
+
end
|
67
|
+
|
68
|
+
s, h, b = req
|
69
|
+
s.must_equal 200
|
70
|
+
h.must_equal('Content-Type'=>'text/html')
|
71
|
+
b.callback{a << 'd'}
|
72
|
+
proc{b.each{|v| a << v}}.must_raise(Roda::RodaError)
|
73
|
+
a.must_equal %w'a b 1 e d'
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should allow closing the stream when handling an error" do
|
77
|
+
a = []
|
78
|
+
app(:streaming) do |r|
|
79
|
+
b = %w'a b c'
|
80
|
+
stream(:loop=>true, :callback=>proc{a << 'e'}) do |out|
|
81
|
+
out << b.shift
|
82
|
+
raise Roda::RodaError, 'foo' if b.length == 1
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
app.send(:define_method, :handle_stream_error) do |error, out|
|
87
|
+
out.close
|
88
|
+
end
|
89
|
+
|
90
|
+
s, h, b = req
|
91
|
+
s.must_equal 200
|
92
|
+
h.must_equal('Content-Type'=>'text/html')
|
93
|
+
b.callback{a << 'd'}
|
94
|
+
b.each{|v| a << v}
|
95
|
+
a.must_equal %w'a b e d'
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should allow ignoring errors when streaming" do
|
99
|
+
a = []
|
100
|
+
b2 = %w'a b c'
|
101
|
+
|
102
|
+
app(:streaming) do |r|
|
103
|
+
stream(:loop=>true, :callback=>proc{a << 'e'}) do |out|
|
104
|
+
out << b2.shift
|
105
|
+
raise Roda::RodaError
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
app.send(:define_method, :handle_stream_error) do |error, out|
|
110
|
+
out << '1'
|
111
|
+
out.close if b2.empty?
|
112
|
+
end
|
113
|
+
|
114
|
+
s, h, b = req
|
115
|
+
s.must_equal 200
|
116
|
+
h.must_equal('Content-Type'=>'text/html')
|
117
|
+
b.callback{a << 'd'}
|
118
|
+
b.each{|v| a << v}
|
119
|
+
a.must_equal %w'a 1 b 1 c 1 e d'
|
120
|
+
end
|
52
121
|
end
|
data/spec/plugin_spec.rb
CHANGED
data/spec/response_spec.rb
CHANGED
@@ -58,7 +58,7 @@ describe "response #finish" do
|
|
58
58
|
it "should set Content-Length header" do
|
59
59
|
app do |r|
|
60
60
|
response.write 'a'
|
61
|
-
response['Content-Length'].
|
61
|
+
response['Content-Length'].must_be_nil
|
62
62
|
throw :halt, response.finish
|
63
63
|
end
|
64
64
|
|
@@ -71,8 +71,8 @@ describe "response #finish" do
|
|
71
71
|
throw :halt, response.finish
|
72
72
|
end
|
73
73
|
|
74
|
-
header('Content-Type').
|
75
|
-
header('Content-Length').
|
74
|
+
header('Content-Type').must_be_nil
|
75
|
+
header('Content-Length').must_be_nil
|
76
76
|
end
|
77
77
|
|
78
78
|
it "should not overwrite existing status" do
|
@@ -106,11 +106,11 @@ describe "response #finish_with_body" do
|
|
106
106
|
it "should not set Content-Length header" do
|
107
107
|
app do |r|
|
108
108
|
response.write 'a'
|
109
|
-
response['Content-Length'].
|
109
|
+
response['Content-Length'].must_be_nil
|
110
110
|
throw :halt, response.finish_with_body(['123'])
|
111
111
|
end
|
112
112
|
|
113
|
-
header('Content-Length').
|
113
|
+
header('Content-Length').must_be_nil
|
114
114
|
end
|
115
115
|
|
116
116
|
it "should not overwrite existing status" do
|
data/spec/spec_helper.rb
CHANGED
@@ -2,6 +2,11 @@ $:.unshift(File.expand_path("../lib", File.dirname(__FILE__)))
|
|
2
2
|
|
3
3
|
require "rubygems"
|
4
4
|
|
5
|
+
if ENV['WARNING']
|
6
|
+
require 'warning'
|
7
|
+
Warning.ignore([:missing_ivar, :method_redefined, :not_reached], File.dirname(File.dirname(__FILE__)))
|
8
|
+
end
|
9
|
+
|
5
10
|
if ENV['COVERAGE']
|
6
11
|
require 'coverage'
|
7
12
|
require 'simplecov'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -200,6 +200,7 @@ extra_rdoc_files:
|
|
200
200
|
- doc/release_notes/2.18.0.txt
|
201
201
|
- doc/release_notes/2.19.0.txt
|
202
202
|
- doc/release_notes/2.20.0.txt
|
203
|
+
- doc/release_notes/2.21.0.txt
|
203
204
|
files:
|
204
205
|
- CHANGELOG
|
205
206
|
- MIT-LICENSE
|
@@ -224,6 +225,7 @@ files:
|
|
224
225
|
- doc/release_notes/2.19.0.txt
|
225
226
|
- doc/release_notes/2.2.0.txt
|
226
227
|
- doc/release_notes/2.20.0.txt
|
228
|
+
- doc/release_notes/2.21.0.txt
|
227
229
|
- doc/release_notes/2.3.0.txt
|
228
230
|
- doc/release_notes/2.4.0.txt
|
229
231
|
- doc/release_notes/2.5.0.txt
|
@@ -438,7 +440,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
438
440
|
version: '0'
|
439
441
|
requirements: []
|
440
442
|
rubyforge_project:
|
441
|
-
rubygems_version: 2.
|
443
|
+
rubygems_version: 2.5.2
|
442
444
|
signing_key:
|
443
445
|
specification_version: 4
|
444
446
|
summary: Routing tree web toolkit
|