Displaying 1 result from an estimated 1 matches for "add_veh".
Did you mean:
add_new
2007 Sep 05
4
Mocking to spec a sort_by method
Hello,
I have a question regarding the use of Mocha with rSpec to spec one of
my methods.
My spec contains the following
vehical1 = mock()
vehical2 = mock()
vehical1.stubs(:mph).returns(150)
vehical2.stubs(:mph).returns(250)
comparer.add_vehical([@vehical1, @vehical2])
comparer.sort_by(:mph)
The comparer is an object that has a basic "stack like" functionality,
add_vehical is the method to add objects to the stack.
My sort_by method in the comparer class looks like
def sort_by(symb)
@vehicals.sort_by{|vehical| vehical[...