Sha256: 360e868cee59c0682931d298bb327661144b80bcfbaab1904f438f9d1082ffaf

Contents?: true

Size: 1009 Bytes

Versions: 1

Compression:

Stored size: 1009 Bytes

Contents

RSpec.describe TestTopic do
  let(:topic) { TestTopic.new }

  after { topic.close }

  context "smoke test for specs" do
    it "publishes and receives messages" do
      create_topic(topic.topic_name)

      topic.produce_one_message(
        key: "Some Key",
        payload: "Some Payload"
      )

      message = topic.consume_one_message
      expect(message).to have_attributes(
        key: "Some Key",
        payload: "Some Payload"
      )
    end

    it "receives returns nil when no messages are received" do
      create_topic(topic.topic_name)

      consumer = topic.consumer
      message = consumer.poll(1)
      expect(message).to be(nil)
    end
  end

  context "spec helpers" do
    it "creates topics" do
      create_topic(topic.topic_name)
      expect(list_topics).to include(topic.topic_name)
    end

    it "deletes topics" do
      create_topic(topic.topic_name)
      delete_topic(topic.topic_name)
      expect(list_topics).not_to include(topic.topic_name)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nulogy_message_bus_consumer-2.0.1 spec/integration/test_topic_spec.rb