Sha256: 20870e5eb4357d15aa1b9ad0db6115c122878d0d47f020d51c261dbbff027b6b

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

#
# Copyright (C) 2013-2014 Globo.com
#

# This file is part of TDI.

# TDI is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# TDI is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with TDI.  If not, see <http://www.gnu.org/licenses/>.

require_relative 'tdi/version'

class TDI
  attr_accessor :plan_passed, :case_passed
  alias :plan_passed? :plan_passed
  alias :case_passed? :case_passed
  attr_accessor :skip, :pass, :warn, :fail

  def initialize
    @plan_passed = true
    @case_passed = true
    @skip = 0
    @pass = 0
    @warn = 0
    @fail = 0
  end

  def success(msg)
    # I like the seventies.
    printf("%-70s [ %s ]\n", msg, 'PASS'.light_green )
    @pass += 1
  end

  def warning(msg)
    printf("%-70s [ %s ]\n", msg, 'WARN'.light_yellow )
    @warn += 1
  end

  def failure(msg)
    printf("%-70s [ %s ]\n", msg, 'FAIL'.light_red )
    @plan_passed = false
    @case_passed = false
    @fail += 1
  end

  def total
    @skip + @pass + @warn + @fail
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tdi-0.1.6 lib/tdi.rb
tdi-0.1.5 lib/tdi.rb