mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Simplify type resolution code
This commit is contained in:
parent
cb466b4ff5
commit
38ec44c9ac
1 changed files with 2 additions and 8 deletions
|
@ -15,10 +15,7 @@ module Spectator::DSL
|
|||
end
|
||||
|
||||
macro create_double(type_name, name, **stubs)
|
||||
{%
|
||||
type = type_name.resolve?
|
||||
raise "Could not find a double labeled #{name}" unless type
|
||||
%}
|
||||
{% type_name.resolve? || raise("Could not find a double labeled #{name}") %}
|
||||
|
||||
{{type_name}}.new.tap do |%double|
|
||||
{% for name, value in stubs %}
|
||||
|
@ -57,10 +54,7 @@ module Spectator::DSL
|
|||
end
|
||||
|
||||
macro create_null_double(type_name, name, **stubs)
|
||||
{%
|
||||
type = type_name.resolve?
|
||||
raise "Could not find a double labeled #{name}" unless type
|
||||
%}
|
||||
{% type_name.resolve? || raise("Could not find a double labeled #{name}") %}
|
||||
|
||||
{{type_name}}.new(true).tap do |%double|
|
||||
{% for name, value in stubs %}
|
||||
|
|
Loading…
Reference in a new issue