Implement and_call_original

This commit is contained in:
Michael Miller 2019-11-20 19:17:51 -07:00
parent f8563e86c7
commit 5d84536e1e
2 changed files with 14 additions and 0 deletions

View file

@ -40,5 +40,9 @@ module Spectator::Mocks
args = GenericArguments.new(args, opts) args = GenericArguments.new(args, opts)
NilMethodStub.new(@name, @source, args) NilMethodStub.new(@name, @source, args)
end end
def and_call_original
OriginalMethodStub.new(@name, @source, @args)
end
end end
end end

View file

@ -0,0 +1,10 @@
require "./generic_arguments"
require "./generic_method_stub"
module Spectator::Mocks
class OriginalMethodStub < GenericMethodStub(Nil)
def call(_args : GenericArguments(T, NT), &_original : -> RT) forall T, NT, RT
yield
end
end
end