Sha256: 80d32f3f80998bcc24b10ae5636eb351fdbad31b58a345d6ffe0952754576b13

Contents?: true

Size: 925 Bytes

Versions: 4

Compression:

Stored size: 925 Bytes

Contents

module RabbitFeed
  module TestingSupport
    describe TestingHelpers do
      describe 'consuming events' do
        accumulator = []

        let(:define_route) do
          EventRouting do
            accept_from('some_place') do
              event('some_event') do |event|
                accumulator << event
              end
            end
          end
        end

        let(:payload)  { { 'stuff' => 'some_stuff' } }
        let(:metadata) { { 'application' => 'some_place', 'name' => 'some_event' } }
        let(:event)    { Event.new metadata, payload }

        before { define_route }

        it 'should allow to send messages directly to the consumer' do
          rabbit_feed_consumer.consume_event event
          expect(accumulator.size).to eq(1)
          expect(accumulator[0].payload).to eq(payload)
          expect(accumulator[0].metadata).to eq(metadata)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rabbit_feed-3.0.3 spec/lib/rabbit_feed/testing_support/testing_helper_spec.rb
rabbit_feed-3.0.2 spec/lib/rabbit_feed/testing_support/testing_helper_spec.rb
rabbit_feed-3.0.1 spec/lib/rabbit_feed/testing_support/testing_helper_spec.rb
rabbit_feed-3.0.0 spec/lib/rabbit_feed/testing_support/testing_helper_spec.rb