mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Implement and_call_original
This commit is contained in:
parent
f8563e86c7
commit
5d84536e1e
2 changed files with 14 additions and 0 deletions
|
@ -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
|
||||||
|
|
10
src/spectator/mocks/original_method_stub.cr
Normal file
10
src/spectator/mocks/original_method_stub.cr
Normal 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
|
Loading…
Reference in a new issue