Class: Bilgerat

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

Overview

Based on github.com/cucumber/cucumber/blob/master/lib/cucumber/formatter/pretty.rb and the other cucumber built in formatters. There was no handy api so I had to reverse engineer

Instance Method Summary collapse

Constructor Details

#initialize(step_mother, path_or_io, options) ⇒ Bilgerat

Returns a new instance of Bilgerat.



9
10
# File 'lib/bilgerat.rb', line 9

def initialize(step_mother, path_or_io, options)
end

Instance Method Details

#after_background(background) ⇒ Object



19
20
21
22
23
# File 'lib/bilgerat.rb', line 19

def after_background(background)
  @in_background = nil
  @background_tags = @tags
  @tags = nil
end

#after_examples(*args) ⇒ Object



51
52
53
# File 'lib/bilgerat.rb', line 51

def after_examples(*args)
  @in_examples = false
end

#after_table_row(table_row) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/bilgerat.rb', line 35

def after_table_row(table_row)
  return unless @in_examples and Cucumber::Ast::OutlineTable::ExampleRow === table_row
  @example_num += 1  if !@header_row
  if table_row.exception
    hipchat_exception(table_row.exception)
  elsif !@header_row && table_row.failed?
    hipchat_exception('<failure had no exception>')
  end
  @header_row = false
end

#before_background(background) ⇒ Object



13
14
15
16
17
# File 'lib/bilgerat.rb', line 13

def before_background(background)
  @background_failed = nil
  reset_scenario_info
  @in_background = background
end

#before_examples(*args) ⇒ Object



46
47
48
49
# File 'lib/bilgerat.rb', line 46

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

#exception(exception, status) ⇒ Object



55
56
57
# File 'lib/bilgerat.rb', line 55

def exception(exception, status)
  hipchat_exception(exception)
end

#scenario_name(keyword, name, file_colon_line, source_indent) ⇒ Object



29
30
31
32
33
# File 'lib/bilgerat.rb', line 29

def scenario_name(keyword, name, file_colon_line, source_indent)
  reset_scenario_info
  @current_scenario_info = {keyword: keyword, name: name, file_colon_line: file_colon_line, tags: @tags}
  @tags = nil
end

#step_name(keyword, step_match, status, source_indent, background, file_colon_line = nil) ⇒ Object

file_colon_line is new in cucumber 1.2.0. Give it default of nil to be reverse compatible



60
61
62
63
64
65
66
# File 'lib/bilgerat.rb', line 60

def step_name(keyword, step_match, status, source_indent, background, file_colon_line=nil)
  @current_failed_step_info = nil
  #TODO: detect if we are running in strict mode somehow, and if so also send a message when status == :pending
  if status == :failed
    @current_failed_step_info = {step_match: step_match, file_colon_line: file_colon_line, status: status}
  end
end

#tag_name(tag) ⇒ Object



25
26
27
# File 'lib/bilgerat.rb', line 25

def tag_name(tag)
  (@tags ||= []) << tag
end