File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed
Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,10 @@ def failure?
123123 def fail! ( context = { } )
124124 context . each { |key , value | modifiable [ key . to_sym ] = value }
125125 @failure = true
126+ signal_early_return!
127+ end
128+
129+ def signal_early_return!
126130 throw :early_return
127131 end
128132
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ module InstanceMethods
7676 # Returns nothing.
7777 def call
7878 self . class . organized . each do |interactor |
79- throw ( :early_return ) if context . failure?
79+ context . signal_early_return! if context . failure?
8080 interactor . call ( context )
8181 end
8282 end
Original file line number Diff line number Diff line change @@ -55,11 +55,12 @@ module Interactor
5555 instance . call
5656 end
5757
58- it "throws : early_return on failure of one of organizers" do
58+ it "signals about early_return on failure of one of organizers" do
5959 allow ( context ) . to receive ( :failure? ) . and_return ( false , true )
60+ expect ( context ) . to receive ( :signal_early_return! ) . and_throw ( :foo )
6061 expect {
6162 instance . call
62- } . to throw_symbol ( :early_return )
63+ } . to throw_symbol
6364 end
6465 end
6566 end
You can’t perform that action at this time.
0 commit comments