spec/lib/guard/livereload/reactor_spec.rb in guard-livereload-2.1.1 vs spec/lib/guard/livereload/reactor_spec.rb in guard-livereload-2.1.2
- old
+ new
@@ -29,9 +29,26 @@
end
reactor.reload_browser(paths)
end
end
+ describe "#_connect(ws)" do
+ let(:ws) { double.as_null_object }
+ let(:reactor) { new_live_reactor }
+
+ it "displays a message once" do
+ expect(Guard::UI).to receive(:info).with("Browser connected.").once
+ reactor.send(:_connect, ws)
+ reactor.send(:_connect, ws)
+ end
+
+ it "increments the connection count" do
+ expect {
+ reactor.send(:_connect, ws)
+ }.to change { reactor.connections_count }.from(0).to 1
+ end
+ end
+
end
def new_live_reactor(options = {})
Guard::LiveReload::Reactor.new({ api_version: '1.6', host: '0.0.0.0', port: '35729', apply_js_live: true, apply_css_live: true, grace_period: 0 }.merge(options))
end