Skip to content

Commit

Permalink
Added current_interactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfox1985 committed May 16, 2022
1 parent 26bff18 commit 734a4b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 3 additions & 0 deletions lib/interactor/organizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,11 @@ def call
end

def call!
context._current_interactor_class = nil

begin
self.class.organized.each do |interactor|
context._current_interactor_class = interactor
interactor.call!(context)
end
ensure
Expand Down
7 changes: 2 additions & 5 deletions spec/interactor/organizer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -77,8 +76,6 @@ module Interactor
end

describe "#call" do
let(:instance) { organizer.new }
let(:context) { double(:context) }
let(:interactor5) { double(:interactor5) }

before do
Expand Down

0 comments on commit 734a4b2

Please sign in to comment.