Class: Cucumber::Pro::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/pro/formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(session) ⇒ Formatter

Returns a new instance of Formatter.



7
8
9
10
# File 'lib/cucumber/pro/formatter.rb', line 7

def initialize(session)
  @session = session
  send_header
end

Instance Method Details

#after_examples(*args) ⇒ Object



34
35
36
# File 'lib/cucumber/pro/formatter.rb', line 34

def after_examples(*args)
  @in_examples = false
end

#after_feature_element(feature_element) ⇒ Object



22
23
24
25
26
27
# File 'lib/cucumber/pro/formatter.rb', line 22

def after_feature_element(feature_element)
  return if Cucumber::Ast::ScenarioOutline === feature_element
  scenario = feature_element
  path, line = *scenario.file_colon_line.split(':')
  send_test_case_result(path, line, scenario.status)
end

#after_features(*args) ⇒ Object



47
48
49
# File 'lib/cucumber/pro/formatter.rb', line 47

def after_features(*args)
  @session.close
end

#after_table_row(table_row) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/cucumber/pro/formatter.rb', line 38

def after_table_row(table_row)
  return unless @in_examples and Cucumber::Ast::OutlineTable::ExampleRow === table_row
  if @header_row
    @header_row = false
    return
  end
  send_test_case_result(@path, table_row.line, table_row.status)
end

#before_examples(*args) ⇒ Object



29
30
31
32
# File 'lib/cucumber/pro/formatter.rb', line 29

def before_examples(*args)
  @header_row = true
  @in_examples = true
end

#before_feature(feature) ⇒ Object



12
13
14
# File 'lib/cucumber/pro/formatter.rb', line 12

def before_feature(feature)
  @path = feature.file # we need this because table_row doens't have a file_colon_line
end

#before_step_result(*args) ⇒ Object



16
17
18
19
20
# File 'lib/cucumber/pro/formatter.rb', line 16

def before_step_result(*args)
  keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line = *args
  path, line = *file_colon_line.split(':')
  send_step_result(path, line, status)
end