spec/units/message_driver/message_spec.rb in message-driver-0.6.1 vs spec/units/message_driver/message_spec.rb in message-driver-0.7.0
- old
+ new
@@ -6,18 +6,23 @@
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(:destination) { double('destination') }
context 'sets the body, header and properites on initialization' do
- subject { described_class.new(ctx, body, headers, properties) }
+ subject { described_class.new(ctx, destination, body, headers, properties) }
describe '#ctx' do
it { expect(subject.ctx).to be(ctx) }
end
+ describe '#destination' do
+ it { expect(subject.destination).to be(destination) }
+ end
+
describe '#body' do
it { expect(subject.body).to eq(body) }
end
describe '#headers' do
@@ -32,22 +37,23 @@
it 'defaults to the body' do
expect(subject.raw_body).to eq(subject.body)
end
it 'can be provided in the constructor' do
- msg = described_class.new(ctx, body, headers, properties, 'my_raw_body')
+ msg = described_class.new(ctx, destination, body, headers, properties, 'my_raw_body')
expect(msg.raw_body).to eq('my_raw_body')
expect(msg.body).to eq(body)
end
end
end
end
let(:logger) { MessageDriver.logger }
let(:ctx) { double('adapter_context') }
+ let(:destination) { double('destination') }
let(:options) { double('options') }
- subject(:message) { described_class.new(ctx, 'body', {}, {}) }
+ subject(:message) { described_class.new(ctx, destination, 'body', {}, {}) }
describe '#ack' do
before do
allow(ctx).to receive(:ack_message)
end