Top Level Namespace

Defined Under Namespace

Modules: RubyTdd Classes: Stub, TestWatch

Constant Summary collapse

THIS_FILE =
File.expand_path(__FILE__)
RUBY =
File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])

Instance Method Summary collapse

Instance Method Details

#test_case(description, block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# 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) ⇒ Object



22
23
24
# File 'lib/ruby_tdd.rb', line 22

def test_failed_message(text)
  puts text.red
end

#test_passed_message(text) ⇒ Object



18
19
20
# File 'lib/ruby_tdd.rb', line 18

def test_passed_message(text)
  puts text.green
end