Class: GherkinReporter

Inherits:
Object
  • Object
show all
Includes:
LoggerSetup
Defined in:
lib/cuker/gherkin_reporter.rb

Overview

Write to Reports

to write out all your parsed gherkins by tags etc.. uses gem ‘writeexcel’

Instance Attribute Summary collapse

Attributes included from LoggerSetup

#log

Instance Method Summary collapse

Methods included from LoggerSetup

#init_logger, reset_appender_log_levels

Constructor Details

#initialize(writer, model, path, file_name = nil) ⇒ GherkinReporter

Returns a new instance of GherkinReporter.



13
14
15
16
17
18
19
20
21
# File 'lib/cuker/gherkin_reporter.rb', line 13

def initialize(writer, model, path, file_name = nil)
  init_logger

  @writer = writer
  @model = model

  @file_path = FileHelper.file_path(path, "#{LOG_TIME_NOW}_#{file_name}")
  @log.info "Report file => #{@file_name}#{@writer.ext}"
end

Instance Attribute Details

#file_pathObject

Returns the value of attribute file_path.



11
12
13
# File 'lib/cuker/gherkin_reporter.rb', line 11

def file_path
  @file_path
end

#workbookObject

Returns the value of attribute workbook.



11
12
13
# File 'lib/cuker/gherkin_reporter.rb', line 11

def workbook
  @workbook
end

Instance Method Details

#old_writeObject



27
28
29
30
31
32
33
34
35
# File 'lib/cuker/gherkin_reporter.rb', line 27

def old_write
  # todo: why don't we just give the writer the model?
  file_name = @writer.make_new_file @file_path
  #todo: redo, causing issue!
  @writer.write_title @model.title
  @model.data.each {|row| @writer.write_new_row row}
  @writer.finishup
  file_name
end

#writeObject



23
24
25
# File 'lib/cuker/gherkin_reporter.rb', line 23

def write
  @writer.write @model, @file_path
end