Closed GuyPaddock closed 6 years ago
Merging #133 into master will increase coverage by
0.01%
. The diff coverage is100%
.
@@ Coverage Diff @@
## master #133 +/- ##
============================================
+ Coverage 99.45% 99.47% +0.01%
- Complexity 349 358 +9
============================================
Files 43 44 +1
Lines 739 763 +24
Branches 22 23 +1
============================================
+ Hits 735 759 +24
Partials 4 4
Impacted Files | Coverage Δ | Complexity Δ | |
---|---|---|---|
...ghaskins/spectrum/internal/hooks/EagerLetHook.java | 100% <100%> (ø) |
3 <3> (?) |
|
...kins/spectrum/dsl/specification/Specification.java | 100% <100%> (ø) |
20 <1> (+1) |
:arrow_up: |
...m/greghaskins/spectrum/internal/hooks/LetHook.java | 100% <100%> (ø) |
8 <7> (+5) |
:arrow_up: |
Thanks for the contribution @GuyPaddock. This looks great,
The previous implementation would cause all
let
blocks to be evaluated at the start of the test rather than on an as-needed basis, which is inconsistent with the behavior developers who are used to RSpec would expect. Now,let
only evaluates its block when the test first needs a value, allowing thelet
block to depend on state that is being setup by other blocks (beforeEach
, otherlet
blocks, etc).Despite this, there was value in preserving the old implementation as Spectrum's equivalent to
let!
from RSpec. As such, I've moved that implementation over to a new DSL helper calledeagerLet
. One use case where this is useful is defining values that can be used in abeforeEach
block.Closes #132.