Module: YardExampleTest::Example::Comparison
- Included in:
- YardExampleTest::Example
- Defined in:
- lib/yard_example_test/example/comparison.rb
Overview
Comparison and matcher logic for verifying example expectations
This module is included into YardExampleTest::Example so that its methods have direct
access to Minitest assertions (+assert+, assert_equal, assert_nil,
diff) inherited from Minitest::Spec. It also delegates to the
Evaluator (via #evaluator) for expression evaluation.
The module handles three verification strategies:
- Block matchers — matchers that implement
supports_block_expectations?(e.g. RSpec'sraise_error,change,output). The actual expression is wrapped in aProcand passed unevaluated. - Value matchers — matchers that implement
matches?(e.g.eq,be_a,be_within). The actual expression is evaluated and the resulting value is passed. - Bare values — compared via #compare_values using error handling,
nilchecks, and===case equality.