Thursday, May 7, 2015

RubyKoan: Test_Assert_Equality

Today's Koan is to Assert Equality.  

def test_assert_equality
    expected_value = 2
    actual_value = __
    assert expected_value == actual_value
end

Solution
def test_assert_equality
    expected_value = 2
    actual_value = 1 + 1
    assert expected_value == actual_value
end

This koan has an expected value and an actual value.  Then they are set equal to each other using the == operator.  In order to equal each other you just put a value equal to 2, like 1+1.

If your wondering what assert means just check out my last post. Ruby Koans

Brought to you by KENYACODE. Can you code?

No comments:

Post a Comment