diff --git a/lib/rack/livereload.rb b/lib/rack/livereload.rb index 85605a9..1f6837a 100644 --- a/lib/rack/livereload.rb +++ b/lib/rack/livereload.rb @@ -48,7 +48,7 @@ module Rack else 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'] when %r{text/html} content_length = 0 diff --git a/spec/rack/livereload_spec.rb b/spec/rack/livereload_spec.rb index ee0cbff..e36e154 100644 --- a/spec/rack/livereload_spec.rb +++ b/spec/rack/livereload_spec.rb @@ -135,10 +135,21 @@ describe Rack::LiveReload do context 'ignored' do let(:options) { { :ignore => [ %r{file} ] } } - let(:env) { { 'PATH_INFO' => 'this/file' } } - it 'should have no change' do - body.should_not include('script') + context 'not root' do + 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