Fix issue with implicit vs. explicit subject

Addresses the issue pointed out in !25

There was a recent change that set a subject to the first argument of 
`describe` and `context`. This prevented an explicitly defined subject 
from being accessible in nested groups.
This commit is contained in:
Michael Miller 2020-01-16 18:36:40 -07:00 committed by Arina Shmeleva
parent cf448576e2
commit f825a34771
2 changed files with 10 additions and 2 deletions

View file

@ -24,11 +24,11 @@ module Spectator
{{what}}
end
def subject(*args)
def _spectator_implicit_subject(*args)
described_class.new(*args)
end
{% else %}
def subject
def _spectator_implicit_subject(*args)
{{what}}
end
{% end %}

View file

@ -6,6 +6,14 @@ require "./spectator/dsl"
class SpectatorTest
include ::Spectator::DSL
def _spectator_implicit_subject
nil
end
def subject
_spectator_implicit_subject
end
def initialize(@spectator_test_values : ::Spectator::TestValues)
end
end