Should capture a block instead of a value

This commit is contained in:
Michael Miller 2019-08-01 15:22:45 -06:00
parent 28680fa849
commit dd69cec536

View file

@ -70,11 +70,11 @@ module Spectator::DSL
# The raw block can't be used because it's not clear to the user.
{% method_name = block.body.id.split('.')[1..-1].join('.') %}
%partial = %proc.partial(subject)
block_actual = ::Spectator::Expectations::ActualValue.new({{"#" + method_name}}, %partial)
block_actual = ::Spectator::Expectations::ActualBlock.new({{"#" + method_name}}, %partial)
{% else %}
# In this case, it looks like the short-hand method syntax wasn't used.
# Just drop in the proc as-is.
block_actual = ::Spectator::Expectations::ActualValue.new({{"`" + block.body.stringify + "`"}}, %proc)
block_actual = ::Spectator::Expectations::ActualBlock.new({{"`" + block.body.stringify + "`"}}, %proc)
{% end %}
source = ::Spectator::Source.new({{_source_file}}, {{_source_line}})