haha, fix a dumb bug:

This commit is contained in:
John Bintz 2011-11-04 11:57:41 -04:00
parent 2115047ab1
commit ec2a2e3115
2 changed files with 6 additions and 1 deletions

View File

@ -20,7 +20,7 @@ module Rack
body.each do |line|
if line['</head>']
src = LIVERELOAD_JS_PATH
src = LIVERELOAD_JS_PATH.dup
src << "?host=#{env['HTTP_HOST'].gsub(%r{:.*}, '')}" if env['HTTP_HOST']
line.gsub!('</head>', %{<script type="text/javascript" src="#{src}"></script></head>})

View File

@ -27,6 +27,9 @@ describe Rack::LiveReload do
app.stubs(:call).with(env).returns([ 200, { 'Content-Type' => 'text/html', 'Content-Length' => 0 }, [ '<head></head>' ] ])
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