diff --git a/lib/interactor/organizer.rb b/lib/interactor/organizer.rb index d119934..d943c27 100644 --- a/lib/interactor/organizer.rb +++ b/lib/interactor/organizer.rb @@ -121,12 +121,14 @@ module InstanceMethods # # Returns nothing. def call + context._current_interactor_class = nil call! end def call! begin self.class.organized.each do |interactor| + context._current_interactor_class = interactor interactor.call!(context) end ensure diff --git a/spec/interactor/organizer_spec.rb b/spec/interactor/organizer_spec.rb index 8b383ec..c6c940a 100644 --- a/spec/interactor/organizer_spec.rb +++ b/spec/interactor/organizer_spec.rb @@ -3,6 +3,8 @@ module Interactor include_examples :lint let(:organizer) { Class.new.send(:include, Organizer) } + let(:instance) { organizer.new } + let(:context) { Interactor::Context.new } let(:interactor2) { double(:interactor2) } let(:interactor3) { double(:interactor3) } @@ -33,9 +35,6 @@ module Interactor end describe "#call" do - let(:instance) { organizer.new } - let(:context) { double(:context) } - before do allow(instance).to receive(:context) { context } allow(organizer).to receive(:organized) { @@ -77,8 +76,6 @@ module Interactor end describe "#call" do - let(:instance) { organizer.new } - let(:context) { double(:context) } let(:interactor5) { double(:interactor5) } before do