mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix bug when using multiple short-hand block expects in one test
For instance, this would fail: ``` it "does something" do expect(&.foo).to be_true expect(&.false).to be_false end ```
This commit is contained in:
parent
5d8110ec6c
commit
7fc25b84c3
1 changed files with 1 additions and 1 deletions
|
@ -61,7 +61,7 @@ module Spectator
|
||||||
# { |__arg0| __arg0.foo }
|
# { |__arg0| __arg0.foo }
|
||||||
# ```
|
# ```
|
||||||
# The hack used here is to check if it looks like a compiler-generated block.
|
# The hack used here is to check if it looks like a compiler-generated block.
|
||||||
{% if block.args == ["__arg0".id] && block.body.is_a?(Call) && block.body.id =~ /^__arg0\./ %}
|
{% if block.args.size == 1 && block.args[0] =~ /^__arg\d+$/ && block.body.is_a?(Call) && block.body.id =~ /^__arg\d+\./ %}
|
||||||
# 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('.')[1..-1].join('.') %}
|
{% method_name = block.body.id.split('.')[1..-1].join('.') %}
|
||||||
|
|
Loading…
Reference in a new issue