spec/logger_spec.rb in act-fluent-logger-rails-0.1.9 vs spec/logger_spec.rb in act-fluent-logger-rails-0.1.10
- old
+ new
@@ -126,6 +126,26 @@
it { expect(subject['fluent_host']).to eq 'fluentd.example.com' }
it { expect(subject['fluent_port']).to eq 42442 }
it { expect(subject['messages_type']).to eq 'string' }
end
end
+
+ describe 'flush_immediately' do
+ describe 'flush_immediately: true' do
+ it 'flushed' do
+ logger = ActFluentLoggerRails::Logger.new(config_file: File.new(@config_file.path),
+ flush_immediately: true)
+ logger.info('Immediately!')
+ expect(@my_logger.log[0][1][:messages][0]).to eq('Immediately!')
+ end
+ end
+
+ describe 'flush_immediately: false' do
+ it 'flushed' do
+ logger = ActFluentLoggerRails::Logger.new(config_file: File.new(@config_file.path),
+ flush_immediately: false)
+ logger.info('Immediately!')
+ expect(@my_logger.log).to eq(nil)
+ end
+ end
+ end
end