From ec2a2e3115ac6db91a6e3b974c57df4c73130d38 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 4 Nov 2011 11:57:41 -0400 Subject: [PATCH] haha, fix a dumb bug: --- lib/rack/livereload.rb | 2 +- spec/rack/livereload_spec.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/rack/livereload.rb b/lib/rack/livereload.rb index 38caf18..17e9a27 100644 --- a/lib/rack/livereload.rb +++ b/lib/rack/livereload.rb @@ -20,7 +20,7 @@ module Rack body.each do |line| if line[''] - src = LIVERELOAD_JS_PATH + src = LIVERELOAD_JS_PATH.dup src << "?host=#{env['HTTP_HOST'].gsub(%r{:.*}, '')}" if env['HTTP_HOST'] line.gsub!('', %{}) diff --git a/spec/rack/livereload_spec.rb b/spec/rack/livereload_spec.rb index 5f8c5a8..8bafd88 100644 --- a/spec/rack/livereload_spec.rb +++ b/spec/rack/livereload_spec.rb @@ -27,6 +27,9 @@ describe Rack::LiveReload do app.stubs(:call).with(env).returns([ 200, { 'Content-Type' => 'text/html', 'Content-Length' => 0 }, [ '' ] ]) end + let(:host) { 'host' } + let(:env) { { 'HTTP_HOST' => host } } + let(:ret) { middleware.call(env) } let(:body) { ret.last.join } let(:length) { ret[1]['Content-Length'] } @@ -36,6 +39,8 @@ describe Rack::LiveReload do body.should include(described_class::LIVERELOAD_JS_PATH) length.should == body.length.to_s + + described_class::LIVERELOAD_JS_PATH.should_not include(host) end end