fix bug when path was nil

This commit is contained in:
John Bintz 2011-12-02 06:58:06 -05:00
parent 090e2c0811
commit 5166ae2c26
2 changed files with 15 additions and 4 deletions

View File

@ -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

View File

@ -135,12 +135,23 @@ 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' } }
context 'not root' do
let(:env) { { 'PATH_INFO' => '/this/file' } }
it 'should have no change' do it 'should have no change' do
body.should_not include('script') body.should_not include('script')
end end
end end
context 'root' do
let(:env) { { 'PATH_INFO' => '/' } }
it 'should have script' do
body.should include('script')
end
end
end
end end
context '/__rack/livereload.js' do context '/__rack/livereload.js' do