class Matest::SpecPrinter

Public Instance Methods

print_explanation_for(status) click to toggle source
print_messages(runner) click to toggle source
print_subexpression(subexpression, status) click to toggle source
prints(res) click to toggle source
# File lib/matest/spec_printer.rb, line 7
def prints(res)
  print send(colors[res.class], res.to_s)
end

Private Instance Methods

colors() click to toggle source
# File lib/matest/spec_printer.rb, line 131
def colors
  @colors ||= get_colors
end
error(str) click to toggle source
# File lib/matest/spec_printer.rb, line 127
def error(str)
  red(str)
end
expression(str) click to toggle source
# File lib/matest/spec_printer.rb, line 115
def expression(str)
  yellow(str)
end
get_colors() click to toggle source
# File lib/matest/spec_printer.rb, line 135
def get_colors
  h = Hash.new(:white)

  h[Matest::SpecPassed]            = :green
  h[Matest::SpecFailed]            = :red
  h[Matest::SpecSkipped]           = :yellow
  h[Matest::NotANaturalAssertion]  = :cyan
  h[Matest::ExceptionRaised]       = :magenta

  h
end
header(str) click to toggle source
# File lib/matest/spec_printer.rb, line 111
def header(str)
  white(str + ":")
end
key_value(key, value) click to toggle source
# File lib/matest/spec_printer.rb, line 123
def key_value(key, value)
  "  #{yellow(key.to_s)} #{bright_black("=>")} #{blue(value.inspect)}#{reset("")}"
end
value(str) click to toggle source
# File lib/matest/spec_printer.rb, line 119
def value(str)
  blue(str)
end