mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Move example-specific DSL to its own module
This commit is contained in:
parent
4bfd2b9620
commit
700108f52f
3 changed files with 8 additions and 4 deletions
|
@ -168,6 +168,7 @@ module Spectator
|
||||||
{% given_vars = ::Spectator::ContextDefinitions::ALL[parent_module.id][:given] %}
|
{% given_vars = ::Spectator::ContextDefinitions::ALL[parent_module.id][:given] %}
|
||||||
{% var_names = given_vars.map { |v| v[:name] } %}
|
{% var_names = given_vars.map { |v| v[:name] } %}
|
||||||
class {{class_name.id}} < ::Spectator::Example
|
class {{class_name.id}} < ::Spectator::Example
|
||||||
|
include ExampleDSL
|
||||||
include Locals
|
include Locals
|
||||||
|
|
||||||
{% if given_vars.empty? %}
|
{% if given_vars.empty? %}
|
||||||
|
|
|
@ -7,10 +7,6 @@ module Spectator
|
||||||
def initialize(@context)
|
def initialize(@context)
|
||||||
end
|
end
|
||||||
|
|
||||||
macro is_expected
|
|
||||||
expect(subject)
|
|
||||||
end
|
|
||||||
|
|
||||||
abstract def run : Nil
|
abstract def run : Nil
|
||||||
abstract def description : String
|
abstract def description : String
|
||||||
end
|
end
|
||||||
|
|
7
src/spectator/example_dsl.cr
Normal file
7
src/spectator/example_dsl.cr
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
module Spectator
|
||||||
|
module ExampleDSL
|
||||||
|
macro is_expected
|
||||||
|
expect(subject)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue