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)
|
||||
# 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 %}
|
||||
|
||||
class Given%given < {{@type.id}}
|
||||
|
@ -27,17 +27,17 @@ module Spectator::DSL
|
|||
let({{assignment.target}}) { {{assignment.value}} }
|
||||
{% end %}
|
||||
{% for name, value in kwargs %}
|
||||
{% if name != :it %}let({{name}}) { {{value}} }{% end %}
|
||||
let({{name}}) { {{value}} }
|
||||
{% end %}
|
||||
|
||||
{% if block %}
|
||||
{% if description = kwargs[:it] %}
|
||||
{% if description %}
|
||||
example {{description}} {{block}}
|
||||
{% else %}
|
||||
example {{block}}
|
||||
{% end %}
|
||||
{% else %}
|
||||
{% if description = kwargs[:it] %}
|
||||
{% if description %}
|
||||
example {{description}} {{block}}
|
||||
{% else %}
|
||||
example {{assignments.splat.stringify}}
|
||||
|
|
Loading…
Reference in a new issue