-
Notifications
You must be signed in to change notification settings - Fork 43
Description
I see that BunnyMock::Queue#pop returns a hash with :message and :options keys:
xchg.publish("Hello, everybody!", :routing_key => 'test1')
message = q.pop
message[:message] # => 'Hello, everybody!'
message[:options] # => { routing_key: 'test1' }However Bunny::Queue#pop returns a 3 element array:
xchg.publish("Hello, everybody!", :routing_key => 'test1')
delivery_info, properties, payload = q.popI assume that this was to make popping messages off of queues in specs a lot cleaner. However, it makes BunnyMock only really able to help test the publishing of messages. Any code that attempts to use Bunny to read messages from queues would not be able to use BunnyMock.new as a replacement for Bunny.new.
Ideally the APIs would match, however changing it would break anyone using the current behavior. I propose creating some sort of config option (e.g. BunnyMock.use_bunny_queue_pop_api = true) that could default to the current behavior. The README could clearly show how to use the two options.
Thoughts? Let me know if I'm misunderstanding something.
I'll put together a PR if you're open to the idea.