Module: Funes::ProjectionTestHelper
- Defined in:
- app/helpers/funes/projection_test_helper.rb
Overview
Test helper for testing projections in isolation.
Include this module in your test classes to access helper methods that allow you to test individual projection interpretations without needing to process entire event streams.
Instance Method Summary collapse
-
#interpret_event_based_on(projection_class, event_instance, previous_state, as_of = Time.current) ⇒ ActiveModel::Model, ActiveRecord::Base
Test a single event interpretation in isolation.
Instance Method Details
#interpret_event_based_on(projection_class, event_instance, previous_state, as_of = Time.current) ⇒ ActiveModel::Model, ActiveRecord::Base
Test a single event interpretation in isolation.
This method extracts and executes a single interpretation block from a projection, allowing you to test how specific events transform state without processing entire event streams.
49 50 51 52 |
# File 'app/helpers/funes/projection_test_helper.rb', line 49 def interpret_event_based_on(projection_class, event_instance, previous_state, as_of = Time.current) projection_class.instance_variable_get(:@interpretations)[event_instance.class] .call(previous_state, event_instance, as_of) end |