mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Conditionally insert top-level namespace (double colon)
This commit is contained in:
parent
12f3f35958
commit
a634046a86
2 changed files with 3 additions and 3 deletions
|
@ -226,7 +226,7 @@ module Spectator::DSL
|
|||
|
||||
# Store information about how the mock is defined and its context.
|
||||
# This is important for constructing an instance of the mock later.
|
||||
::Spectator::DSL::Mocks::TYPES << {type.id.symbolize, @type.name(generic_args: false).symbolize, "::#{resolved.name}::#{mock_type_name}".id.symbolize}
|
||||
::Spectator::DSL::Mocks::TYPES << {type.id.symbolize, @type.name(generic_args: false).symbolize, "#{"::".id unless resolved.name.starts_with?("::")}#{resolved.name}::#{mock_type_name}".id.symbolize}
|
||||
|
||||
base = if resolved.class?
|
||||
:class
|
||||
|
@ -237,7 +237,7 @@ module Spectator::DSL
|
|||
end %}
|
||||
|
||||
{% begin %}
|
||||
{{base.id}} ::{{resolved.name}}
|
||||
{{base.id}} {{"::".id unless resolved.name.starts_with?("::")}}{{resolved.name}}
|
||||
::Spectator::Mock.define_subtype({{base}}, {{type.id}}, {{mock_type_name}}, {{name}}, {{**value_methods}}) {{block}}
|
||||
end
|
||||
{% end %}
|
||||
|
|
|
@ -149,7 +149,7 @@ module Spectator
|
|||
macro inject(base, type_name, name = nil, **value_methods, &block)
|
||||
{% begin %}
|
||||
{% if name %}@[::Spectator::StubbedName({{name}})]{% end %}
|
||||
{{base.id}} ::{{type_name.id}}
|
||||
{{base.id}} {{"::".id unless type_name.id.starts_with?("::")}}{{type_name.id}}
|
||||
include ::Spectator::Mocked
|
||||
extend ::Spectator::StubbedType
|
||||
|
||||
|
|
Loading…
Reference in a new issue