2011-11-04 15:51:22 +00:00
|
|
|
require 'spec_helper'
|
2012-12-03 19:00:45 +00:00
|
|
|
require 'nokogiri'
|
2011-11-04 15:51:22 +00:00
|
|
|
|
|
|
|
describe Rack::LiveReload do
|
2011-11-08 14:48:34 +00:00
|
|
|
let(:middleware) { described_class.new(app, options) }
|
2011-11-04 15:51:22 +00:00
|
|
|
let(:app) { stub }
|
|
|
|
|
|
|
|
subject { middleware }
|
|
|
|
|
2015-07-03 16:20:54 +00:00
|
|
|
it 'should be an app' do
|
|
|
|
middleware.app.should be == app
|
|
|
|
end
|
2011-11-04 15:51:22 +00:00
|
|
|
|
|
|
|
let(:env) { {} }
|
2011-11-08 14:48:34 +00:00
|
|
|
let(:options) { {} }
|
|
|
|
|
2011-11-04 15:51:22 +00:00
|
|
|
context '/__rack/livereload.js' do
|
2013-04-23 20:28:23 +00:00
|
|
|
let(:env) { { 'PATH_INFO' => described_class::BodyProcessor::LIVERELOAD_JS_PATH } }
|
2011-11-04 15:51:22 +00:00
|
|
|
|
|
|
|
before do
|
|
|
|
middleware.expects(:deliver_file).returns(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should return the js file' do
|
2015-07-03 16:20:54 +00:00
|
|
|
middleware._call(env).should be_truthy
|
2011-11-04 15:51:22 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2011-11-07 14:06:40 +00:00
|
|
|
|