Displaying 1 result from an estimated 1 matches for "test_dog_wags_tail_when_happy".
2007 Apr 16
0
Fwd: ANN: FlexMock 0.6.0 Released
...test the +Dog+ class without a real +Tail+ object (perhaps because
real +Tail+ objects activate servos in some robotic equipment), you
can do something like this:
require ''test/unit''
require ''flexmock/test_unit''
class TestDog < Test::Unit::TestCase
def test_dog_wags_tail_when_happy
tail = flexmock("tail")
tail.should_receive(:wag).once
dog = Dog.new(tail)
dog.happy
end
end
FlexMock will automatically verify that the mocked tail object received
the
message +wag+ exactly one time. If it doesn''t, the test will not pass.
See the...