mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix usage of deprecated double splat syntax in macros
This commit is contained in:
parent
a634046a86
commit
a93908d507
1 changed files with 9 additions and 9 deletions
|
@ -31,7 +31,7 @@ module Spectator::DSL
|
||||||
::Spectator::DSL::Mocks::TYPES << {name.id.symbolize, @type.name(generic_args: false).symbolize, double_type_name.symbolize} %}
|
::Spectator::DSL::Mocks::TYPES << {name.id.symbolize, @type.name(generic_args: false).symbolize, double_type_name.symbolize} %}
|
||||||
|
|
||||||
# Define the plain double type.
|
# Define the plain double type.
|
||||||
::Spectator::Double.define({{double_type_name}}, {{name}}, {{**value_methods}}) do
|
::Spectator::Double.define({{double_type_name}}, {{name}}, {{value_methods.double_splat}}) do
|
||||||
# Returns a new double that responds to undefined methods with itself.
|
# Returns a new double that responds to undefined methods with itself.
|
||||||
# See: `NullDouble`
|
# See: `NullDouble`
|
||||||
def as_null_object
|
def as_null_object
|
||||||
|
@ -43,7 +43,7 @@ module Spectator::DSL
|
||||||
|
|
||||||
{% begin %}
|
{% begin %}
|
||||||
# Define a matching null double type.
|
# Define a matching null double type.
|
||||||
::Spectator::NullDouble.define({{null_double_type_name}}, {{name}}, {{**value_methods}}) {{block}}
|
::Spectator::NullDouble.define({{null_double_type_name}}, {{name}}, {{value_methods.double_splat}}) {{block}}
|
||||||
{% end %}
|
{% end %}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -94,9 +94,9 @@ module Spectator::DSL
|
||||||
|
|
||||||
begin
|
begin
|
||||||
%double = {% if found_tuple %}
|
%double = {% if found_tuple %}
|
||||||
{{found_tuple[2].id}}.new({{**value_methods}})
|
{{found_tuple[2].id}}.new({{value_methods.double_splat}})
|
||||||
{% else %}
|
{% else %}
|
||||||
::Spectator::LazyDouble.new({{name}}, {{**value_methods}})
|
::Spectator::LazyDouble.new({{name}}, {{value_methods.double_splat}})
|
||||||
{% end %}
|
{% end %}
|
||||||
::Spectator::Harness.current?.try(&.cleanup { %double._spectator_reset })
|
::Spectator::Harness.current?.try(&.cleanup { %double._spectator_reset })
|
||||||
%double
|
%double
|
||||||
|
@ -176,7 +176,7 @@ module Spectator::DSL
|
||||||
# See `#def_double`.
|
# See `#def_double`.
|
||||||
macro double(name, **value_methods, &block)
|
macro double(name, **value_methods, &block)
|
||||||
{% begin %}
|
{% begin %}
|
||||||
{% if @def %}new_double{% else %}def_double{% end %}({{name}}, {{**value_methods}}) {{block}}
|
{% if @def %}new_double{% else %}def_double{% end %}({{name}}, {{value_methods.double_splat}}) {{block}}
|
||||||
{% end %}
|
{% end %}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ module Spectator::DSL
|
||||||
# expect(dbl.foo).to eq(42)
|
# expect(dbl.foo).to eq(42)
|
||||||
# ```
|
# ```
|
||||||
macro double(**value_methods)
|
macro double(**value_methods)
|
||||||
::Spectator::LazyDouble.new({{**value_methods}})
|
::Spectator::LazyDouble.new({{value_methods.double_splat}})
|
||||||
end
|
end
|
||||||
|
|
||||||
# Defines a new mock type.
|
# Defines a new mock type.
|
||||||
|
@ -238,7 +238,7 @@ module Spectator::DSL
|
||||||
|
|
||||||
{% begin %}
|
{% begin %}
|
||||||
{{base.id}} {{"::".id unless resolved.name.starts_with?("::")}}{{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}}
|
::Spectator::Mock.define_subtype({{base}}, {{type.id}}, {{mock_type_name}}, {{name}}, {{value_methods.double_splat}}) {{block}}
|
||||||
end
|
end
|
||||||
{% end %}
|
{% end %}
|
||||||
end
|
end
|
||||||
|
@ -321,7 +321,7 @@ module Spectator::DSL
|
||||||
macro mock(type, **value_methods, &block)
|
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) %}
|
{% 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 %}
|
{% begin %}
|
||||||
{% if @def %}new_mock{% else %}def_mock{% end %}({{type}}, {{**value_methods}}) {{block}}
|
{% if @def %}new_mock{% else %}def_mock{% end %}({{type}}, {{value_methods.double_splat}}) {{block}}
|
||||||
{% end %}
|
{% end %}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -431,7 +431,7 @@ module Spectator::DSL
|
||||||
# This isn't required, but new_mock() should still find this type.
|
# This isn't required, but new_mock() should still find this type.
|
||||||
::Spectator::DSL::Mocks::TYPES << {type.id.symbolize, @type.name(generic_args: false).symbolize, resolved.name.symbolize} %}
|
::Spectator::DSL::Mocks::TYPES << {type.id.symbolize, @type.name(generic_args: false).symbolize, resolved.name.symbolize} %}
|
||||||
|
|
||||||
::Spectator::Mock.inject({{base}}, {{resolved.name}}, {{**value_methods}}) {{block}}
|
::Spectator::Mock.inject({{base}}, {{resolved.name}}, {{value_methods.double_splat}}) {{block}}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Targets a stubbable object (such as a mock or double) for operations.
|
# Targets a stubbable object (such as a mock or double) for operations.
|
||||||
|
|
Loading…
Reference in a new issue