interactor 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.standard.yml +4 -0
- data/.travis.yml +3 -1
- data/CHANGELOG.md +3 -0
- data/Gemfile +2 -0
- data/README.md +1 -0
- data/Rakefile +2 -1
- data/interactor.gemspec +9 -9
- data/lib/interactor/context.rb +1 -1
- data/spec/integration_spec.rb +303 -267
- data/spec/interactor/context_spec.rb +36 -8
- data/spec/interactor/hooks_spec.rb +13 -13
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b48d761eab051c7af366fc9acea6c7f12eef998b9d6c3f4609ee79cee5af0d47
|
4
|
+
data.tar.gz: 2c49804ece79adb02a67683c43b09d4b45088f1face4bd0e718cd4dd5e199e1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbe98a8f487d0df28c7255a8c119870cbc48a462bf8c7a5ff4cf2d00902694c5335da8b395f11be96bea41a86f1a956430efb9f4415407e74de896d54b9a9c95
|
7
|
+
data.tar.gz: b8d62604da02238a248cf93069755557300ce54b9a9a30b76b3ae914a0c4de3cd8aa1300041bc0e10c845738302ccf5643f5978b9f98ca25c6e4a37639dbaf15
|
data/.standard.yml
ADDED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
[](https://travis-ci.org/collectiveidea/interactor)
|
5
5
|
[](https://codeclimate.com/github/collectiveidea/interactor)
|
6
6
|
[](https://codeclimate.com/github/collectiveidea/interactor)
|
7
|
+
[](https://github.com/testdouble/standard)
|
7
8
|
|
8
9
|
## Getting Started
|
9
10
|
|
data/Rakefile
CHANGED
data/interactor.gemspec
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
|
1
|
+
require "English"
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
|
-
spec.name
|
5
|
-
spec.version = "3.1.
|
4
|
+
spec.name = "interactor"
|
5
|
+
spec.version = "3.1.2"
|
6
6
|
|
7
|
-
spec.author
|
8
|
-
spec.email
|
7
|
+
spec.author = "Collective Idea"
|
8
|
+
spec.email = "info@collectiveidea.com"
|
9
9
|
spec.description = "Interactor provides a common interface for performing complex user interactions."
|
10
|
-
spec.summary
|
11
|
-
spec.homepage
|
12
|
-
spec.license
|
10
|
+
spec.summary = "Simple interactor implementation"
|
11
|
+
spec.homepage = "https://github.com/collectiveidea/interactor"
|
12
|
+
spec.license = "MIT"
|
13
13
|
|
14
|
-
spec.files
|
14
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
15
15
|
spec.test_files = spec.files.grep(/^spec/)
|
16
16
|
|
17
17
|
spec.add_development_dependency "bundler"
|
data/lib/interactor/context.rb
CHANGED
@@ -121,7 +121,7 @@ module Interactor
|
|
121
121
|
#
|
122
122
|
# Raises Interactor::Failure initialized with the Interactor::Context.
|
123
123
|
def fail!(context = {})
|
124
|
-
context.each { |key, value|
|
124
|
+
context.each { |key, value| self[key.to_sym] = value }
|
125
125
|
@failure = true
|
126
126
|
raise Failure, self
|
127
127
|
end
|
data/spec/integration_spec.rb
CHANGED
@@ -296,19 +296,19 @@ describe "Integration" do
|
|
296
296
|
context.steps
|
297
297
|
}.from([]).to([
|
298
298
|
:around_before, :before,
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
:after, :around_after
|
299
|
+
:around_before2, :before2,
|
300
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
301
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
302
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
303
|
+
:after2, :around_after2,
|
304
|
+
:around_before3, :before3, :call3, :after3, :around_after3,
|
305
|
+
:around_before4, :before4,
|
306
|
+
:around_before4a, :before4a, :call4a, :after4a, :around_after4a,
|
307
|
+
:around_before4b, :before4b, :call4b, :after4b, :around_after4b,
|
308
|
+
:around_before4c, :before4c, :call4c, :after4c, :around_after4c,
|
309
|
+
:after4, :around_after4,
|
310
|
+
:around_before5, :before5, :call5, :after5, :around_after5,
|
311
|
+
:after, :around_after,
|
312
312
|
])
|
313
313
|
end
|
314
314
|
end
|
@@ -348,9 +348,6 @@ describe "Integration" do
|
|
348
348
|
build_organizer(organize: [organizer2, interactor3, organizer4, interactor5]) do
|
349
349
|
around do |interactor|
|
350
350
|
raise "foo"
|
351
|
-
context.steps << :around_before
|
352
|
-
interactor.call
|
353
|
-
context.steps << :around_after
|
354
351
|
end
|
355
352
|
|
356
353
|
before do
|
@@ -366,7 +363,11 @@ describe "Integration" do
|
|
366
363
|
|
367
364
|
it "aborts" do
|
368
365
|
expect {
|
369
|
-
|
366
|
+
begin
|
367
|
+
organizer.call(context)
|
368
|
+
rescue
|
369
|
+
nil
|
370
|
+
end
|
370
371
|
}.not_to change {
|
371
372
|
context.steps
|
372
373
|
}
|
@@ -405,7 +406,7 @@ describe "Integration" do
|
|
405
406
|
}.to change {
|
406
407
|
context.steps
|
407
408
|
}.from([]).to([
|
408
|
-
:around_before
|
409
|
+
:around_before,
|
409
410
|
])
|
410
411
|
end
|
411
412
|
end
|
@@ -421,7 +422,6 @@ describe "Integration" do
|
|
421
422
|
|
422
423
|
before do
|
423
424
|
raise "foo"
|
424
|
-
context.steps << :before
|
425
425
|
end
|
426
426
|
|
427
427
|
after do
|
@@ -432,11 +432,15 @@ describe "Integration" do
|
|
432
432
|
|
433
433
|
it "aborts" do
|
434
434
|
expect {
|
435
|
-
|
435
|
+
begin
|
436
|
+
organizer.call(context)
|
437
|
+
rescue
|
438
|
+
nil
|
439
|
+
end
|
436
440
|
}.to change {
|
437
441
|
context.steps
|
438
442
|
}.from([]).to([
|
439
|
-
:around_before
|
443
|
+
:around_before,
|
440
444
|
])
|
441
445
|
end
|
442
446
|
|
@@ -474,18 +478,18 @@ describe "Integration" do
|
|
474
478
|
context.steps
|
475
479
|
}.from([]).to([
|
476
480
|
:around_before, :before,
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
481
|
+
:around_before2, :before2,
|
482
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
483
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
484
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
485
|
+
:after2, :around_after2,
|
486
|
+
:around_before3, :before3, :call3, :after3, :around_after3,
|
487
|
+
:around_before4, :before4,
|
488
|
+
:around_before4a, :before4a, :call4a, :after4a, :around_after4a,
|
489
|
+
:around_before4b, :before4b, :call4b, :after4b, :around_after4b,
|
490
|
+
:around_before4c, :before4c, :call4c, :after4c, :around_after4c,
|
491
|
+
:after4, :around_after4,
|
492
|
+
:around_before5, :before5, :call5, :after5, :around_after5,
|
489
493
|
:rollback5,
|
490
494
|
:rollback4c,
|
491
495
|
:rollback4b,
|
@@ -493,7 +497,7 @@ describe "Integration" do
|
|
493
497
|
:rollback3,
|
494
498
|
:rollback2c,
|
495
499
|
:rollback2b,
|
496
|
-
:rollback2a
|
500
|
+
:rollback2a,
|
497
501
|
])
|
498
502
|
end
|
499
503
|
end
|
@@ -513,30 +517,33 @@ describe "Integration" do
|
|
513
517
|
|
514
518
|
after do
|
515
519
|
raise "foo"
|
516
|
-
context.steps << :after
|
517
520
|
end
|
518
521
|
end
|
519
522
|
}
|
520
523
|
|
521
524
|
it "rolls back successfully called interactors and the failed interactor" do
|
522
525
|
expect {
|
523
|
-
|
526
|
+
begin
|
527
|
+
organizer.call(context)
|
528
|
+
rescue
|
529
|
+
nil
|
530
|
+
end
|
524
531
|
}.to change {
|
525
532
|
context.steps
|
526
533
|
}.from([]).to([
|
527
534
|
:around_before, :before,
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
535
|
+
:around_before2, :before2,
|
536
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
537
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
538
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
539
|
+
:after2, :around_after2,
|
540
|
+
:around_before3, :before3, :call3, :after3, :around_after3,
|
541
|
+
:around_before4, :before4,
|
542
|
+
:around_before4a, :before4a, :call4a, :after4a, :around_after4a,
|
543
|
+
:around_before4b, :before4b, :call4b, :after4b, :around_after4b,
|
544
|
+
:around_before4c, :before4c, :call4c, :after4c, :around_after4c,
|
545
|
+
:after4, :around_after4,
|
546
|
+
:around_before5, :before5, :call5, :after5, :around_after5,
|
540
547
|
:rollback5,
|
541
548
|
:rollback4c,
|
542
549
|
:rollback4b,
|
@@ -544,7 +551,7 @@ describe "Integration" do
|
|
544
551
|
:rollback3,
|
545
552
|
:rollback2c,
|
546
553
|
:rollback2b,
|
547
|
-
:rollback2a
|
554
|
+
:rollback2a,
|
548
555
|
])
|
549
556
|
end
|
550
557
|
|
@@ -582,18 +589,18 @@ describe "Integration" do
|
|
582
589
|
context.steps
|
583
590
|
}.from([]).to([
|
584
591
|
:around_before, :before,
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
592
|
+
:around_before2, :before2,
|
593
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
594
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
595
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
596
|
+
:after2, :around_after2,
|
597
|
+
:around_before3, :before3, :call3, :after3, :around_after3,
|
598
|
+
:around_before4, :before4,
|
599
|
+
:around_before4a, :before4a, :call4a, :after4a, :around_after4a,
|
600
|
+
:around_before4b, :before4b, :call4b, :after4b, :around_after4b,
|
601
|
+
:around_before4c, :before4c, :call4c, :after4c, :around_after4c,
|
602
|
+
:after4, :around_after4,
|
603
|
+
:around_before5, :before5, :call5, :after5, :around_after5,
|
597
604
|
:after,
|
598
605
|
:rollback5,
|
599
606
|
:rollback4c,
|
@@ -602,7 +609,7 @@ describe "Integration" do
|
|
602
609
|
:rollback3,
|
603
610
|
:rollback2c,
|
604
611
|
:rollback2b,
|
605
|
-
:rollback2a
|
612
|
+
:rollback2a,
|
606
613
|
])
|
607
614
|
end
|
608
615
|
end
|
@@ -614,7 +621,6 @@ describe "Integration" do
|
|
614
621
|
context.steps << :around_before
|
615
622
|
interactor.call
|
616
623
|
raise "foo"
|
617
|
-
context.steps << :around_after
|
618
624
|
end
|
619
625
|
|
620
626
|
before do
|
@@ -629,23 +635,27 @@ describe "Integration" do
|
|
629
635
|
|
630
636
|
it "rolls back successfully called interactors and the failed interactor" do
|
631
637
|
expect {
|
632
|
-
|
638
|
+
begin
|
639
|
+
organizer.call(context)
|
640
|
+
rescue
|
641
|
+
nil
|
642
|
+
end
|
633
643
|
}.to change {
|
634
644
|
context.steps
|
635
645
|
}.from([]).to([
|
636
646
|
:around_before, :before,
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
647
|
+
:around_before2, :before2,
|
648
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
649
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
650
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
651
|
+
:after2, :around_after2,
|
652
|
+
:around_before3, :before3, :call3, :after3, :around_after3,
|
653
|
+
:around_before4, :before4,
|
654
|
+
:around_before4a, :before4a, :call4a, :after4a, :around_after4a,
|
655
|
+
:around_before4b, :before4b, :call4b, :after4b, :around_after4b,
|
656
|
+
:around_before4c, :before4c, :call4c, :after4c, :around_after4c,
|
657
|
+
:after4, :around_after4,
|
658
|
+
:around_before5, :before5, :call5, :after5, :around_after5,
|
649
659
|
:after,
|
650
660
|
:rollback5,
|
651
661
|
:rollback4c,
|
@@ -654,7 +664,7 @@ describe "Integration" do
|
|
654
664
|
:rollback3,
|
655
665
|
:rollback2c,
|
656
666
|
:rollback2b,
|
657
|
-
:rollback2a
|
667
|
+
:rollback2a,
|
658
668
|
])
|
659
669
|
end
|
660
670
|
|
@@ -700,14 +710,14 @@ describe "Integration" do
|
|
700
710
|
context.steps
|
701
711
|
}.from([]).to([
|
702
712
|
:around_before, :before,
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
713
|
+
:around_before2, :before2,
|
714
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
715
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
716
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
717
|
+
:after2, :around_after2,
|
708
718
|
:rollback2c,
|
709
719
|
:rollback2b,
|
710
|
-
:rollback2a
|
720
|
+
:rollback2a,
|
711
721
|
])
|
712
722
|
end
|
713
723
|
end
|
@@ -717,9 +727,6 @@ describe "Integration" do
|
|
717
727
|
build_interactor do
|
718
728
|
around do |interactor|
|
719
729
|
raise "foo"
|
720
|
-
context.steps << :around_before3
|
721
|
-
interactor.call
|
722
|
-
context.steps << :around_after3
|
723
730
|
end
|
724
731
|
|
725
732
|
before do
|
@@ -742,19 +749,23 @@ describe "Integration" do
|
|
742
749
|
|
743
750
|
it "rolls back successfully called interactors" do
|
744
751
|
expect {
|
745
|
-
|
752
|
+
begin
|
753
|
+
organizer.call(context)
|
754
|
+
rescue
|
755
|
+
nil
|
756
|
+
end
|
746
757
|
}.to change {
|
747
758
|
context.steps
|
748
759
|
}.from([]).to([
|
749
760
|
:around_before, :before,
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
761
|
+
:around_before2, :before2,
|
762
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
763
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
764
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
765
|
+
:after2, :around_after2,
|
755
766
|
:rollback2c,
|
756
767
|
:rollback2b,
|
757
|
-
:rollback2a
|
768
|
+
:rollback2a,
|
758
769
|
])
|
759
770
|
end
|
760
771
|
|
@@ -800,15 +811,15 @@ describe "Integration" do
|
|
800
811
|
context.steps
|
801
812
|
}.from([]).to([
|
802
813
|
:around_before, :before,
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
814
|
+
:around_before2, :before2,
|
815
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
816
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
817
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
818
|
+
:after2, :around_after2,
|
819
|
+
:around_before3,
|
809
820
|
:rollback2c,
|
810
821
|
:rollback2b,
|
811
|
-
:rollback2a
|
822
|
+
:rollback2a,
|
812
823
|
])
|
813
824
|
end
|
814
825
|
end
|
@@ -824,7 +835,6 @@ describe "Integration" do
|
|
824
835
|
|
825
836
|
before do
|
826
837
|
raise "foo"
|
827
|
-
context.steps << :before3
|
828
838
|
end
|
829
839
|
|
830
840
|
after do
|
@@ -843,20 +853,24 @@ describe "Integration" do
|
|
843
853
|
|
844
854
|
it "rolls back successfully called interactors" do
|
845
855
|
expect {
|
846
|
-
|
856
|
+
begin
|
857
|
+
organizer.call(context)
|
858
|
+
rescue
|
859
|
+
nil
|
860
|
+
end
|
847
861
|
}.to change {
|
848
862
|
context.steps
|
849
863
|
}.from([]).to([
|
850
864
|
:around_before, :before,
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
865
|
+
:around_before2, :before2,
|
866
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
867
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
868
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
869
|
+
:after2, :around_after2,
|
870
|
+
:around_before3,
|
857
871
|
:rollback2c,
|
858
872
|
:rollback2b,
|
859
|
-
:rollback2a
|
873
|
+
:rollback2a,
|
860
874
|
])
|
861
875
|
end
|
862
876
|
|
@@ -902,15 +916,15 @@ describe "Integration" do
|
|
902
916
|
context.steps
|
903
917
|
}.from([]).to([
|
904
918
|
:around_before, :before,
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
919
|
+
:around_before2, :before2,
|
920
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
921
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
922
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
923
|
+
:after2, :around_after2,
|
924
|
+
:around_before3, :before3,
|
911
925
|
:rollback2c,
|
912
926
|
:rollback2b,
|
913
|
-
:rollback2a
|
927
|
+
:rollback2a,
|
914
928
|
])
|
915
929
|
end
|
916
930
|
end
|
@@ -934,7 +948,6 @@ describe "Integration" do
|
|
934
948
|
|
935
949
|
def call
|
936
950
|
raise "foo"
|
937
|
-
context.steps << :call3
|
938
951
|
end
|
939
952
|
|
940
953
|
def rollback
|
@@ -945,20 +958,24 @@ describe "Integration" do
|
|
945
958
|
|
946
959
|
it "rolls back successfully called interactors" do
|
947
960
|
expect {
|
948
|
-
|
961
|
+
begin
|
962
|
+
organizer.call(context)
|
963
|
+
rescue
|
964
|
+
nil
|
965
|
+
end
|
949
966
|
}.to change {
|
950
967
|
context.steps
|
951
968
|
}.from([]).to([
|
952
969
|
:around_before, :before,
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
970
|
+
:around_before2, :before2,
|
971
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
972
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
973
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
974
|
+
:after2, :around_after2,
|
975
|
+
:around_before3, :before3,
|
959
976
|
:rollback2c,
|
960
977
|
:rollback2b,
|
961
|
-
:rollback2a
|
978
|
+
:rollback2a,
|
962
979
|
])
|
963
980
|
end
|
964
981
|
|
@@ -1004,16 +1021,16 @@ describe "Integration" do
|
|
1004
1021
|
context.steps
|
1005
1022
|
}.from([]).to([
|
1006
1023
|
:around_before, :before,
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1024
|
+
:around_before2, :before2,
|
1025
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
1026
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
1027
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
1028
|
+
:after2, :around_after2,
|
1029
|
+
:around_before3, :before3, :call3,
|
1013
1030
|
:rollback3,
|
1014
1031
|
:rollback2c,
|
1015
1032
|
:rollback2b,
|
1016
|
-
:rollback2a
|
1033
|
+
:rollback2a,
|
1017
1034
|
])
|
1018
1035
|
end
|
1019
1036
|
end
|
@@ -1033,7 +1050,6 @@ describe "Integration" do
|
|
1033
1050
|
|
1034
1051
|
after do
|
1035
1052
|
raise "foo"
|
1036
|
-
context.steps << :after3
|
1037
1053
|
end
|
1038
1054
|
|
1039
1055
|
def call
|
@@ -1048,21 +1064,25 @@ describe "Integration" do
|
|
1048
1064
|
|
1049
1065
|
it "rolls back successfully called interactors and the failed interactor" do
|
1050
1066
|
expect {
|
1051
|
-
|
1067
|
+
begin
|
1068
|
+
organizer.call(context)
|
1069
|
+
rescue
|
1070
|
+
nil
|
1071
|
+
end
|
1052
1072
|
}.to change {
|
1053
1073
|
context.steps
|
1054
1074
|
}.from([]).to([
|
1055
1075
|
:around_before, :before,
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1076
|
+
:around_before2, :before2,
|
1077
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
1078
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
1079
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
1080
|
+
:after2, :around_after2,
|
1081
|
+
:around_before3, :before3, :call3,
|
1062
1082
|
:rollback3,
|
1063
1083
|
:rollback2c,
|
1064
1084
|
:rollback2b,
|
1065
|
-
:rollback2a
|
1085
|
+
:rollback2a,
|
1066
1086
|
])
|
1067
1087
|
end
|
1068
1088
|
|
@@ -1108,16 +1128,16 @@ describe "Integration" do
|
|
1108
1128
|
context.steps
|
1109
1129
|
}.from([]).to([
|
1110
1130
|
:around_before, :before,
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1131
|
+
:around_before2, :before2,
|
1132
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
1133
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
1134
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
1135
|
+
:after2, :around_after2,
|
1136
|
+
:around_before3, :before3, :call3, :after3,
|
1117
1137
|
:rollback3,
|
1118
1138
|
:rollback2c,
|
1119
1139
|
:rollback2b,
|
1120
|
-
:rollback2a
|
1140
|
+
:rollback2a,
|
1121
1141
|
])
|
1122
1142
|
end
|
1123
1143
|
end
|
@@ -1129,7 +1149,6 @@ describe "Integration" do
|
|
1129
1149
|
context.steps << :around_before3
|
1130
1150
|
interactor.call
|
1131
1151
|
raise "foo"
|
1132
|
-
context.steps << :around_after3
|
1133
1152
|
end
|
1134
1153
|
|
1135
1154
|
before do
|
@@ -1152,21 +1171,25 @@ describe "Integration" do
|
|
1152
1171
|
|
1153
1172
|
it "rolls back successfully called interactors and the failed interactor" do
|
1154
1173
|
expect {
|
1155
|
-
|
1174
|
+
begin
|
1175
|
+
organizer.call(context)
|
1176
|
+
rescue
|
1177
|
+
nil
|
1178
|
+
end
|
1156
1179
|
}.to change {
|
1157
1180
|
context.steps
|
1158
1181
|
}.from([]).to([
|
1159
1182
|
:around_before, :before,
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1183
|
+
:around_before2, :before2,
|
1184
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
1185
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
1186
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
1187
|
+
:after2, :around_after2,
|
1188
|
+
:around_before3, :before3, :call3, :after3,
|
1166
1189
|
:rollback3,
|
1167
1190
|
:rollback2c,
|
1168
1191
|
:rollback2b,
|
1169
|
-
:rollback2a
|
1192
|
+
:rollback2a,
|
1170
1193
|
])
|
1171
1194
|
end
|
1172
1195
|
|
@@ -1212,19 +1235,19 @@ describe "Integration" do
|
|
1212
1235
|
context.steps
|
1213
1236
|
}.from([]).to([
|
1214
1237
|
:around_before, :before,
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1238
|
+
:around_before2, :before2,
|
1239
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
1240
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
1241
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
1242
|
+
:after2, :around_after2,
|
1243
|
+
:around_before3, :before3, :call3, :after3, :around_after3,
|
1244
|
+
:around_before4, :before4,
|
1245
|
+
:around_before4a, :before4a, :call4a, :after4a, :around_after4a,
|
1223
1246
|
:rollback4a,
|
1224
1247
|
:rollback3,
|
1225
1248
|
:rollback2c,
|
1226
1249
|
:rollback2b,
|
1227
|
-
:rollback2a
|
1250
|
+
:rollback2a,
|
1228
1251
|
])
|
1229
1252
|
end
|
1230
1253
|
end
|
@@ -1234,9 +1257,6 @@ describe "Integration" do
|
|
1234
1257
|
build_interactor do
|
1235
1258
|
around do |interactor|
|
1236
1259
|
raise "foo"
|
1237
|
-
context.steps << :around_before4b
|
1238
|
-
interactor.call
|
1239
|
-
context.steps << :around_after4b
|
1240
1260
|
end
|
1241
1261
|
|
1242
1262
|
before do
|
@@ -1259,24 +1279,28 @@ describe "Integration" do
|
|
1259
1279
|
|
1260
1280
|
it "rolls back successfully called interactors" do
|
1261
1281
|
expect {
|
1262
|
-
|
1282
|
+
begin
|
1283
|
+
organizer.call(context)
|
1284
|
+
rescue
|
1285
|
+
nil
|
1286
|
+
end
|
1263
1287
|
}.to change {
|
1264
1288
|
context.steps
|
1265
1289
|
}.from([]).to([
|
1266
1290
|
:around_before, :before,
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1291
|
+
:around_before2, :before2,
|
1292
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
1293
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
1294
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
1295
|
+
:after2, :around_after2,
|
1296
|
+
:around_before3, :before3, :call3, :after3, :around_after3,
|
1297
|
+
:around_before4, :before4,
|
1298
|
+
:around_before4a, :before4a, :call4a, :after4a, :around_after4a,
|
1275
1299
|
:rollback4a,
|
1276
1300
|
:rollback3,
|
1277
1301
|
:rollback2c,
|
1278
1302
|
:rollback2b,
|
1279
|
-
:rollback2a
|
1303
|
+
:rollback2a,
|
1280
1304
|
])
|
1281
1305
|
end
|
1282
1306
|
|
@@ -1322,20 +1346,20 @@ describe "Integration" do
|
|
1322
1346
|
context.steps
|
1323
1347
|
}.from([]).to([
|
1324
1348
|
:around_before, :before,
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1349
|
+
:around_before2, :before2,
|
1350
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
1351
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
1352
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
1353
|
+
:after2, :around_after2,
|
1354
|
+
:around_before3, :before3, :call3, :after3, :around_after3,
|
1355
|
+
:around_before4, :before4,
|
1356
|
+
:around_before4a, :before4a, :call4a, :after4a, :around_after4a,
|
1357
|
+
:around_before4b,
|
1334
1358
|
:rollback4a,
|
1335
1359
|
:rollback3,
|
1336
1360
|
:rollback2c,
|
1337
1361
|
:rollback2b,
|
1338
|
-
:rollback2a
|
1362
|
+
:rollback2a,
|
1339
1363
|
])
|
1340
1364
|
end
|
1341
1365
|
end
|
@@ -1351,7 +1375,6 @@ describe "Integration" do
|
|
1351
1375
|
|
1352
1376
|
before do
|
1353
1377
|
raise "foo"
|
1354
|
-
context.steps << :before4b
|
1355
1378
|
end
|
1356
1379
|
|
1357
1380
|
after do
|
@@ -1370,25 +1393,29 @@ describe "Integration" do
|
|
1370
1393
|
|
1371
1394
|
it "rolls back successfully called interactors" do
|
1372
1395
|
expect {
|
1373
|
-
|
1396
|
+
begin
|
1397
|
+
organizer.call(context)
|
1398
|
+
rescue
|
1399
|
+
nil
|
1400
|
+
end
|
1374
1401
|
}.to change {
|
1375
1402
|
context.steps
|
1376
1403
|
}.from([]).to([
|
1377
1404
|
:around_before, :before,
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1405
|
+
:around_before2, :before2,
|
1406
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
1407
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
1408
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
1409
|
+
:after2, :around_after2,
|
1410
|
+
:around_before3, :before3, :call3, :after3, :around_after3,
|
1411
|
+
:around_before4, :before4,
|
1412
|
+
:around_before4a, :before4a, :call4a, :after4a, :around_after4a,
|
1413
|
+
:around_before4b,
|
1387
1414
|
:rollback4a,
|
1388
1415
|
:rollback3,
|
1389
1416
|
:rollback2c,
|
1390
1417
|
:rollback2b,
|
1391
|
-
:rollback2a
|
1418
|
+
:rollback2a,
|
1392
1419
|
])
|
1393
1420
|
end
|
1394
1421
|
|
@@ -1434,20 +1461,20 @@ describe "Integration" do
|
|
1434
1461
|
context.steps
|
1435
1462
|
}.from([]).to([
|
1436
1463
|
:around_before, :before,
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1464
|
+
:around_before2, :before2,
|
1465
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
1466
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
1467
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
1468
|
+
:after2, :around_after2,
|
1469
|
+
:around_before3, :before3, :call3, :after3, :around_after3,
|
1470
|
+
:around_before4, :before4,
|
1471
|
+
:around_before4a, :before4a, :call4a, :after4a, :around_after4a,
|
1472
|
+
:around_before4b, :before4b,
|
1446
1473
|
:rollback4a,
|
1447
1474
|
:rollback3,
|
1448
1475
|
:rollback2c,
|
1449
1476
|
:rollback2b,
|
1450
|
-
:rollback2a
|
1477
|
+
:rollback2a,
|
1451
1478
|
])
|
1452
1479
|
end
|
1453
1480
|
end
|
@@ -1471,7 +1498,6 @@ describe "Integration" do
|
|
1471
1498
|
|
1472
1499
|
def call
|
1473
1500
|
raise "foo"
|
1474
|
-
context.steps << :call4b
|
1475
1501
|
end
|
1476
1502
|
|
1477
1503
|
def rollback
|
@@ -1482,25 +1508,29 @@ describe "Integration" do
|
|
1482
1508
|
|
1483
1509
|
it "rolls back successfully called interactors" do
|
1484
1510
|
expect {
|
1485
|
-
|
1511
|
+
begin
|
1512
|
+
organizer.call(context)
|
1513
|
+
rescue
|
1514
|
+
nil
|
1515
|
+
end
|
1486
1516
|
}.to change {
|
1487
1517
|
context.steps
|
1488
1518
|
}.from([]).to([
|
1489
1519
|
:around_before, :before,
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1520
|
+
:around_before2, :before2,
|
1521
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
1522
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
1523
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
1524
|
+
:after2, :around_after2,
|
1525
|
+
:around_before3, :before3, :call3, :after3, :around_after3,
|
1526
|
+
:around_before4, :before4,
|
1527
|
+
:around_before4a, :before4a, :call4a, :after4a, :around_after4a,
|
1528
|
+
:around_before4b, :before4b,
|
1499
1529
|
:rollback4a,
|
1500
1530
|
:rollback3,
|
1501
1531
|
:rollback2c,
|
1502
1532
|
:rollback2b,
|
1503
|
-
:rollback2a
|
1533
|
+
:rollback2a,
|
1504
1534
|
])
|
1505
1535
|
end
|
1506
1536
|
|
@@ -1546,21 +1576,21 @@ describe "Integration" do
|
|
1546
1576
|
context.steps
|
1547
1577
|
}.from([]).to([
|
1548
1578
|
:around_before, :before,
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1579
|
+
:around_before2, :before2,
|
1580
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
1581
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
1582
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
1583
|
+
:after2, :around_after2,
|
1584
|
+
:around_before3, :before3, :call3, :after3, :around_after3,
|
1585
|
+
:around_before4, :before4,
|
1586
|
+
:around_before4a, :before4a, :call4a, :after4a, :around_after4a,
|
1587
|
+
:around_before4b, :before4b, :call4b,
|
1558
1588
|
:rollback4b,
|
1559
1589
|
:rollback4a,
|
1560
1590
|
:rollback3,
|
1561
1591
|
:rollback2c,
|
1562
1592
|
:rollback2b,
|
1563
|
-
:rollback2a
|
1593
|
+
:rollback2a,
|
1564
1594
|
])
|
1565
1595
|
end
|
1566
1596
|
end
|
@@ -1580,7 +1610,6 @@ describe "Integration" do
|
|
1580
1610
|
|
1581
1611
|
after do
|
1582
1612
|
raise "foo"
|
1583
|
-
context.steps << :after4b
|
1584
1613
|
end
|
1585
1614
|
|
1586
1615
|
def call
|
@@ -1595,26 +1624,30 @@ describe "Integration" do
|
|
1595
1624
|
|
1596
1625
|
it "rolls back successfully called interactors and the failed interactor" do
|
1597
1626
|
expect {
|
1598
|
-
|
1627
|
+
begin
|
1628
|
+
organizer.call(context)
|
1629
|
+
rescue
|
1630
|
+
nil
|
1631
|
+
end
|
1599
1632
|
}.to change {
|
1600
1633
|
context.steps
|
1601
1634
|
}.from([]).to([
|
1602
1635
|
:around_before, :before,
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1636
|
+
:around_before2, :before2,
|
1637
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
1638
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
1639
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
1640
|
+
:after2, :around_after2,
|
1641
|
+
:around_before3, :before3, :call3, :after3, :around_after3,
|
1642
|
+
:around_before4, :before4,
|
1643
|
+
:around_before4a, :before4a, :call4a, :after4a, :around_after4a,
|
1644
|
+
:around_before4b, :before4b, :call4b,
|
1612
1645
|
:rollback4b,
|
1613
1646
|
:rollback4a,
|
1614
1647
|
:rollback3,
|
1615
1648
|
:rollback2c,
|
1616
1649
|
:rollback2b,
|
1617
|
-
:rollback2a
|
1650
|
+
:rollback2a,
|
1618
1651
|
])
|
1619
1652
|
end
|
1620
1653
|
|
@@ -1660,21 +1693,21 @@ describe "Integration" do
|
|
1660
1693
|
context.steps
|
1661
1694
|
}.from([]).to([
|
1662
1695
|
:around_before, :before,
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1696
|
+
:around_before2, :before2,
|
1697
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
1698
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
1699
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
1700
|
+
:after2, :around_after2,
|
1701
|
+
:around_before3, :before3, :call3, :after3, :around_after3,
|
1702
|
+
:around_before4, :before4,
|
1703
|
+
:around_before4a, :before4a, :call4a, :after4a, :around_after4a,
|
1704
|
+
:around_before4b, :before4b, :call4b, :after4b,
|
1672
1705
|
:rollback4b,
|
1673
1706
|
:rollback4a,
|
1674
1707
|
:rollback3,
|
1675
1708
|
:rollback2c,
|
1676
1709
|
:rollback2b,
|
1677
|
-
:rollback2a
|
1710
|
+
:rollback2a,
|
1678
1711
|
])
|
1679
1712
|
end
|
1680
1713
|
end
|
@@ -1686,7 +1719,6 @@ describe "Integration" do
|
|
1686
1719
|
context.steps << :around_before4b
|
1687
1720
|
interactor.call
|
1688
1721
|
raise "foo"
|
1689
|
-
context.steps << :around_after4b
|
1690
1722
|
end
|
1691
1723
|
|
1692
1724
|
before do
|
@@ -1709,26 +1741,30 @@ describe "Integration" do
|
|
1709
1741
|
|
1710
1742
|
it "rolls back successfully called interactors and the failed interactor" do
|
1711
1743
|
expect {
|
1712
|
-
|
1744
|
+
begin
|
1745
|
+
organizer.call(context)
|
1746
|
+
rescue
|
1747
|
+
nil
|
1748
|
+
end
|
1713
1749
|
}.to change {
|
1714
1750
|
context.steps
|
1715
1751
|
}.from([]).to([
|
1716
1752
|
:around_before, :before,
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1753
|
+
:around_before2, :before2,
|
1754
|
+
:around_before2a, :before2a, :call2a, :after2a, :around_after2a,
|
1755
|
+
:around_before2b, :before2b, :call2b, :after2b, :around_after2b,
|
1756
|
+
:around_before2c, :before2c, :call2c, :after2c, :around_after2c,
|
1757
|
+
:after2, :around_after2,
|
1758
|
+
:around_before3, :before3, :call3, :after3, :around_after3,
|
1759
|
+
:around_before4, :before4,
|
1760
|
+
:around_before4a, :before4a, :call4a, :after4a, :around_after4a,
|
1761
|
+
:around_before4b, :before4b, :call4b, :after4b,
|
1726
1762
|
:rollback4b,
|
1727
1763
|
:rollback4a,
|
1728
1764
|
:rollback3,
|
1729
1765
|
:rollback2c,
|
1730
1766
|
:rollback2b,
|
1731
|
-
:rollback2a
|
1767
|
+
:rollback2a,
|
1732
1768
|
])
|
1733
1769
|
end
|
1734
1770
|
|