feat: Spock-style implicit assertions for Then/Expect blocks#7
Merged
JPDuchesne merged 1 commit intomasterfrom Feb 28, 2026
Merged
feat: Spock-style implicit assertions for Then/Expect blocks#7JPDuchesne merged 1 commit intomasterfrom
JPDuchesne merged 1 commit intomasterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
a8e301b to
9e76fe6
Compare
Every non-assignment statement in Then/Expect blocks is now an assertion, matching Spock's core model. Binary operators (==, !=, =~, !~, >, <, >=, <=) map to specialized Minitest assertions; bare boolean expressions use assert_equal(true/false, expr) with the original source text in the error message. Negation (!expr) is detected automatically. Introduces StatementParser for classification and StatementToAssertionTransformation for Minitest mapping. Removes the old ComparisonToAssertionTransformation. Backfills CHANGELOG for all prior versions and updates README documentation. Made-with: Cursor
9e76fe6 to
789d55c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
==,!=,=~,!~,>,<,>=,<=map to specialized Minitest assertions (assert_equal,refute_equal,assert_match,refute_match,assert_operator) with clear error messages.obj.valid?) are wrapped inassert_equal(true, expr)with the original source text in the error message. Negation (!expr) is detected and maps toassert_equal(false, inner_expr).StatementParserclassifies statements at parse time;StatementToAssertionTransformationhandles Minitest mapping. Replaces the oldComparisonToAssertionTransformation.Test plan
bundle exec rake testpasses (unit + integration tests)StatementParserTestcovers assignment passthrough, binary operator classification, and general statement wrapping with source textStatementToAssertionTransformationTestcovers all 8 binary operators, general statements, and negationThenBlockTestandExpectBlockTestverify new node typesExampleRSpockTestexercise=~,>,<,>=,<=, bare predicates, negation, and variable assignments in Expect/Then blocksMade with Cursor