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 @@ -77,7 +77,7 @@ module InstanceMethods
7777 # Returns nothing.
7878 def call
7979 self . class . organized . each do |interactor |
80- throw ( :early_return ) if context . failure?
80+ context . signal_early_return! if context . failure?
8181 interactor . call ( context )
8282 end
8383 end
Original file line number Diff line number Diff line change @@ -65,11 +65,12 @@ module Interactor
6565 instance . call
6666 end
6767
68- it "throws : early_return on failure of one of organizers" do
68+ it "signals about early_return on failure of one of organizers" do
6969 allow ( context ) . to receive ( :failure? ) . and_return ( false , true )
70+ expect ( context ) . to receive ( :signal_early_return! ) . and_throw ( :foo )
7071 expect {
7172 instance . call
72- } . to throw_symbol ( :early_return )
73+ } . to throw_symbol
7374 end
7475 end
7576 end
You can’t perform that action at this time.
0 commit comments