Pass along block only if it exists

This commit is contained in:
Michael Miller 2022-03-19 11:28:36 -06:00
parent a508aeb4a3
commit 4dff018330
No known key found for this signature in database
GPG key ID: AC78B32D30CE34A2

View file

@ -52,9 +52,11 @@ module Spectator::DSL
# This is important for constructing an instance of the double later.
::Spectator::DSL::Mocks::DOUBLES << {name_symbol, context_type_name, double_type_name} %}
::Spectator::Double.define({{double_type_name}}, {{name}}, {{value_methods.double_splat}}) do
{{block.body}}
end
{% begin %}
::Spectator::Double.define({{double_type_name}}, {{name}}, {{value_methods.double_splat}}){% if block %} do
{{block.body}}
end{% end %}
{% end %}
{% end %}
end
end