class Object

Constants

RUBY
THIS_FILE

Public Instance Methods

test_case(description, block) click to toggle source
# File lib/ruby_tdd.rb, line 6
def test_case(description, block)
  begin
    if block.call
      test_passed_message 'Passed: "' + description + '"'
    else
      test_failed_message 'Failed test: "' + description + '"'
    end
  rescue => error
    test_failed_message 'Failed test because an error was raised: ' + error.to_s
  end
end
test_failed_message(text) click to toggle source
# File lib/ruby_tdd.rb, line 22
def test_failed_message(text)
  puts text.red
end
test_passed_message(text) click to toggle source
# File lib/ruby_tdd.rb, line 18
def test_passed_message(text)
  puts text.green
end