class Loupe::Reporter

Reporter

Class that handles reporting test results and progress.

Attributes

expectation_count[R]

@return [Integer]

failure_count[R]

@return [Integer]

failures[R]

@return [Array<Loupe::Failure>]

success_count[R]

@return [Integer]

test_count[R]

@return [Integer]

Public Class Methods

new(options = {}) click to toggle source

@param options [Hash<Symbol, BasicObject>] @return [Loupe::Reporter]

# File lib/loupe/reporter.rb, line 49
def initialize(options = {})
  @options = options
  @color = Color.new(options[:color])
  @options = options
  @test_count = 0
  @expectation_count = 0
  @success_count = 0
  @failure_count = 0
  @failures = []
  @start_time = Time.now
end

Public Instance Methods

<<(other) click to toggle source

@param other [Loupe::Reporter] @return [Loupe::Reporter]

# File lib/loupe/reporter.rb, line 87
def <<(other)
  @test_count += other.test_count
  @expectation_count += other.expectation_count
  @success_count += other.success_count
  @failure_count += other.failure_count
  @failures.concat(other.failures)
  self
end
exit_status() click to toggle source

@return [Integer]

# File lib/loupe/reporter.rb, line 97
def exit_status
  @failure_count.zero? ? 0 : 1
end
increment_expectation_count() click to toggle source

@return [void]

# File lib/loupe/reporter.rb, line 67
def increment_expectation_count
  @expectation_count += 1
end
increment_failure_count(test, message) click to toggle source

@param test [Loupe::Test] @return [void]

# File lib/loupe/reporter.rb, line 79
def increment_failure_count(test, message)
  print(@color.p("F", :red))
  @failures << Failure.new(test, message)
  @failure_count += 1
end
increment_success_count() click to toggle source

@return [void]

# File lib/loupe/reporter.rb, line 72
def increment_success_count
  print(@color.p(".", :green))
  @success_count += 1
end
increment_test_count() click to toggle source

@return [void]

# File lib/loupe/reporter.rb, line 62
def increment_test_count
  @test_count += 1
end
print_summary() click to toggle source

@return [void]