Skip to content

Commit

Permalink
feat(config): add ability to change elasticsearch logger
Browse files Browse the repository at this point in the history
  • Loading branch information
adham90 committed Jun 17, 2017
1 parent ce7b794 commit 625fece
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/elasticsearch_reader/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def initialize
#
def configuration
yaml_settings.merge(settings.deep_symbolize_keys).tap do |configuration|
configuration[:logger] = logger
configuration[:logger] = logger if logger
configuration[:indices_path] ||= indices_path
end
end
Expand Down
10 changes: 10 additions & 0 deletions spec/elasticsearch_reader/config_spec.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
# frozen_string_literal: true

require 'spec_helper'
require 'logger'

describe ElasticsearchReader::Config do
subject { described_class.send(:new) }

its(:logger) { should be_nil }
its(:indices_path) { should == 'app/indices' }

describe '#transport_logger=' do
let(:logger) { Logger.new('/dev/null') }

specify do
expect { subject.logger = logger }
.to change { subject.logger }.to(logger)
end
end

describe '#configuration' do
before { subject.settings = { indices_path: 'app/foobar' } }

Expand Down

0 comments on commit 625fece

Please sign in to comment.