mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Better compiler error for wrong argument type passed to mock
This commit is contained in:
parent
8fbcbe8b73
commit
effad28559
1 changed files with 1 additions and 0 deletions
|
@ -190,6 +190,7 @@ module Spectator::DSL
|
|||
end
|
||||
|
||||
macro mock(type, **value_methods, &block)
|
||||
{% raise "First argument of `mock` must be a type name, not #{type}" unless type.is_a?(Path) || type.is_a?(Generic) || type.is_a?(Union) || type.is_a?(Metaclass) || type.is_a?(TypeNode) %}
|
||||
{% begin %}
|
||||
{% if @def %}new_mock{% else %}def_mock{% end %}({{type}}, {{**value_methods}}){% if block %} do
|
||||
{{block.body}}
|
||||
|
|
Loading…
Reference in a new issue