mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Don't return nil for NoReturn stubs
Raise instead, which prevents making the method's return type nilable.
This commit is contained in:
parent
78de2be994
commit
82f26dbb91
1 changed files with 2 additions and 2 deletions
|
@ -83,7 +83,7 @@ module Spectator::Mocks
|
|||
%harness.mocks.record_call(self, %call)
|
||||
if (%stub = %harness.mocks.find_stub(self, %call))
|
||||
if typeof({{original}}) == NoReturn
|
||||
return %stub.call!(%args) { nil }
|
||||
return %stub.call!(%args) { raise "Cannot call original implementation of {{name}} - it won't return." }
|
||||
else
|
||||
return %stub.call!(%args) { {{original}} }
|
||||
end
|
||||
|
@ -106,7 +106,7 @@ module Spectator::Mocks
|
|||
%harness.mocks.record_call(self, %call)
|
||||
if (%stub = %harness.mocks.find_stub(self, %call))
|
||||
if typeof({{original}}) == NoReturn
|
||||
return %stub.call!(%args) { nil }
|
||||
return %stub.call!(%args) { raise "Cannot call original implementation of {{name}} - it won't return." }
|
||||
else
|
||||
return %stub.call!(%args) { {{original}} { |*%ya| yield *%ya } }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue