spec/lib/dispatch-rider/dispatcher_spec.rb in dispatch-rider-1.6.0 vs spec/lib/dispatch-rider/dispatcher_spec.rb in dispatch-rider-1.6.1
- old
+ new
@@ -12,16 +12,22 @@
false
end
end
describe "#dispatch" do
- let(:message) { DispatchRider::Message.new(subject: "handle_something", body: { do_throw_something: true }) }
+ let(:message_subject) { "handle_something" }
+ let(:message_body) { { do_throw_something: true } }
+ let(:fs_message) do
+ DispatchRider::Message.new(subject: message_subject, body: message_body.merge('guid' => 123))
+ end
+ let(:item) { double :item }
+ let(:queue) { double :queue }
+ let(:message) { DispatchRider::QueueServices::FileSystem::FsReceivedMessage.new(fs_message, item, queue) }
describe "callbacks" do
let(:dummy) { double(:dummy) }
let(:storage) { DispatchRider::Callbacks::Storage.new }
- let(:message) { DispatchRider::Message.new(subject: "handle_something", body: { do_throw_something: true }) }
before do
allow(DispatchRider.config).to receive(:callbacks) { storage }
storage.around(:dispatch_message) do |block, message|
begin
@@ -53,12 +59,10 @@
expect { subject.dispatch(message) }.to throw_symbol(:something)
end
end
context "when the handler returns false" do
- let(:message) do
- DispatchRider::Message.new(subject: "handler_that_returns_false", body: { do_throw_something: true })
- end
+ let(:message_subject) { "handler_that_returns_false" }
before :each do
subject.register('handler_that_returns_false')
end