box-o-sand/RubyFun/koans/about_asserts.rb
Dan Buch 0a9428093c Add 'RubyFun/' from commit 'b01c6826131196ba58b5288a3182f2526c89c249'
git-subtree-dir: RubyFun
git-subtree-mainline: a04a502787
git-subtree-split: b01c682613
2013-01-09 23:50:14 -05:00

38 lines
808 B
Ruby

#!/usr/bin/env ruby
# -*- ruby -*-
require File.expand_path(File.dirname(__FILE__) + '/edgecase')
class AboutAsserts < EdgeCase::Koan
def test_assert_truth
assert true
end
def test_assert_with_message
assert true, "This should be true -- Please fix this"
end
# To understand reality, we must compare our expectations against
# reality.
def test_assert_equality
expected_value = 2
actual_value = 1 + 1
assert expected_value == actual_value
end
# Some ways of asserting equality are better than others.
def test_a_better_way_of_asserting_equality
expected_value = 2
actual_value = 1 + 1
assert_equal expected_value, actual_value
end
# Sometimes we will ask you to fill in the values
def test_fill_in_values
assert_equal 2, 1 + 1
end
end