Fix implicit subject

This commit is contained in:
Michael Miller 2019-09-26 21:44:25 -06:00
parent f47c48b483
commit 60ca4361de
1 changed files with 10 additions and 10 deletions

View File

@ -2,26 +2,26 @@ require "../spec_builder"
module Spectator module Spectator
module DSL module DSL
macro context(description, _source_file = __FILE__, _source_line = __LINE__, &block) macro context(what, _source_file = __FILE__, _source_line = __LINE__, &block)
class Context%context < {{@type.id}} class Context%context < {{@type.id}}
{% {%
description = if description.is_a?(StringLiteral) description = if what.is_a?(StringLiteral)
if description.starts_with?("#") || description.starts_with?(".") if what.starts_with?("#") || what.starts_with?(".")
description.id.symbolize what.id.symbolize
else else
description what
end end
else else
description.symbolize what.symbolize
end end
%} %}
%source = ::Spectator::Source.new({{_source_file}}, {{_source_line}}) %source = ::Spectator::Source.new({{_source_file}}, {{_source_line}})
::Spectator::SpecBuilder.start_group({{description}}, %source) ::Spectator::SpecBuilder.start_group({{description}}, %source)
{% if description.is_a?(Path) || description.is_a?(Generic) %} {% if what.is_a?(Path) || what.is_a?(Generic) %}
macro described_class macro described_class
{{description}} {{what}}
end end
def subject(*args) def subject(*args)
@ -35,8 +35,8 @@ module Spectator
end end
end end
macro describe(description, &block) macro describe(what, &block)
context({{description}}) {{block}} context({{what}}) {{block}}
end end
macro sample(collection, count = nil, _source_file = __FILE__, _source_line = __LINE__, &block) macro sample(collection, count = nil, _source_file = __FILE__, _source_line = __LINE__, &block)