mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Allow stubs returning nil to be used on NoReturn calls
This commit is contained in:
parent
e47ae613a5
commit
384fb3093f
1 changed files with 2 additions and 0 deletions
|
@ -20,6 +20,8 @@ module Spectator::Mocks
|
||||||
value = call(args) { |*ya| yield *ya }
|
value = call(args) { |*ya| yield *ya }
|
||||||
if value.is_a?(RT)
|
if value.is_a?(RT)
|
||||||
value.as(RT)
|
value.as(RT)
|
||||||
|
elsif value.nil? && RT == NoReturn
|
||||||
|
raise SystemExit.new
|
||||||
else
|
else
|
||||||
raise TypeCastError.new("The return type of stub #{self} doesn't match the expected type #{RT}")
|
raise TypeCastError.new("The return type of stub #{self} doesn't match the expected type #{RT}")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue