Class: MissCleo::TestConfigurations::CucumberConfig

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

Constant Summary collapse

CUCUMBER_MAP =
"cucumber_map.json"

Class Method Summary collapse

Class Method Details

.setup_hooks(context) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/miss_cleo/test_configurations/cucumber_config.rb', line 6

def self.setup_hooks(context)
  map_logger = MissCleo::TestsToFilesMapLogger.new(CUCUMBER_MAP)
  MissCleo::TemplateTracker.initialize_tracker
  ActionView::Template.prepend MissCleo::TestConfigurations::ActionViewConfig if defined? ActionView::Template
  Coverage.start
  context.Around do |scenario, execute|
    MissCleo::TemplateTracker.clear_templates
    before = Coverage.peek_result
    execute.call
    after = Coverage.peek_result
    templates = MissCleo::TemplateTracker.templates.uniq
    if file_and_line = [scenario.location.file, scenario.location.lines.to_s].join(":")
      map_logger.add_to_log(file_and_line, before, after, templates)
    end
  end

  at_exit do
    map_logger.export_logs
  end
end