Module: Kiev::Test::Log

Defined in:
lib/kiev/test.rb

Constant Summary collapse

STREAM =
StringIO.new

Class Method Summary collapse

Class Method Details

.clearObject



20
21
22
23
24
# File 'lib/kiev/test.rb', line 20

def clear
  STREAM.rewind
  STREAM.truncate(0)
  @logs = []
end

.configureObject



13
14
15
16
17
18
# File 'lib/kiev/test.rb', line 13

def configure
  @logs = []
  Kiev.configure do |c|
    c.log_path = STREAM
  end
end

.entriesObject



26
27
28
29
30
31
32
33
# File 'lib/kiev/test.rb', line 26

def entries
  return @logs unless @logs.empty?

  @logs = raw_logs.each_line.map(&::JSON.method(:parse))
rescue StandardError
  puts raw_logs
  raise
end

.raw_logsObject



35
36
37
# File 'lib/kiev/test.rb', line 35

def raw_logs
  STREAM.string
end