Sha256: 64d56b0ab449e5e65d97cb26892344ef0f880f6595bb8618cc81340f682733dd

Contents?: true

Size: 1.23 KB

Versions: 6

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require 'flipp_ruby_kafka/utils/platform_topic_validation'

describe(FlippRubyKafka::Utils::PlatformTopicValidation) do
  prepend_before(:each) do
    # :nodoc:
    consumer_class = Class.new(FlippRubyKafka::Consumer) do
      # :nodoc:
      def consume
      end
    end
    stub_const('ConsumerTest::MyConsumer', consumer_class)

    producer_class = Class.new(FlippRubyKafka::Producer)
    stub_const('MyProducer', producer_class)
  end

  before(:each) do

    FlippRubyKafka.configure do
      producer do
        class_name 'MyProducer'
        schema 'MySchema'
        namespace 'com.my-namespace'
        topic 'my-topic'
        key_config field: 'test_id'
      end
      consumer do
        class_name 'ConsumerTest::MyConsumer'
        schema 'MySchemaWithDateTimes'
        namespace 'com.my-namespace'
        key_config plain: true
        topic 'my_consume_topic'
        group_id 'my-group-id'
      end
    end

  end

  specify '#generate_config' do
    config = described_class.generate_config('my-service')
    expect(config).
      to eq(
        acls: [{ role: 'producer', topic: 'my-topic' },
               { role: 'consumer', topic: 'my_consume_topic' }],
        service: 'my-service'
      )
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
flipp-ruby-kafka-temp-fork-0.0.6 spec/utils/platform_topic_validation_spec.rb
flipp-ruby-kafka-temp-fork-0.0.5 spec/utils/platform_topic_validation_spec.rb
flipp-ruby-kafka-temp-fork-0.0.4 spec/utils/platform_topic_validation_spec.rb
flipp-ruby-kafka-temp-fork-0.0.3 spec/utils/platform_topic_validation_spec.rb
flipp-ruby-kafka-temp-fork-0.0.2 spec/utils/platform_topic_validation_spec.rb
flipp-ruby-kafka-temp-fork-0.0.1 spec/utils/platform_topic_validation_spec.rb