spec/unit/channel_connector_spec.rb in pwwka-0.22.3 vs spec/unit/channel_connector_spec.rb in pwwka-0.22.4
- old
+ new
@@ -12,18 +12,24 @@
before do
allow(Bunny).to receive(:new).and_return(bunny_session)
allow(bunny_session).to receive(:start)
allow(bunny_session).to receive(:close)
allow(bunny_session).to receive(:create_channel).and_return(bunny_channel)
+ allow(bunny_channel).to receive(:on_error)
end
it "sets a prefetch value if configured to do so" do
expect(bunny_channel).to receive(:prefetch).with(10)
described_class.new(prefetch: 10)
end
+ it "sets an on_error handler" do
+ expect(bunny_channel).to receive(:on_error)
+ described_class.new
+ end
+
it "does not set a prefetch value unless configured" do
expect(bunny_channel).not_to receive(:prefetch).with(10)
described_class.new
end
@@ -65,13 +71,17 @@
end
end
describe "raise_if_delayed_not_allowed" do
+ let(:bunny_channel) { instance_double(Bunny::Channel) }
+
before do
allow(Bunny).to receive(:new).and_return(bunny_session)
allow(bunny_session).to receive(:start)
- allow(bunny_session).to receive(:create_channel)
+ allow(bunny_session).to receive(:close)
+ allow(bunny_session).to receive(:create_channel).and_return(bunny_channel)
+ allow(bunny_channel).to receive(:on_error)
@default_allow_delayed = Pwwka.configuration.options[:allow_delayed]
end
after do
Pwwka.configuration.options[:allow_delayed] = @default_allow_delayed