
Untitled
By: a guest on
May 6th, 2012 | syntax:
None | size: 0.60 KB | hits: 13 | expires: Never
class MathClass
attr_accessor :x, :y
def initialize(x, y)
@x = x
@y = y
end
def sum
@x + @y + 10
end
def product
@x * @y
end
end
require 'rubygems'
require 'test/unit'
require '../math_class.rb'
class ThingTest < Test::Unit::TestCase
def setup
@math = MathClass.new(2,3)
end
def test_sets_x_and_y
assert 2 == @math.x
assert 3 == @math.y
end
def test_sum
assert 5 == @math.sum
endhttp://assets3.pastie.org/images/paste_button.png?1277948694
def test_sum
assert 6 == @math.product
end
end