Class: Tryouts::ExpectationEvaluators::Exception

Inherits:
Base
  • Object
show all
Defined in:
lib/tryouts/expectation_evaluators/exception.rb

Instance Attribute Summary

Attributes inherited from Base

#context, #expectation, #test_case

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Tryouts::ExpectationEvaluators::Base

Class Method Details

.handles?(expectation_type) ⇒ Boolean

Returns:



10
11
12
# File 'lib/tryouts/expectation_evaluators/exception.rb', line 10

def self.handles?(expectation_type)
  expectation_type == :exception
end

Instance Method Details

#evaluate(_actual_result = nil, caught_exception: nil) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/tryouts/expectation_evaluators/exception.rb', line 14

def evaluate(_actual_result = nil, caught_exception: nil)
  if caught_exception
    # Use the pre-caught exception to avoid double execution
    evaluate_exception_condition(caught_exception)
  else
    # Fallback for direct calls - shouldn't happen in normal flow
    execute_test_code_and_evaluate_exception
  end
end