Sha256: 4cdef85c404b66ee94954917e41b0c9ed78048e28da4d878c91342f7b597ffe6

Contents?: true

Size: 1.49 KB

Versions: 6

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

require 'flipp_ruby_kafka/utils/platform_schema_validation'

describe(FlippRubyKafka::Utils::PlatformSchemaValidation) 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
    base_path = File.join(File.expand_path('..', __dir__), 'schemas')
    validator = described_class.new(base_path: base_path)
    config = validator.generate_config
    expect(config[:environments][:default]).to include(
      'file' => "#{base_path}/com/my-namespace/MySchema.avsc",
      'subject' => 'my-topic-value'
    )
    expect(config[:environments][:default]).to include(
      'file' => "#{base_path}/com/my-namespace/MySchemaWithDateTimes.avsc",
      'subject' => 'my_consume_topic-value'
    )
  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_schema_validation_spec.rb
flipp-ruby-kafka-temp-fork-0.0.5 spec/utils/platform_schema_validation_spec.rb
flipp-ruby-kafka-temp-fork-0.0.4 spec/utils/platform_schema_validation_spec.rb
flipp-ruby-kafka-temp-fork-0.0.3 spec/utils/platform_schema_validation_spec.rb
flipp-ruby-kafka-temp-fork-0.0.2 spec/utils/platform_schema_validation_spec.rb
flipp-ruby-kafka-temp-fork-0.0.1 spec/utils/platform_schema_validation_spec.rb