Rolling back previous interactors does not update organizer context
Closed this issue · 0 comments
aka-momo commented
class FooInteractor < ActiveInteractor::Base
def perform
context.foo = "hello"
end
def rollback
puts 'Rolling Back FooInteractor'
context.foo = "Hi"
puts "FooInteractor foo => #{context.foo}"
end
end
class BarInteractor < ActiveInteractor::Base
def perform
context.bar = 'earth'
context.fail!
end
def rollback
puts 'Rolling Back BarInteractor'
context.bar = 'world'
puts "BarInteractor bar => #{context.bar}"
end
end
class TestOrganizer < ActiveInteractor::Organizer::Base
organize do
add :foo_interactor
add :bar_interactor
end
end
Current Behavior
result = TestOrganizer.perform
# Rolling Back BarInteractor
# BarInteractor bar => world
# Rolling Back FooInteractor
# FooInteractor foo => Hi
puts result
# #<TestOrganizer::Context foo="hello", bar="world">
Expected Behavior
result = TestOrganizer.perform
# Rolling Back BarInteractor
# BarInteractor bar => world
# Rolling Back FooInteractor
# FooInteractor foo => Hi
puts result
# #<TestOrganizer::Context foo="Hi", bar="world">
Additional Comments
Rolling back BarInteractor
changes TestOrganizer::Context.bar
from earth
to world
while rolling back FooInteractor
does not change TestOrganizer::Context.foo
from Hello
to Hi
- blocked by #291