mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Support shorthand &.foo(ARGS) syntax
This commit is contained in:
parent
619927b3e6
commit
1219b19d89
1 changed files with 2 additions and 2 deletions
|
@ -63,9 +63,9 @@ module Spectator::DSL
|
||||||
{% if block.args == ["__arg0".id] && block.body.is_a?(Call) && block.body.id =~ /^__arg0\./ %}
|
{% if block.args == ["__arg0".id] && block.body.is_a?(Call) && block.body.id =~ /^__arg0\./ %}
|
||||||
# Extract the method name to make it clear to the user what is tested.
|
# Extract the method name to make it clear to the user what is tested.
|
||||||
# The raw block can't be used because it's not clear to the user.
|
# The raw block can't be used because it's not clear to the user.
|
||||||
{% method_name = block.body.id.split('.').last %}
|
{% method_name = block.body.id.split('.')[1..-1].join('.') %}
|
||||||
# TODO: Maybe pass the subject in as __arg0 instead of prefixing the method name.
|
# TODO: Maybe pass the subject in as __arg0 instead of prefixing the method name.
|
||||||
::Spectator::Expectations::ValueExpectationPartial.new(subject.{{method_name}}, {{"#" + method_name}}, {{_source_file}}, {{_source_line}})
|
::Spectator::Expectations::ValueExpectationPartial.new(subject.{{method_name.id}}, {{"#" + method_name}}, {{_source_file}}, {{_source_line}})
|
||||||
{% else %}
|
{% else %}
|
||||||
# In this case, it looks like the short-hand method syntax wasn't used.
|
# In this case, it looks like the short-hand method syntax wasn't used.
|
||||||
# Just drop in the block as-is.
|
# Just drop in the block as-is.
|
||||||
|
|
Loading…
Reference in a new issue