Verified Commit d9269e17 authored by Mike Miller's avatar Mike Miller
Browse files

Better implementation of explicit subject

parent 315a318d
Pipeline #427643732 passed with stages
in 2 minutes and 54 seconds
......@@ -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}}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment