class RSpec::Core::Formatters::JenkinsFormatter

Attributes

output_hash[R]
yaml_hash[R]

Public Class Methods

new(output) click to toggle source
Calls superclass method
# File lib/g5kchecks/rspec/core/formatters/jenkins_formatter.rb, line 12
def initialize(output)
  super
  @output_hash = {}
  @yaml_hash = Hash.new
end

Public Instance Methods

close() click to toggle source
# File lib/g5kchecks/rspec/core/formatters/jenkins_formatter.rb, line 46
def close
 File.open(File.join("/tmp/",RSpec.configuration.node.hostname + "_Jenkins_output.json"), 'w' ) { |f|
   f.puts @yaml_hash.to_json
 }
end
message(message) click to toggle source
# File lib/g5kchecks/rspec/core/formatters/jenkins_formatter.rb, line 18
def message(message)
  (@output_hash[:messages] ||= []) << message
end
stop() click to toggle source
Calls superclass method
# File lib/g5kchecks/rspec/core/formatters/jenkins_formatter.rb, line 22
def stop
  super
  @output_hash[:examples] = examples.each do |example|
    if e=example.exception
      # bypass si l'api est rempli et que g5kcheks ne trouve
      # pas la valeur
      array = example.exception.message.split(', ')
      if array[0] != ""
        # pas super beau, pour distinguer plusieurs composants
        # typiquement pour disk et network
        if array[-2] =~ /\d{1,2}/
          desc = example.full_description.gsub(" ","_") + "_" + array[-2]
        else
          desc = example.full_description.gsub(" ","_")
        end
        @yaml_hash[desc] = {}
        @yaml_hash[desc][:attribut] = example.exception.message.split(', ')[-2,2]
        @yaml_hash[desc][:was] = example.exception.message.split(', ')[1]
        @yaml_hash[desc][:should_be] = example.exception.message.split(', ')[0]
      end
    end
  end
end