class FunWith::Gems::TestResults

Constants

TEST_SUITE_DATA_REGEX

Attributes

fail_count[RW]
gem_const[RW]
output[RW]
test_results_found[RW]

Public Class Methods

new(g) click to toggle source
# File lib/fun_with/gems/test_results.rb, line 8
def initialize g
  self.gem_const = g
end

Public Instance Methods

no_failures_or_errors?() click to toggle source
# File lib/fun_with/gems/test_results.rb, line 21
def no_failures_or_errors?
  fail_count == 0
end
passed?() click to toggle source
# File lib/fun_with/gems/test_results.rb, line 12
def passed?
  self.scan_test_results
  self.test_results_found? && no_failures_or_errors?
end
scan_test_results() click to toggle source
# File lib/fun_with/gems/test_results.rb, line 25
def scan_test_results
  raise "No output to scan!" if self.output.nil?
  
  if m = self.output.match( TEST_SUITE_DATA_REGEX )
    self.test_results_found = true
    self.fail_count = m[:failures].to_i + m[:errors].to_i
  else
    self.fail_count = -1
    self.test_results_found = false
  end
end
test_results_found?() click to toggle source
# File lib/fun_with/gems/test_results.rb, line 17
def test_results_found?
  self.test_results_found
end