Class: MissCleo::TestsToFilesMapLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/miss_cleo/tests_to_files_map_logger.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_name) ⇒ TestsToFilesMapLogger

Returns a new instance of TestsToFilesMapLogger.



4
5
6
7
# File 'lib/miss_cleo/tests_to_files_map_logger.rb', line 4

def initialize(file_name)
  @logs = []
  @file_name = file_name
end

Instance Method Details

#add_to_log(test_file_and_line, lines_run_before, lines_run_after, templates) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/miss_cleo/tests_to_files_map_logger.rb', line 9

def add_to_log(test_file_and_line, lines_run_before, lines_run_after, templates)
  logs << [ test_file_and_line, {
    before: filter(lines_run_before),
    after: filter(lines_run_after),
    templates: templates
  }]
end

#export_logsObject



17
18
19
# File 'lib/miss_cleo/tests_to_files_map_logger.rb', line 17

def export_logs
  File.open(file_name, 'w') { |f| f.write JSON.dump logs }
end