Created
August 20, 2009 18:05
-
-
Save jasonm/171236 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Calculator | |
def sum(a, b) | |
a + b | |
end | |
def product(a, b) | |
a * b | |
end | |
end | |
require 'test/unit' | |
class CalculatorTest < Test::Unit::TestCase | |
def test_calculator_should_add_numbers_for_sum | |
calculator = Calculator.new | |
assert_equal 4, calculator.sum(2, 2) | |
end | |
def test_calculator_should_multiply_numbers_for_the_product | |
calculator = Calculator.new | |
assert_equal 10, calculator.product(2, 5) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment