diff --git a/lib/rack/livereload/body_processor.rb b/lib/rack/livereload/body_processor.rb index c5fc029..6b2e5ab 100644 --- a/lib/rack/livereload/body_processor.rb +++ b/lib/rack/livereload/body_processor.rb @@ -71,7 +71,7 @@ module Rack @new_body.each do |line| if !@livereload_added && line['").should be_false + regex.match("
").should be_falsey end end @@ -143,6 +143,14 @@ describe Rack::LiveReload::BodyProcessor do end end + context 'in document with more than one reference to a head tag' do + let(:page_html) { "" } + + it 'should not add the livereload js' do + processed_body.should include == "" + end + end + context 'not vendored' do before do processor.stubs(:use_vendored?).returns(false) diff --git a/spec/rack/livereload/processing_skip_analyzer_spec.rb b/spec/rack/livereload/processing_skip_analyzer_spec.rb index e1c856e..bc28426 100644 --- a/spec/rack/livereload/processing_skip_analyzer_spec.rb +++ b/spec/rack/livereload/processing_skip_analyzer_spec.rb @@ -14,7 +14,7 @@ describe Rack::LiveReload::ProcessingSkipAnalyzer do describe '#skip_processing?' do it "should skip processing" do - subject.skip_processing?.should be_true + subject.skip_processing?.should be_truthy end end diff --git a/spec/rack/livereload_spec.rb b/spec/rack/livereload_spec.rb index d955ab5..4eaa6ea 100644 --- a/spec/rack/livereload_spec.rb +++ b/spec/rack/livereload_spec.rb @@ -20,7 +20,7 @@ describe Rack::LiveReload do end it 'should return the js file' do - middleware._call(env).should be_true + middleware._call(env).should be_truthy end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d5e604a..06f4343 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,14 @@ require 'mocha/api' require 'webmock/rspec' +require 'rspec/its' require 'rack-livereload' RSpec.configure do |c| + c.expect_with :rspec do |config| + config.syntax = :should + end + c.mock_with :mocha end