Module: Rabbit::TestHelpers
- Defined in:
- lib/rabbit/test_helpers.rb
Instance Method Summary collapse
- #expect_no_rabbit_messages ⇒ Object
- #expect_rabbit_message(args, strict: true) ⇒ Object
- #send_rabbit_message(sender_id, event, data) ⇒ Object
Instance Method Details
#expect_no_rabbit_messages ⇒ Object
17 18 19 |
# File 'lib/rabbit/test_helpers.rb', line 17 def expect(Rabbit).not_to receive(:publish) end |
#expect_rabbit_message(args, strict: true) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/rabbit/test_helpers.rb', line 8 def (args, strict: true) expectation = if strict args else -> (received_args) { expect(received_args).to match(args) } end expect(Rabbit).to receive(:publish).with(expectation).once end |
#send_rabbit_message(sender_id, event, data) ⇒ Object
4 5 6 |
# File 'lib/rabbit/test_helpers.rb', line 4 def (sender_id, event, data) Rabbit::Receiving::Worker.new.work_with_params(data.to_json, {}, type: event, app_id: sender_id) end |