mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Check if provided
and given
are used in a method
This commit is contained in:
parent
04d6c70f59
commit
e51ad6d504
1 changed files with 3 additions and 0 deletions
|
@ -19,6 +19,8 @@ module Spectator::DSL
|
||||||
# end
|
# end
|
||||||
# ```
|
# ```
|
||||||
macro provided(*assignments, &block)
|
macro provided(*assignments, &block)
|
||||||
|
{% raise "Cannot use 'provided' inside of a test block" if @def %}
|
||||||
|
|
||||||
class Given%given < {{@type.id}}
|
class Given%given < {{@type.id}}
|
||||||
{% for assignment in assignments %}
|
{% for assignment in assignments %}
|
||||||
let({{assignment.target}}) { {{assignment.value}} }
|
let({{assignment.target}}) { {{assignment.value}} }
|
||||||
|
@ -35,6 +37,7 @@ module Spectator::DSL
|
||||||
# :ditto:
|
# :ditto:
|
||||||
@[Deprecated("Use `provided` instead.")]
|
@[Deprecated("Use `provided` instead.")]
|
||||||
macro given(*assignments, &block)
|
macro given(*assignments, &block)
|
||||||
|
{% raise "Cannot use 'given' inside of a test block" if @def %}
|
||||||
provided({{assignments.splat}}) {{block}}
|
provided({{assignments.splat}}) {{block}}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue