Class: RSpock::AST::StatementToAssertionTransformation
- Inherits:
-
Object
- Object
- RSpock::AST::StatementToAssertionTransformation
- Includes:
- ASTTransform::TransformationHelper
- Defined in:
- lib/rspock/ast/statement_to_assertion_transformation.rb
Overview
Transforms :rspock_binary_statement and :rspock_statement nodes into Minitest assertion calls.
Binary statements dispatch to specialized assertions (assert_equal, assert_match, assert_operator). General statements use assert_equal(true/false, expr, source_message) with negation detection.
Constant Summary collapse
- BINARY_DISPATCH =
{ :== => :assert_equal, :!= => :refute_equal, :=~ => :assert_match, :'!~' => :refute_match, }.freeze
- OPERATOR_ASSERTIONS =
%i[> < >= <=].freeze
Instance Method Summary collapse
Instance Method Details
#run(node) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rspock/ast/statement_to_assertion_transformation.rb', line 23 def run(node) case node.type when :rspock_binary_statement transform_binary_statement(node) when :rspock_statement transform_statement(node) else node end end |