3

I am working on a very small app, it is a RabbitMQ notification system. It triggers an API call when a state changes. That part is fine and I believe is working correctly. What I am having problems is testing the notification part, I am using rspec and I do not have a way to test the notification, or do not know of a way. I have heard of mocking the RabbitMQ call in the test, but I do not know what that means specifically. Can anybody explain? thank you.

Javier Perez
  • 1,855
  • 1
  • 11
  • 8

1 Answers1

4

For testing app working with rabbitmq you can try evented-spec or moqueue. For example, stubbing connect to AMQP (in moqueue):

before(:each) do
  reset_broker
  producer.stub(:connect).and_return(mock_exchange(:topic => "common"))
end

Other examples you can see here

Alexandr T
  • 1,471
  • 12
  • 24