Sha256: 6be43d451eb65699601941558b6ca121247da78efa2c1a9c14829d2846ebf640

Contents?: true

Size: 598 Bytes

Versions: 13

Compression:

Stored size: 598 Bytes

Contents

# frozen_string_literal: true

module Rabbit::TestHelpers
  def send_rabbit_message(sender_id, event, data)
    Rabbit::Receiving::Worker.new.work_with_params(data.to_json, {}, type: event, app_id: sender_id)
  end

  def expect_rabbit_message(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

  def expect_no_rabbit_messages
    expect(Rabbit).not_to receive(:publish)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rabbit_messaging-1.1.0 lib/rabbit/test_helpers.rb
rabbit_messaging-1.0.0 lib/rabbit/test_helpers.rb
rabbit_messaging-0.15.0 lib/rabbit/test_helpers.rb
rabbit_messaging-0.13.0 lib/rabbit/test_helpers.rb
rabbit_messaging-0.12.1 lib/rabbit/test_helpers.rb
rabbit_messaging-0.12.0 lib/rabbit/test_helpers.rb
rabbit_messaging-0.11.0 lib/rabbit/test_helpers.rb
rabbit_messaging-0.10.0 lib/rabbit/test_helpers.rb
rabbit_messaging-0.9.0 lib/rabbit/test_helpers.rb
rabbit_messaging-0.8.1 lib/rabbit/test_helpers.rb
rabbit_messaging-0.7.1 lib/rabbit/test_helpers.rb
rabbit_messaging-0.7.0 lib/rabbit/test_helpers.rb
rabbit_messaging-0.6.0 lib/rabbit/test_helpers.rb