spec/inputs/rabbitmq_spec.rb in logstash-input-rabbitmq-5.1.1 vs spec/inputs/rabbitmq_spec.rb in logstash-input-rabbitmq-5.2.0

- old
+ new

@@ -34,17 +34,18 @@ # Doing this in a before block doesn't give us enough control over scope before do allow(instance).to receive(:connect!).and_call_original allow(::MarchHare).to receive(:connect).and_return(connection) allow(connection).to receive(:create_channel).and_return(channel) + allow(connection).to receive(:on_shutdown) allow(connection).to receive(:on_blocked) allow(connection).to receive(:on_unblocked) allow(channel).to receive(:exchange).and_return(exchange) allow(channel).to receive(:queue).and_return(queue) allow(channel).to receive(:prefetch=) - allow(queue).to receive(:build_consumer).with(:block => true) + allow(queue).to receive(:build_consumer).with(:on_cancellation => anything) allow(queue).to receive(:subscribe_with).with(any_args) allow(queue).to receive(:bind).with(any_args) end it "should default the codec to JSON" do @@ -55,10 +56,11 @@ subject { hare_info } context "without an exchange declared" do before do instance.register + instance.setup! end it "should set the queue correctly" do expect(subject.queue).to eql(queue) end @@ -75,13 +77,14 @@ before do allow(instance).to receive(:declare_exchange!) end - context "on register" do + context "on run" do before do instance.register + instance.setup! end it "should bind to the exchange" do expect(queue).to have_received(:bind).with(exchange, :routing_key => key) end @@ -100,9 +103,10 @@ end end it "should reconnect" do instance.register + instance.setup! expect(queue).to have_received(:bind).with(any_args).twice() end end context "initially unable to subscribe" do