fix bug when path was nil
This commit is contained in:
parent
090e2c0811
commit
5166ae2c26
|
@ -48,7 +48,7 @@ module Rack
|
||||||
else
|
else
|
||||||
status, headers, body = @app.call(env)
|
status, headers, body = @app.call(env)
|
||||||
|
|
||||||
if !@options[:ignore] || !@options[:ignore].any? { |filter| path[filter] }
|
if !@options[:ignore] || !@options[:ignore].any? { |filter| env['PATH_INFO'][filter] }
|
||||||
case headers['Content-Type']
|
case headers['Content-Type']
|
||||||
when %r{text/html}
|
when %r{text/html}
|
||||||
content_length = 0
|
content_length = 0
|
||||||
|
|
|
@ -135,10 +135,21 @@ describe Rack::LiveReload do
|
||||||
|
|
||||||
context 'ignored' do
|
context 'ignored' do
|
||||||
let(:options) { { :ignore => [ %r{file} ] } }
|
let(:options) { { :ignore => [ %r{file} ] } }
|
||||||
let(:env) { { 'PATH_INFO' => 'this/file' } }
|
|
||||||
|
|
||||||
it 'should have no change' do
|
context 'not root' do
|
||||||
body.should_not include('script')
|
let(:env) { { 'PATH_INFO' => '/this/file' } }
|
||||||
|
|
||||||
|
it 'should have no change' do
|
||||||
|
body.should_not include('script')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'root' do
|
||||||
|
let(:env) { { 'PATH_INFO' => '/' } }
|
||||||
|
|
||||||
|
it 'should have script' do
|
||||||
|
body.should include('script')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue