Class: Buildr::JtestR::YamlFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/buildr/java/jtestr_result.rb

Overview

An Rspec formatter used by JtestR

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, where) ⇒ YamlFormatter

Returns a new instance of YamlFormatter.



30
31
32
33
# File 'lib/buildr/java/jtestr_result.rb', line 30

def initialize(options, where)
  @options = options
  @where = where
end

Instance Attribute Details

#example_groupObject

Returns the value of attribute example_group.



28
29
30
# File 'lib/buildr/java/jtestr_result.rb', line 28

def example_group
  @example_group
end

#optionsObject

Returns the value of attribute options.



28
29
30
# File 'lib/buildr/java/jtestr_result.rb', line 28

def options
  @options
end

#resultObject (readonly)

Returns the value of attribute result.



26
27
28
# File 'lib/buildr/java/jtestr_result.rb', line 26

def result
  @result
end

#whereObject

Returns the value of attribute where.



28
29
30
# File 'lib/buildr/java/jtestr_result.rb', line 28

def where
  @where
end

Instance Method Details

#closeObject



60
61
62
63
64
# File 'lib/buildr/java/jtestr_result.rb', line 60

def close
  result.succeeded = result.succeeded - result.failed
  FileUtils.mkdir_p File.dirname(where)
  File.open(where, 'w') { |f| f.puts YAML.dump(result) }
end

#example_failed(example, counter, failure) ⇒ Object



52
53
54
# File 'lib/buildr/java/jtestr_result.rb', line 52

def example_failed(example, counter, failure)
  result.failed << example_name(example)
end

#example_group_started(example_group) ⇒ Object



40
41
42
# File 'lib/buildr/java/jtestr_result.rb', line 40

def example_group_started(example_group)
  @example_group = example_group
end

#example_passed(example) ⇒ Object



44
45
46
# File 'lib/buildr/java/jtestr_result.rb', line 44

def example_passed(example)
  result.succeeded << example_name(example)
end

#example_pending(example, counter) ⇒ Object



48
49
50
# File 'lib/buildr/java/jtestr_result.rb', line 48

def example_pending(example, counter)
  result.succeeded << example_name(example)
end

#start(example_count) ⇒ Object



56
57
58
# File 'lib/buildr/java/jtestr_result.rb', line 56

def start(example_count)
  @result = Buildr::TestFramework::TestResult.new
end