mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Better implementation of explicit subject
This commit is contained in:
parent
315a318d7d
commit
d9269e17a8
1 changed files with 4 additions and 4 deletions
|
@ -19,7 +19,7 @@ module Spectator::DSL
|
||||||
# expect(y).to eq(123)
|
# expect(y).to eq(123)
|
||||||
# end
|
# end
|
||||||
# ```
|
# ```
|
||||||
macro provided(*assignments, **kwargs, &block)
|
macro provided(*assignments, it description = nil, **kwargs, &block)
|
||||||
{% raise "Cannot use 'provided' inside of a test block" if @def %}
|
{% raise "Cannot use 'provided' inside of a test block" if @def %}
|
||||||
|
|
||||||
class Given%given < {{@type.id}}
|
class Given%given < {{@type.id}}
|
||||||
|
@ -27,17 +27,17 @@ module Spectator::DSL
|
||||||
let({{assignment.target}}) { {{assignment.value}} }
|
let({{assignment.target}}) { {{assignment.value}} }
|
||||||
{% end %}
|
{% end %}
|
||||||
{% for name, value in kwargs %}
|
{% for name, value in kwargs %}
|
||||||
{% if name != :it %}let({{name}}) { {{value}} }{% end %}
|
let({{name}}) { {{value}} }
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
||||||
{% if block %}
|
{% if block %}
|
||||||
{% if description = kwargs[:it] %}
|
{% if description %}
|
||||||
example {{description}} {{block}}
|
example {{description}} {{block}}
|
||||||
{% else %}
|
{% else %}
|
||||||
example {{block}}
|
example {{block}}
|
||||||
{% end %}
|
{% end %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if description = kwargs[:it] %}
|
{% if description %}
|
||||||
example {{description}} {{block}}
|
example {{description}} {{block}}
|
||||||
{% else %}
|
{% else %}
|
||||||
example {{assignments.splat.stringify}}
|
example {{assignments.splat.stringify}}
|
||||||
|
|
Loading…
Reference in a new issue