Skip to content

Add raises assertion#9

Merged
JPDuchesne merged 1 commit intomasterfrom
jpd/add-raises-assertion
Mar 1, 2026
Merged

Add raises assertion#9
JPDuchesne merged 1 commit intomasterfrom
jpd/add-raises-assertion

Conversation

@JPDuchesne
Copy link
Copy Markdown
Contributor

@JPDuchesne JPDuchesne commented Mar 1, 2026

Summary

  • Add Spock-style raises exception conditions for Then blocks: raises ExceptionClass wraps the preceding When block in an exception assertion, and e = raises ExceptionClass captures the exception for further property assertions.
  • Rename interaction outcome nodes from rspock_returns / rspock_raises to rspock_stub_returns / rspock_stub_raises to free up the clean rspock_raises type for exception conditions.
  • Add documentation (README section + CHANGELOG entry) and comprehensive test coverage including data-driven Where block integration.

Test plan

  • Unit tests for StatementParser covering raises detection (direct, assigned, and negative cases)
  • Unit tests for ThenBlock validation (at most one raises per block)
  • Unit tests for ExpectBlock validation (raises disallowed)
  • Interaction parser tests updated for renamed stub_* node types
  • Integration tests in example_rspock_test.rb: basic raises, capture with property assertion, and data-driven raises with Where block
  • All existing tests pass (no regressions from node rename)

@JPDuchesne JPDuchesne merged commit 97f83a5 into master Mar 1, 2026
3 checks passed
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants