Fix example methods overriding previously defined methods

This commit is contained in:
Michael Miller 2020-10-17 12:12:04 -06:00
parent 27875631d3
commit 788b12a8bc
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD
2 changed files with 3 additions and 3 deletions

View file

@ -7,7 +7,7 @@ module Spectator::DSL
macro {{name.id}}(what = nil, &block) macro {{name.id}}(what = nil, &block)
\{% raise "Cannot use '{{name.id}}' inside of a test block" if @def %} \{% raise "Cannot use '{{name.id}}' inside of a test block" if @def %}
def %test def \%test
\{{block.body}} \{{block.body}}
end end
@ -15,7 +15,7 @@ module Spectator::DSL
_spectator_example_name(\{{what}}), _spectator_example_name(\{{what}}),
::Spectator::Source.new(\{{block.filename}}, \{{block.line_number}}), ::Spectator::Source.new(\{{block.filename}}, \{{block.line_number}}),
\{{@type.name}}.new \{{@type.name}}.new
) { |example, context| context.as(\{{@type.name}}).%test } ) { |example, context| context.as(\{{@type.name}}).\%test }
end end
end end

View file

@ -13,7 +13,7 @@ module Spectator::DSL
macro {{name.id}}(what, &block) macro {{name.id}}(what, &block)
\{% raise "Cannot use '{{name.id}}' inside of a test block" if @def %} \{% raise "Cannot use '{{name.id}}' inside of a test block" if @def %}
class Group%group < \{{@type.id}} class Group\%group < \{{@type.id}}
_spectator_group_subject(\{{what}}) _spectator_group_subject(\{{what}})
::Spectator::DSL::Builder.start_group( ::Spectator::DSL::Builder.start_group(