parse fullpath for ignore #50

Merged
rjocoleman merged 1 commits from ignore_fullpath into master 2015-07-03 13:24:47 +00:00
2 changed files with 12 additions and 4 deletions

View File

@ -28,7 +28,8 @@ module Rack
end end
def ignored? def ignored?
@options[:ignore] and @options[:ignore].any? { |filter| @env['PATH_INFO'][filter] } path = @env['QUERY_STRING'].empty? ? @env['PATH_INFO'] : "#{@env['PATH_INFO']}?#{@env['QUERY_STRING']}"
@options[:ignore] and @options[:ignore].any? { |filter| path[filter] }
end end
def bad_browser? def bad_browser?

View File

@ -22,13 +22,13 @@ describe Rack::LiveReload::ProcessingSkipAnalyzer do
let(:options) { { :ignore => [ %r{file} ] } } let(:options) { { :ignore => [ %r{file} ] } }
context 'path contains ignore pattern' do context 'path contains ignore pattern' do
let(:env) { { 'PATH_INFO' => '/this/file' } } let(:env) { { 'PATH_INFO' => '/this/file', 'QUERY_STRING' => '' } }
it { should be_ignored } it { should be_ignored }
end end
context 'root path' do context 'root path' do
let(:env) { { 'PATH_INFO' => '/' } } let(:env) { { 'PATH_INFO' => '/', 'QUERY_STRING' => '' } }
it { should_not be_ignored } it { should_not be_ignored }
end end
@ -56,7 +56,8 @@ describe Rack::LiveReload::ProcessingSkipAnalyzer do
describe '#ignored?' do describe '#ignored?' do
let(:path_info) { 'path info' } let(:path_info) { 'path info' }
let(:env) { { 'PATH_INFO' => path_info } } let(:query_string) { 'query_string' }
let(:env) { { 'PATH_INFO' => path_info, 'QUERY_STRING' => query_string } }
context 'no ignore set' do context 'no ignore set' do
it { should_not be_ignored } it { should_not be_ignored }
@ -67,6 +68,12 @@ describe Rack::LiveReload::ProcessingSkipAnalyzer do
it { should be_ignored } it { should be_ignored }
end end
context 'ignore set including query_string' do
let(:options) { { :ignore => [ %r{#{path_info}\?#{query_string}} ] } }
it { should be_ignored }
end
end end
describe '#bad_browser?' do describe '#bad_browser?' do