Module: Acta::Testing::ProjectionWritesHelpers

Defined in:
lib/acta/testing.rb

Overview

Wraps writes to ‘acta_managed!` AR models so the projection-write guard accepts them. Useful for fixtures, factories, and ad-hoc setup that needs to bypass the command + event + projection chain.

# spec/rails_helper.rb
require "acta/testing"
RSpec.configure do |config|
  Acta::Testing.projection_writes_helper!(config)
end

# in any spec:
with_projection_writes do
  Trail.create!(name: "Crank It Up", zone: zone)
end

Instance Method Summary collapse

Instance Method Details

#with_projection_writes(&block) ⇒ Object



24
25
26
# File 'lib/acta/testing.rb', line 24

def with_projection_writes(&block)
  Acta::Projection.applying!(&block)
end