-
-
Notifications
You must be signed in to change notification settings - Fork 760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade Spek to v2.0.8 #1992
Upgrade Spek to v2.0.8 #1992
Conversation
I'm guessing the failure is due to a behaviour change in Spek meaning Changing |
@3flex I'm on it. That's only a part of the problem. |
'subject' can not be accessed in this context. java.lang.AssertionError: 'subject' can not be accessed in this context.
Codecov Report
@@ Coverage Diff @@
## master #1992 +/- ##
========================================
Coverage ? 80.7%
Complexity ? 1979
========================================
Files ? 329
Lines ? 5577
Branches ? 1021
========================================
Hits ? 4501
Misses ? 538
Partials ? 538 Continue to review full report at Codecov.
|
@@ -35,7 +35,7 @@ class FileBasedFindingsReportSpec : Spek({ | |||
Pair("EmptySmells", emptyList()) | |||
) | |||
} | |||
val output = subject.render(detektion)?.trimEnd()?.decolorized() | |||
val output by memoized { subject.render(detektion)?.trimEnd()?.decolorized() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to put this line in the it()
context... the Spek docs say not to use memoized for holding the result of an action https://www.spekframework.org/core-concepts/#scope-values
So instead:
it("has the reference content") {
val output = subject.render(detektion)?.trimEnd()?.decolorized()
assertThat(output).isEqualTo(expectedContent)
Will that work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the updated commit we lint
/compileAndLint
the code for each and every test case, which is not really what we want.
BeforeEachGroup
also doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is putting all assertions into a single test case for the tests that assert multiple things for each test file.
I think what you have here now though is ok. This problem will go away when test cases are moved out of the external files and into individual test cases.
The tests don't use memoized for holding the result of subject.lint(). Instead the tests use a fixture for holding the linted code. https://www.spekframework.org/core-concepts/#scope-values
* Upgrade Spek to v2.0.8 * Disable Spek timeouts * Fix Spek exceptions with by memoized clause 'subject' can not be accessed in this context. java.lang.AssertionError: 'subject' can not be accessed in this context. * Use a Spek fixture for holding the result The tests don't use memoized for holding the result of subject.lint(). Instead the tests use a fixture for holding the linted code. https://www.spekframework.org/core-concepts/#scope-values
* Upgrade Spek to v2.0.8 * Disable Spek timeouts * Fix Spek exceptions with by memoized clause 'subject' can not be accessed in this context. java.lang.AssertionError: 'subject' can not be accessed in this context. * Use a Spek fixture for holding the result The tests don't use memoized for holding the result of subject.lint(). Instead the tests use a fixture for holding the linted code. https://www.spekframework.org/core-concepts/#scope-values
No description provided.