Sha256: aa4cb7dfdcd16737d9f0403e4ec411af69fe6422f1eb6ade4d013bf1a9cbfb88

Contents?: true

Size: 1.59 KB

Versions: 5

Compression:

Stored size: 1.59 KB

Contents

require 'spec_helper'

module MessageDriver::Adapters
  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 {
          subject.new_context
        }.to raise_error "Must be implemented in subclass"
      end
    end

    describe "#stop" do
      it "raises an error", pending: "maybe we don't want to do this" do
        expect {
          subject.stop
        }.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 {
            subject.create_destination("foo")
          }.to raise_error "Must be implemented in subclass"
        end
      end

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

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

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
message-driver-0.2.2 spec/units/message_driver/adapters/base_spec.rb
message-driver-0.2.1 spec/units/message_driver/adapters/base_spec.rb
message-driver-0.2.0 spec/units/message_driver/adapters/base_spec.rb
message-driver-0.2.0.rc2 spec/units/message_driver/adapters/base_spec.rb
message-driver-0.2.0.rc1 spec/units/message_driver/adapters/base_spec.rb