Sha256: 60696196aaa1b659a311d2107de7fdb89233448e1e148e73a6a96decdea35afe

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require "spec_helper"

describe Rdkafka::Config do
  it "should store configuration" do
    config = Rdkafka::Config.new
    config['key'] = 'value'
    expect(config['key']).to eq 'value'
  end

  it "should use default configuration" do
    config = Rdkafka::Config.new
    expect(config['api.version.request']).to eq 'true'
  end

  it "should create a consumer with valid config" do
    expect(rdkafka_config.consumer).to be_a Rdkafka::Consumer
  end

  it "should raise an error when creating a consumer with invalid config" do
    config = Rdkafka::Config.new('invalid.key' => 'value')
    expect {
      config.consumer
    }.to raise_error(Rdkafka::Config::ConfigError, "No such configuration property: \"invalid.key\"")
  end

  it "should create a producer with valid config" do
    expect(rdkafka_config.producer).to be_a Rdkafka::Producer
  end

  it "should raise an error when creating a producer with invalid config" do
    config = Rdkafka::Config.new('invalid.key' => 'value')
    expect {
      config.producer
    }.to raise_error(Rdkafka::Config::ConfigError, "No such configuration property: \"invalid.key\"")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rdkafka-0.1.0 spec/rdkafka/config_spec.rb
rdkafka-0.0.1 spec/rdkafka/config_spec.rb