Store stubs in reverse order

This commit is contained in:
Michael Miller 2019-11-09 22:13:02 -07:00
parent 17695d35cf
commit 0471794814

View file

@ -20,7 +20,9 @@ module Spectator::Mocks
end
def add_stub(object, stub : MethodStub) : Nil
fetch(object).stubs << stub
# Stubs are added in reverse order,
# so that later-defined stubs override previously defined ones.
fetch(object).stubs.unshift(stub)
end
def find_stub(object, call : GenericMethodCall(T, NT)) forall T, NT