Class: Cucumber::Pro::Formatter

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

Instance Method Summary collapse

Constructor Details

#initialize(session, working_copy) ⇒ Formatter

Returns a new instance of Formatter.



9
10
11
12
13
# File 'lib/cucumber/pro/formatter.rb', line 9

def initialize(session, working_copy)
  @session = session
  @working_copy = working_copy
  send_header
end

Instance Method Details

#after_examples(*args) ⇒ Object



37
38
39
# File 'lib/cucumber/pro/formatter.rb', line 37

def after_examples(*args)
  @in_examples = false
end

#after_feature_element(feature_element) ⇒ Object



25
26
27
28
29
30
# File 'lib/cucumber/pro/formatter.rb', line 25

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



50
51
52
# File 'lib/cucumber/pro/formatter.rb', line 50

def after_features(*args)
  @session.close
end

#after_table_row(table_row) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/cucumber/pro/formatter.rb', line 41

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



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

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

#before_feature(feature) ⇒ Object



15
16
17
# File 'lib/cucumber/pro/formatter.rb', line 15

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



19
20
21
22
23
# File 'lib/cucumber/pro/formatter.rb', line 19

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