spec/lib/dispatch-rider/subscriber_spec.rb in dispatch-rider-1.9.0 vs spec/lib/dispatch-rider/subscriber_spec.rb in dispatch-rider-2.0.0
- old
+ new
@@ -91,10 +91,11 @@
before { allow(subject.demultiplexer).to receive(:stop) { throw :got_stopped } }
let(:message_body) { { 'foo' => 'bar' } }
context "when process quits" do
let(:message_subject) { :quiter }
+
before do
konst = Class.new(DispatchRider::Handlers::Base) do
def process(_options)
Process.kill("QUIT", 0)
end
@@ -108,10 +109,11 @@
example { expect { subject.process }.to throw_symbol(:got_stopped) }
end
context "when process terminates" do
let(:message_subject) { :terminator }
+
before do
konst = Class.new(DispatchRider::Handlers::Base) do
def process(_options)
Process.kill("TERM", 0)
end
@@ -124,10 +126,11 @@
example { expect { subject.process }.to throw_symbol(:got_stopped) }
end
context "when process is interupted" do
let(:message_subject) { :interupter }
+
before do
konst = Class.new(DispatchRider::Handlers::Base) do
def process(_options)
Process.kill("INT", 0)
end
@@ -140,9 +143,10 @@
example { expect { subject.process }.to throw_symbol(:got_stopped) }
end
context "when process is interupted twice" do
let(:message_subject) { :twice_interupter }
+
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