test/appender/elasticsearch_test.rb in semantic_logger-4.1.0 vs test/appender/elasticsearch_test.rb in semantic_logger-4.1.1
- old
+ new
@@ -6,11 +6,11 @@
describe SemanticLogger::Appender::Elasticsearch do
before do
skip('Concurrent::TimerTask issue is preventing the process from stopping.') if defined? JRuby
Elasticsearch::Transport::Client.stub_any_instance(:bulk, true) do
@appender = SemanticLogger::Appender::Elasticsearch.new(
- url: 'http://localhost:9200',
+ url: 'http://localhost:9200',
batch_size: 1 # immediate flush
)
end
@message = 'AppenderElasticsearchTest log message'
end
@@ -19,20 +19,20 @@
@appender.close if @appender
end
it 'logs to daily indexes' do
index = nil
- @appender.stub(:enqueue, ->(ind, json){ index = ind['index']['_index'] } ) do
+ @appender.stub(:enqueue, ->(ind, json) { index = ind['index']['_index'] }) do
@appender.info @message
end
assert_equal "semantic_logger-#{Time.now.strftime('%Y.%m.%d')}", index
end
SemanticLogger::LEVELS.each do |level|
it "send #{level}" do
request = nil
- @appender.client.stub(:bulk, -> r { request = r; {"status" => 201 } }) do
+ @appender.client.stub(:bulk, -> r { request = r; {"status" => 201} }) do
@appender.send(level, @message)
end
message = request[:body][1]
assert_equal @message, message[:message]
@@ -45,11 +45,11 @@
Uh oh
rescue Exception => e
exc = e
end
request = nil
- @appender.client.stub(:bulk, -> r { request = r; {"status" => 201 } }) do
+ @appender.client.stub(:bulk, -> r { request = r; {"status" => 201} }) do
@appender.send(level, 'Reading File', exc)
end
hash = request[:body][1]
@@ -61,10 +61,10 @@
assert exception[:stack_trace].first.include?(__FILE__), exception
end
it "sends #{level} custom attributes" do
request = nil
- @appender.client.stub(:bulk, -> r { request = r; {"status" => 201 } }) do
+ @appender.client.stub(:bulk, -> r { request = r; {"status" => 201} }) do
@appender.send(level, @message, {key1: 1, key2: 'a'})
end
message = request[:body][1]
assert_equal @message, message[:message]