Sha256: a5e3a89126d3bf9231b00945c966bec5c1131aff25167e11031971c79c73d7c8
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
require 'spec_helper' describe Rack::LiveReload::ProcessingSkipAnalyzer do subject { described_class.new(result, env, options) } let(:result) { [ status, headers, body ] } let(:env) { { 'HTTP_USER_AGENT' => user_agent } } let(:options) { {} } let(:user_agent) { 'Firefox' } let(:status) { 200 } let(:headers) { {} } let(:body) { [] } describe '#skip_processing?' do it "should skip processing" do subject.skip_processing?.should be_true end end describe '#bad_browser?' do let(:user_agent) { described_class::BAD_USER_AGENTS.first.source } it { should be_bad_browser } end context 'ignored' do let(:options) { { :ignore => [ %r{file} ] } } context 'not root' do let(:env) { { 'PATH_INFO' => '/this/file' } } it { should be_ignored } end context 'root' do let(:env) { { 'PATH_INFO' => '/' } } it { should_not be_ignored } end end context 'not text/html' do let(:headers) { { 'Content-Type' => 'application/pdf' } } it { should_not be_html } end context 'chunked response' do let(:headers) { { 'Transfer-Encoding' => 'chunked' } } it { should be_chunked } end context 'inline disposition' do let(:headers) { { 'Content-Disposition' => 'inline; filename=my_inlined_file' } } it { should be_inline } end describe '#ignored?' do let(:path_info) { 'path info' } let(:env) { { 'PATH_INFO' => path_info } } context 'no ignore set' do it { should_not be_ignored } end context 'ignore set' do let(:options) { { :ignore => [ %r{#{path_info}} ] } } it { should be_ignored } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rack-livereload-0.3.15 | spec/rack/livereload/processing_skip_analyzer_spec.rb |
rack-livereload-0.3.14 | spec/rack/livereload/processing_skip_analyzer_spec.rb |