Cache implicit subject

This commit is contained in:
Michael Miller 2021-01-16 12:10:52 -07:00
parent d738494fdf
commit 5ea83f51bb
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD

View file

@ -13,6 +13,8 @@ class SpectatorTestContext < SpectatorContext
include ::Spectator::DSL::Matchers
include ::Spectator::DSL::Values
@subject = ::Spectator::LazyWrapper.new
# Initial implicit subject for tests.
# This method should be overridden by example groups when an object is described.
private def _spectator_implicit_subject
@ -22,8 +24,7 @@ class SpectatorTestContext < SpectatorContext
# Initial subject for tests.
# Returns the implicit subject.
# This method should be overridden when an explicit subject is defined by the DSL.
# TODO: Subject needs to be cached.
private def subject
_spectator_implicit_subject
@subject.get { _spectator_implicit_subject }
end
end