class Rproof::TestResult

Attributes

assertions[R]
description[R]
exceptions[R]
name[R]
warnings[R]

Public Class Methods

get_worse_status(status_1, status_2) click to toggle source

Return worse status between the two

# File lib/rproof/test_result.rb, line 53
def self.get_worse_status(status_1, status_2)
  if [status_1, status_2].include? :exception
    :exception
  elsif [status_1, status_2].include? :failed
    :failed
  else
    :succeed
  end
end
new(name, description) click to toggle source
# File lib/rproof/test_result.rb, line 5
def initialize(name, description)
  @name = name
  @description = description
  @assertions = []
  @warnings = []
  @exceptions = []
end

Public Instance Methods

add_assertion(assertion) click to toggle source
# File lib/rproof/test_result.rb, line 14
def add_assertion(assertion)
  @assertions << assertion
end
add_exception(exception) click to toggle source
# File lib/rproof/test_result.rb, line 22
def add_exception(exception)
  @exceptions << exception
end
add_warning(warning) click to toggle source
# File lib/rproof/test_result.rb, line 18
def add_warning(warning)
  @warnings << warning
end
failures() click to toggle source
# File lib/rproof/test_result.rb, line 38
def failures
  @assertions.select { |assertion| not assertion.is_successful }
end
failures_nb() click to toggle source
# File lib/rproof/test_result.rb, line 30
def failures_nb
  failures.count
end
status() click to toggle source
# File lib/rproof/test_result.rb, line 42
def status
  if @exceptions.count > 0
    :exception
  elsif failures_nb > 0
    :failed
  else
    :succeed
  end
end
successes() click to toggle source
# File lib/rproof/test_result.rb, line 34
def successes
  @assertions.select { |assertion| assertion.is_successful }
end
successes_nb() click to toggle source
# File lib/rproof/test_result.rb, line 26
def successes_nb
  successes.count
end