mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Don't invoke fallback if there are stubs for the method
This commit is contained in:
parent
fc51c1d730
commit
28488d308e
1 changed files with 11 additions and 7 deletions
|
@ -102,21 +102,25 @@ module Spectator
|
|||
end
|
||||
|
||||
private def _spectator_stub_fallback(call : MethodCall, &)
|
||||
if @stubs.any? { |stub| stub.method == call.method }
|
||||
Log.info { "Stubs are defined for #{call.method.inspect}, but none matched (no argument constraints met)." }
|
||||
raise UnexpectedMessage.new("#{_spectator_stubbed_name} received unexpected message #{call}")
|
||||
else
|
||||
Log.trace { "Fallback for #{call} - call original" }
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
private def _spectator_stub_fallback(call : MethodCall, type, &)
|
||||
Log.trace { "Fallback for #{call} - call original" }
|
||||
yield
|
||||
private def _spectator_stub_fallback(call : MethodCall, _type, &)
|
||||
_spectator_stub_fallback(call) { yield }
|
||||
end
|
||||
|
||||
private def _spectator_abstract_stub_fallback(call : MethodCall)
|
||||
raise UnexpectedMessage.new("#{_spectator_stubbed_name} received unexpected message #{call}")
|
||||
end
|
||||
|
||||
private def _spectator_abstract_stub_fallback(call : MethodCall, type)
|
||||
raise UnexpectedMessage.new("#{_spectator_stubbed_name} received unexpected message #{call}")
|
||||
private def _spectator_abstract_stub_fallback(call : MethodCall, _type)
|
||||
_spectator_abstract_stub_fallback(call)
|
||||
end
|
||||
|
||||
# "Hide" existing methods and methods from ancestors by overriding them.
|
||||
|
|
Loading…
Reference in a new issue