Sha256: c146c77ed127c5ab54ebe3d98c4027d7a5be63f8719390f934e0b724a0ec2fb4
Contents?: true
Size: 1.7 KB
Versions: 2
Compression:
Stored size: 1.7 KB
Contents
require "spec_helper" describe Rdkafka::Config do context "logger" do it "should have a default logger" do expect(Rdkafka::Config.logger).to be_a Logger end it "should set the logger" do logger = Logger.new(STDOUT) expect(Rdkafka::Config.logger).not_to eq logger Rdkafka::Config.logger = logger expect(Rdkafka::Config.logger).to eq logger end it "should not accept a nil logger" do expect { Rdkafka::Config.logger = nil }.to raise_error(Rdkafka::Config::NoLoggerError) end end context "configuration" 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 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rdkafka-0.3.0 | spec/rdkafka/config_spec.rb |
rdkafka-0.2.0 | spec/rdkafka/config_spec.rb |