spec/integration_spec.rb in interactor-3.1.1 vs spec/integration_spec.rb in interactor-3.1.2
- old
+ new
@@ -294,23 +294,23 @@
organizer.call(context)
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3, :around_after3,
- :around_before4, :before4,
- :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
- :around_before4b, :before4b, :call4b, :after4b, :around_after4b,
- :around_before4c, :before4c, :call4c, :after4c, :around_after4c,
- :after4, :around_after4,
- :around_before5, :before5, :call5, :after5, :around_after5,
- :after, :around_after
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3, :around_after3,
+ :around_before4, :before4,
+ :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
+ :around_before4b, :before4b, :call4b, :after4b, :around_after4b,
+ :around_before4c, :before4c, :call4c, :after4c, :around_after4c,
+ :after4, :around_after4,
+ :around_before5, :before5, :call5, :after5, :around_after5,
+ :after, :around_after,
])
end
end
context "when an around hook fails early" do
@@ -346,13 +346,10 @@
context "when an around hook errors early" do
let(:organizer) {
build_organizer(organize: [organizer2, interactor3, organizer4, interactor5]) do
around do |interactor|
raise "foo"
- context.steps << :around_before
- interactor.call
- context.steps << :around_after
end
before do
context.fail!
context.steps << :before
@@ -364,11 +361,15 @@
end
}
it "aborts" do
expect {
- organizer.call(context) rescue nil
+ begin
+ organizer.call(context)
+ rescue
+ nil
+ end
}.not_to change {
context.steps
}
end
@@ -403,11 +404,11 @@
expect {
organizer.call(context)
}.to change {
context.steps
}.from([]).to([
- :around_before
+ :around_before,
])
end
end
context "when a before hook errors" do
@@ -419,26 +420,29 @@
context.steps << :around_after
end
before do
raise "foo"
- context.steps << :before
end
after do
context.steps << :after
end
end
}
it "aborts" do
expect {
- organizer.call(context) rescue nil
+ begin
+ organizer.call(context)
+ rescue
+ nil
+ end
}.to change {
context.steps
}.from([]).to([
- :around_before
+ :around_before,
])
end
it "raises the error" do
expect {
@@ -472,30 +476,30 @@
organizer.call(context)
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3, :around_after3,
- :around_before4, :before4,
- :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
- :around_before4b, :before4b, :call4b, :after4b, :around_after4b,
- :around_before4c, :before4c, :call4c, :after4c, :around_after4c,
- :after4, :around_after4,
- :around_before5, :before5, :call5, :after5, :around_after5,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3, :around_after3,
+ :around_before4, :before4,
+ :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
+ :around_before4b, :before4b, :call4b, :after4b, :around_after4b,
+ :around_before4c, :before4c, :call4c, :after4c, :around_after4c,
+ :after4, :around_after4,
+ :around_before5, :before5, :call5, :after5, :around_after5,
:rollback5,
:rollback4c,
:rollback4b,
:rollback4a,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
end
context "when an after hook errors" do
@@ -511,42 +515,45 @@
context.steps << :before
end
after do
raise "foo"
- context.steps << :after
end
end
}
it "rolls back successfully called interactors and the failed interactor" do
expect {
- organizer.call(context) rescue nil
+ begin
+ organizer.call(context)
+ rescue
+ nil
+ end
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3, :around_after3,
- :around_before4, :before4,
- :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
- :around_before4b, :before4b, :call4b, :after4b, :around_after4b,
- :around_before4c, :before4c, :call4c, :after4c, :around_after4c,
- :after4, :around_after4,
- :around_before5, :before5, :call5, :after5, :around_after5,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3, :around_after3,
+ :around_before4, :before4,
+ :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
+ :around_before4b, :before4b, :call4b, :after4b, :around_after4b,
+ :around_before4c, :before4c, :call4c, :after4c, :around_after4c,
+ :after4, :around_after4,
+ :around_before5, :before5, :call5, :after5, :around_after5,
:rollback5,
:rollback4c,
:rollback4b,
:rollback4a,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
it "raises the error" do
expect {
@@ -580,31 +587,31 @@
organizer.call(context)
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3, :around_after3,
- :around_before4, :before4,
- :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
- :around_before4b, :before4b, :call4b, :after4b, :around_after4b,
- :around_before4c, :before4c, :call4c, :after4c, :around_after4c,
- :after4, :around_after4,
- :around_before5, :before5, :call5, :after5, :around_after5,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3, :around_after3,
+ :around_before4, :before4,
+ :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
+ :around_before4b, :before4b, :call4b, :after4b, :around_after4b,
+ :around_before4c, :before4c, :call4c, :after4c, :around_after4c,
+ :after4, :around_after4,
+ :around_before5, :before5, :call5, :after5, :around_after5,
:after,
:rollback5,
:rollback4c,
:rollback4b,
:rollback4a,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
end
context "when an around hook errors late" do
@@ -612,11 +619,10 @@
build_organizer(organize: [organizer2, interactor3, organizer4, interactor5]) do
around do |interactor|
context.steps << :around_before
interactor.call
raise "foo"
- context.steps << :around_after
end
before do
context.steps << :before
end
@@ -627,36 +633,40 @@
end
}
it "rolls back successfully called interactors and the failed interactor" do
expect {
- organizer.call(context) rescue nil
+ begin
+ organizer.call(context)
+ rescue
+ nil
+ end
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3, :around_after3,
- :around_before4, :before4,
- :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
- :around_before4b, :before4b, :call4b, :after4b, :around_after4b,
- :around_before4c, :before4c, :call4c, :after4c, :around_after4c,
- :after4, :around_after4,
- :around_before5, :before5, :call5, :after5, :around_after5,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3, :around_after3,
+ :around_before4, :before4,
+ :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
+ :around_before4b, :before4b, :call4b, :after4b, :around_after4b,
+ :around_before4c, :before4c, :call4c, :after4c, :around_after4c,
+ :after4, :around_after4,
+ :around_before5, :before5, :call5, :after5, :around_after5,
:after,
:rollback5,
:rollback4c,
:rollback4b,
:rollback4a,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
it "raises the error" do
expect {
@@ -698,30 +708,27 @@
organizer.call(context)
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
end
context "when a nested around hook errors early" do
let(:interactor3) {
build_interactor do
around do |interactor|
raise "foo"
- context.steps << :around_before3
- interactor.call
- context.steps << :around_after3
end
before do
context.steps << :before3
end
@@ -740,23 +747,27 @@
end
}
it "rolls back successfully called interactors" do
expect {
- organizer.call(context) rescue nil
+ begin
+ organizer.call(context)
+ rescue
+ nil
+ end
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
it "raises the error" do
expect {
@@ -798,19 +809,19 @@
organizer.call(context)
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
end
context "when a nested before hook errors" do
@@ -822,11 +833,10 @@
context.steps << :around_after3
end
before do
raise "foo"
- context.steps << :before3
end
after do
context.steps << :after3
end
@@ -841,24 +851,28 @@
end
}
it "rolls back successfully called interactors" do
expect {
- organizer.call(context) rescue nil
+ begin
+ organizer.call(context)
+ rescue
+ nil
+ end
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
it "raises the error" do
expect {
@@ -900,19 +914,19 @@
organizer.call(context)
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
end
context "when a nested call errors" do
@@ -932,35 +946,38 @@
context.steps << :after3
end
def call
raise "foo"
- context.steps << :call3
end
def rollback
context.steps << :rollback3
end
end
}
it "rolls back successfully called interactors" do
expect {
- organizer.call(context) rescue nil
+ begin
+ organizer.call(context)
+ rescue
+ nil
+ end
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
it "raises the error" do
expect {
@@ -1002,20 +1019,20 @@
organizer.call(context)
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
end
context "when a nested after hook errors" do
@@ -1031,11 +1048,10 @@
context.steps << :before3
end
after do
raise "foo"
- context.steps << :after3
end
def call
context.steps << :call3
end
@@ -1046,25 +1062,29 @@
end
}
it "rolls back successfully called interactors and the failed interactor" do
expect {
- organizer.call(context) rescue nil
+ begin
+ organizer.call(context)
+ rescue
+ nil
+ end
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
it "raises the error" do
expect {
@@ -1106,20 +1126,20 @@
organizer.call(context)
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
end
context "when a nested around hook errors late" do
@@ -1127,11 +1147,10 @@
build_interactor do
around do |interactor|
context.steps << :around_before3
interactor.call
raise "foo"
- context.steps << :around_after3
end
before do
context.steps << :before3
end
@@ -1150,25 +1169,29 @@
end
}
it "rolls back successfully called interactors and the failed interactor" do
expect {
- organizer.call(context) rescue nil
+ begin
+ organizer.call(context)
+ rescue
+ nil
+ end
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
it "raises the error" do
expect {
@@ -1210,35 +1233,32 @@
organizer.call(context)
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3, :around_after3,
- :around_before4, :before4,
- :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3, :around_after3,
+ :around_before4, :before4,
+ :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
:rollback4a,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
end
context "when a deeply nested around hook errors early" do
let(:interactor4b) {
build_interactor do
around do |interactor|
raise "foo"
- context.steps << :around_before4b
- interactor.call
- context.steps << :around_after4b
end
before do
context.steps << :before4b
end
@@ -1257,28 +1277,32 @@
end
}
it "rolls back successfully called interactors" do
expect {
- organizer.call(context) rescue nil
+ begin
+ organizer.call(context)
+ rescue
+ nil
+ end
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3, :around_after3,
- :around_before4, :before4,
- :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3, :around_after3,
+ :around_before4, :before4,
+ :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
:rollback4a,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
it "raises the error" do
expect {
@@ -1320,24 +1344,24 @@
organizer.call(context)
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3, :around_after3,
- :around_before4, :before4,
- :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
- :around_before4b,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3, :around_after3,
+ :around_before4, :before4,
+ :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
+ :around_before4b,
:rollback4a,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
end
context "when a deeply nested before hook errors" do
@@ -1349,11 +1373,10 @@
context.steps << :around_after4b
end
before do
raise "foo"
- context.steps << :before4b
end
after do
context.steps << :after4b
end
@@ -1368,29 +1391,33 @@
end
}
it "rolls back successfully called interactors" do
expect {
- organizer.call(context) rescue nil
+ begin
+ organizer.call(context)
+ rescue
+ nil
+ end
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3, :around_after3,
- :around_before4, :before4,
- :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
- :around_before4b,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3, :around_after3,
+ :around_before4, :before4,
+ :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
+ :around_before4b,
:rollback4a,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
it "raises the error" do
expect {
@@ -1432,24 +1459,24 @@
organizer.call(context)
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3, :around_after3,
- :around_before4, :before4,
- :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
- :around_before4b, :before4b,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3, :around_after3,
+ :around_before4, :before4,
+ :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
+ :around_before4b, :before4b,
:rollback4a,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
end
context "when a deeply nested call errors" do
@@ -1469,40 +1496,43 @@
context.steps << :after4b
end
def call
raise "foo"
- context.steps << :call4b
end
def rollback
context.steps << :rollback4b
end
end
}
it "rolls back successfully called interactors" do
expect {
- organizer.call(context) rescue nil
+ begin
+ organizer.call(context)
+ rescue
+ nil
+ end
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3, :around_after3,
- :around_before4, :before4,
- :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
- :around_before4b, :before4b,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3, :around_after3,
+ :around_before4, :before4,
+ :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
+ :around_before4b, :before4b,
:rollback4a,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
it "raises the error" do
expect {
@@ -1544,25 +1574,25 @@
organizer.call(context)
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3, :around_after3,
- :around_before4, :before4,
- :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
- :around_before4b, :before4b, :call4b,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3, :around_after3,
+ :around_before4, :before4,
+ :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
+ :around_before4b, :before4b, :call4b,
:rollback4b,
:rollback4a,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
end
context "when a deeply nested after hook errors" do
@@ -1578,11 +1608,10 @@
context.steps << :before4b
end
after do
raise "foo"
- context.steps << :after4b
end
def call
context.steps << :call4b
end
@@ -1593,30 +1622,34 @@
end
}
it "rolls back successfully called interactors and the failed interactor" do
expect {
- organizer.call(context) rescue nil
+ begin
+ organizer.call(context)
+ rescue
+ nil
+ end
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3, :around_after3,
- :around_before4, :before4,
- :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
- :around_before4b, :before4b, :call4b,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3, :around_after3,
+ :around_before4, :before4,
+ :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
+ :around_before4b, :before4b, :call4b,
:rollback4b,
:rollback4a,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
it "raises the error" do
expect {
@@ -1658,25 +1691,25 @@
organizer.call(context)
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3, :around_after3,
- :around_before4, :before4,
- :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
- :around_before4b, :before4b, :call4b, :after4b,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3, :around_after3,
+ :around_before4, :before4,
+ :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
+ :around_before4b, :before4b, :call4b, :after4b,
:rollback4b,
:rollback4a,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
end
context "when a deeply nested around hook errors late" do
@@ -1684,11 +1717,10 @@
build_interactor do
around do |interactor|
context.steps << :around_before4b
interactor.call
raise "foo"
- context.steps << :around_after4b
end
before do
context.steps << :before4b
end
@@ -1707,29 +1739,33 @@
end
}
it "rolls back successfully called interactors and the failed interactor" do
expect {
- organizer.call(context) rescue nil
+ begin
+ organizer.call(context)
+ rescue
+ nil
+ end
}.to change {
context.steps
}.from([]).to([
:around_before, :before,
- :around_before2, :before2,
- :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
- :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
- :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
- :after2, :around_after2,
- :around_before3, :before3, :call3, :after3, :around_after3,
- :around_before4, :before4,
- :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
- :around_before4b, :before4b, :call4b, :after4b,
+ :around_before2, :before2,
+ :around_before2a, :before2a, :call2a, :after2a, :around_after2a,
+ :around_before2b, :before2b, :call2b, :after2b, :around_after2b,
+ :around_before2c, :before2c, :call2c, :after2c, :around_after2c,
+ :after2, :around_after2,
+ :around_before3, :before3, :call3, :after3, :around_after3,
+ :around_before4, :before4,
+ :around_before4a, :before4a, :call4a, :after4a, :around_after4a,
+ :around_before4b, :before4b, :call4b, :after4b,
:rollback4b,
:rollback4a,
:rollback3,
:rollback2c,
:rollback2b,
- :rollback2a
+ :rollback2a,
])
end
it "raises the error" do
expect {