working through the koans

cat-town
Dan Buch 14 years ago
parent c806ff13d3
commit 4dbd10ced6

1
.gitignore vendored

@ -1 +1,2 @@
*.log *.log
koans/.path_progress

@ -5,21 +5,18 @@ require File.expand_path(File.dirname(__FILE__) + '/edgecase')
class AboutAsserts < EdgeCase::Koan class AboutAsserts < EdgeCase::Koan
# We shall contemplate truth by testing reality, via asserts.
def test_assert_truth def test_assert_truth
assert false # This should be true assert true
end end
# Enlightenment may be more easily achieved with appropriate
# messages.
def test_assert_with_message def test_assert_with_message
assert false, "This should be true -- Please fix this" assert true, "This should be true -- Please fix this"
end end
# To understand reality, we must compare our expectations against # To understand reality, we must compare our expectations against
# reality. # reality.
def test_assert_equality def test_assert_equality
expected_value = __ expected_value = 2
actual_value = 1 + 1 actual_value = 1 + 1
assert expected_value == actual_value assert expected_value == actual_value
@ -27,7 +24,7 @@ class AboutAsserts < EdgeCase::Koan
# Some ways of asserting equality are better than others. # Some ways of asserting equality are better than others.
def test_a_better_way_of_asserting_equality def test_a_better_way_of_asserting_equality
expected_value = __ expected_value = 2
actual_value = 1 + 1 actual_value = 1 + 1
assert_equal expected_value, actual_value assert_equal expected_value, actual_value

Loading…
Cancel
Save