spec/units/message_driver/message_spec.rb in message-driver-0.3.0 vs spec/units/message_driver/message_spec.rb in message-driver-0.4.0
- old
+ new
@@ -1,43 +1,43 @@
require 'spec_helper'
module MessageDriver::Message
describe Base do
- describe "#initialize" do
- let(:body) { "The message body" }
+ describe '#initialize' do
+ let(:body) { 'The message body' }
let(:headers) { { foo: :bar, bar: :baz} }
let(:properties) { {persistent: true, client_ack: true} }
- let(:ctx) { double("adapter_context") }
+ let(:ctx) { double('adapter_context') }
- context "sets the body, header and properites on initialization" do
+ context 'sets the body, header and properites on initialization' do
subject { described_class.new(ctx, body, headers, properties) }
its(:ctx) { should be(ctx) }
its(:body) { should eq(body) }
its(:headers) { should eq(headers) }
its(:properties) { should eq(properties) }
end
end
let(:logger) { MessageDriver.logger }
- let(:ctx) { double("adapter_context") }
- let(:options) { double("options") }
- subject(:message) { described_class.new(ctx, "body", {}, {}) }
+ let(:ctx) { double('adapter_context') }
+ let(:options) { double('options') }
+ subject(:message) { described_class.new(ctx, 'body', {}, {}) }
- describe "#ack" do
+ describe '#ack' do
before do
allow(ctx).to receive(:ack_message)
end
- context "when the adapter supports client acks" do
+ context 'when the adapter supports client acks' do
before do
allow(ctx).to receive(:supports_client_acks?) { true }
end
- it "calls #ack_message with the message" do
+ it 'calls #ack_message with the message' do
subject.ack
expect(ctx).to have_received(:ack_message).with(subject, {})
end
- it "passes the supplied options to ack_message" do
+ it 'passes the supplied options to ack_message' do
subject.ack(options)
expect(ctx).to have_received(:ack_message).with(subject, options)
end
end
context "when the adapter doesn't support client acks" do
@@ -46,31 +46,31 @@
end
it "doesn't call #ack_message" do
subject.ack
expect(ctx).not_to have_received(:ack_message)
end
- it "logs a warning" do
+ it 'logs a warning' do
allow(logger).to receive(:debug)
subject.ack
- expect(logger).to have_received(:debug).with("this adapter does not support client acks")
+ expect(logger).to have_received(:debug).with('this adapter does not support client acks')
end
end
end
- describe "#nack" do
+ describe '#nack' do
before do
allow(ctx).to receive(:nack_message)
end
- context "when the adapter supports client nacks" do
+ context 'when the adapter supports client nacks' do
before do
allow(ctx).to receive(:supports_client_acks?) { true }
end
- it "calls #nack_message with the message" do
+ it 'calls #nack_message with the message' do
subject.nack
expect(ctx).to have_received(:nack_message).with(subject, {})
end
- it "passes the supplied options to nack_message" do
+ it 'passes the supplied options to nack_message' do
subject.nack(options)
expect(ctx).to have_received(:nack_message).with(subject, options)
end
end
context "when the adapter doesn't support client nacks" do
@@ -79,13 +79,13 @@
end
it "doesn't call #nack_message" do
subject.nack
expect(ctx).not_to have_received(:nack_message)
end
- it "logs a warning" do
+ it 'logs a warning' do
allow(logger).to receive(:debug)
subject.nack
- expect(logger).to have_received(:debug).with("this adapter does not support client acks")
+ expect(logger).to have_received(:debug).with('this adapter does not support client acks')
end
end
end
end
end