Sha256: 7a2d380db2065917e1c9c6f7e82ed0f43bef05bddc2a8e43df16785df4530540

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

require 'colorize'

module QualityAssurance
  def assert(expected:, actual:)
    success = expected == actual
    print success ? '.'.cyan : 'F'.red
    {success: success, expected: expected, actual: actual}
  end

  def run_tests
    specs = []
    self.class.instance_methods( false ).each do |method_name|
      spec = public_send(method_name)
      spec[:method_name] = method_name
      specs << spec
    end
    puts
    errored_specs = specs.reject { |spec| spec[:success] }
    errored_specs.each { |spec|
      puts "FAILED: #{spec[:method_name]}".red
      puts "EXPECTED: #{spec[:expected]}".blue
      puts "ACTUAL: #{spec[:actual]}".cyan
    }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quality_assurance-1.0.1 lib/quality_assurance.rb