Sha256: 56c2e1f9c15466a881faab394cf1aed937c601fd2ded677f1ba5edf476edae4a

Contents?: true

Size: 1.49 KB

Versions: 6

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'

module MessageDriver
  module Adapters
    RSpec.describe Base do
      class TestAdapter < Base
        def initialize(_configuration)
        end
      end
      subject(:adapter) { TestAdapter.new({}) }

      describe '#new_context' do
        it 'raises an error' do
          expect do
            subject.new_context
          end.to raise_error 'Must be implemented in subclass'
        end
      end

      describe ContextBase do
        class TestContext < ContextBase
        end
        subject(:adapter_context) { TestContext.new(adapter) }

        it_behaves_like 'an adapter context'
        it_behaves_like 'transactions are not supported'
        it_behaves_like 'client acks are not supported'
        it_behaves_like 'subscriptions are not supported'

        describe '#create_destination' do
          it 'raises an error' do
            expect do
              subject.create_destination('foo')
            end.to raise_error 'Must be implemented in subclass'
          end
        end

        describe '#publish' do
          it 'raises an error' do
            expect do
              subject.publish(:destination, foo: 'bar')
            end.to raise_error 'Must be implemented in subclass'
          end
        end

        describe '#pop_message' do
          it 'raises an error' do
            expect do
              subject.pop_message(:destination)
            end.to raise_error 'Must be implemented in subclass'
          end
        end

      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
message-driver-0.6.1 spec/units/message_driver/adapters/base_spec.rb
message-driver-0.6.0 spec/units/message_driver/adapters/base_spec.rb
message-driver-0.5.3 spec/units/message_driver/adapters/base_spec.rb
message-driver-0.5.2 spec/units/message_driver/adapters/base_spec.rb
message-driver-0.5.1 spec/units/message_driver/adapters/base_spec.rb
message-driver-0.5.0 spec/units/message_driver/adapters/base_spec.rb