test/appender/elasticsearch_test.rb in semantic_logger-4.2.0 vs test/appender/elasticsearch_test.rb in semantic_logger-4.2.1
- old
+ new
@@ -104,17 +104,19 @@
it 'logs multiple messages' do
request = stub_client { appender.batch(logs) }
assert body = request[:body]
- assert_equal 4, body.size, body
- index = body[0]['index']['_index']
- assert_equal "semantic_logger-#{Time.now.strftime('%Y.%m.%d')}", index
+ assert_equal 6, body.size, body
+ index = "semantic_logger-#{Time.now.strftime('%Y.%m.%d')}"
+ assert_equal index, body[0]['index']['_index']
assert_equal 'hello world1', body[1][:message]
- assert_equal 'hello world2', body[2][:message]
- assert_equal 'hello world3', body[3][:message]
+ assert_equal index, body[2]['index']['_index']
+ assert_equal 'hello world2', body[3][:message]
+ assert_equal index, body[4]['index']['_index']
+ assert_equal 'hello world3', body[5][:message]
end
end
def stub_client(&block)
request = nil
@@ -221,16 +223,18 @@
it 'logs multiple messages' do
request = stub_client { appender.batch(logs) }
assert body = request[:body]
- assert_equal 4, body.size, body
- index = body[0]['index']['_index']
- assert_equal "semantic_logger-#{Time.now.strftime('%Y.%m.%d')}", index
+ assert_equal 6, body.size, body
+ index = "semantic_logger-#{Time.now.strftime('%Y.%m.%d')}"
+ assert_equal index, body[0]['index']['_index']
assert_equal 'hello world1', body[1][:message]
- assert_equal 'hello world2', body[2][:message]
- assert_equal 'hello world3', body[3][:message]
+ assert_equal index, body[2]['index']['_index']
+ assert_equal 'hello world2', body[3][:message]
+ assert_equal index, body[4]['index']['_index']
+ assert_equal 'hello world3', body[5][:message]
end
end
def stub_client(&block)
request = nil