spec/lib/dispatch-rider/subscriber_spec.rb in dispatch-rider-2.1.0 vs spec/lib/dispatch-rider/subscriber_spec.rb in dispatch-rider-2.2.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require "spec_helper"
describe DispatchRider::Subscriber do
let(:message_subject) { "handle_something" }
let(:message_body) { { do_throw_something: true } }
@@ -53,11 +55,11 @@
end
end
describe "#setup_demultiplexer" do
context "when a queue is registered" do
- before :each do
+ before do
subject.register_queue(:simple)
subject.register_handler(:foo_bar)
end
it "should assign a demultiplexer" do
@@ -67,11 +69,11 @@
end
end
end
describe "#process" do
- before :each do
+ before do
subject.register_queue(:simple)
subject.register_handler(:foo_bar)
subject.setup_demultiplexer(:simple)
end
@@ -87,10 +89,11 @@
end
# kills travis sometimes so leaving it here as tested documentation
describe "process termination", if: false do
before { allow(subject.demultiplexer).to receive(:stop) { throw :got_stopped } }
+
let(:message_body) { { 'foo' => 'bar' } }
context "when process quits" do
let(:message_subject) { :quiter }
@@ -149,10 +152,10 @@
before do
allow(subject.demultiplexer).to receive(:stop) # do nothing just ignore the interuption
allow(subject).to receive(:exit) { throw :got_forcefully_stopped }
konst = Class.new(DispatchRider::Handlers::Base) do
- def process(options)
+ def process(_options)
2.times { Process.kill("INT", 0) }
end
end
stub_const("TwiceInterupter", konst)
subject.register_handler(:twice_interupter)