haha, fix a dumb bug:
This commit is contained in:
parent
2115047ab1
commit
ec2a2e3115
|
@ -20,7 +20,7 @@ module Rack
|
||||||
|
|
||||||
body.each do |line|
|
body.each do |line|
|
||||||
if line['</head>']
|
if line['</head>']
|
||||||
src = LIVERELOAD_JS_PATH
|
src = LIVERELOAD_JS_PATH.dup
|
||||||
src << "?host=#{env['HTTP_HOST'].gsub(%r{:.*}, '')}" if env['HTTP_HOST']
|
src << "?host=#{env['HTTP_HOST'].gsub(%r{:.*}, '')}" if env['HTTP_HOST']
|
||||||
|
|
||||||
line.gsub!('</head>', %{<script type="text/javascript" src="#{src}"></script></head>})
|
line.gsub!('</head>', %{<script type="text/javascript" src="#{src}"></script></head>})
|
||||||
|
|
|
@ -27,6 +27,9 @@ describe Rack::LiveReload do
|
||||||
app.stubs(:call).with(env).returns([ 200, { 'Content-Type' => 'text/html', 'Content-Length' => 0 }, [ '<head></head>' ] ])
|
app.stubs(:call).with(env).returns([ 200, { 'Content-Type' => 'text/html', 'Content-Length' => 0 }, [ '<head></head>' ] ])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let(:host) { 'host' }
|
||||||
|
let(:env) { { 'HTTP_HOST' => host } }
|
||||||
|
|
||||||
let(:ret) { middleware.call(env) }
|
let(:ret) { middleware.call(env) }
|
||||||
let(:body) { ret.last.join }
|
let(:body) { ret.last.join }
|
||||||
let(:length) { ret[1]['Content-Length'] }
|
let(:length) { ret[1]['Content-Length'] }
|
||||||
|
@ -36,6 +39,8 @@ describe Rack::LiveReload do
|
||||||
body.should include(described_class::LIVERELOAD_JS_PATH)
|
body.should include(described_class::LIVERELOAD_JS_PATH)
|
||||||
|
|
||||||
length.should == body.length.to_s
|
length.should == body.length.to_s
|
||||||
|
|
||||||
|
described_class::LIVERELOAD_JS_PATH.should_not include(host)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue