# File lib/fluent/test/output_test.rb, line 63 def emit(record, time=Time.now) @entries << [time.to_i, record] self end
# File lib/fluent/test/output_test.rb, line 68 def expect_format(str) (@expected_buffer ||= '') << str end
# File lib/fluent/test/output_test.rb, line 72 def run(&block) result = nil super { es = ArrayEventStream.new(@entries) buffer = @instance.format_stream(@tag, es) block.call if block if @expected_buffer assert_equal(@expected_buffer, buffer) end key = '' if @instance.respond_to?(:time_slicer) # this block is only for test_out_file time, record = @entries.first key = @instance.time_slicer.call(time) end chunk = @instance.buffer.new_chunk(key) chunk << buffer begin result = @instance.write(chunk) ensure chunk.purge end } result end
Generated with the Darkfish Rdoc Generator 2.