active_interaction 3.8.1 → 3.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/CONTRIBUTING.md +1 -1
- data/lib/active_interaction/concerns/runnable.rb +12 -17
- data/lib/active_interaction/errors.rb +2 -0
- data/lib/active_interaction/version.rb +1 -1
- data/spec/active_interaction/base_spec.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab5fbe89ea464ba3cbd680d4b444aff591500d843602bd0f94059de42c680739
|
4
|
+
data.tar.gz: cb6f3f963b5614a6eab29e611369917d9a4252948aa42e6ab9107d730745fda7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34b4222d51134f6a704d21a79d1c44e71d6edb4471156188564973a89fdfef68d156575dc0ec777d6b18ef6420e775ca61e9034fd44427c7cc4a66afb6bbad1a
|
7
|
+
data.tar.gz: 912a034a88b9c0fa10a78b83a5c8b0ceae6b3040a7c81e7550c11af16bbe60e639251e67df58c41b19b297eefcafe9a6101ae92dacaee382fec2ff1ac0fa7827
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# [3.8.2][] (2020-04-22)
|
2
|
+
|
3
|
+
## Fixed
|
4
|
+
|
5
|
+
- [479][] Composed interactions that throw errors now show a complete backtrace instead of ending at the `run!` of the outermost interaction.
|
6
|
+
|
1
7
|
# [3.8.1][] (2020-04-04)
|
2
8
|
|
3
9
|
## Fixed
|
@@ -765,6 +771,7 @@ Example.run
|
|
765
771
|
|
766
772
|
- Initial release.
|
767
773
|
|
774
|
+
[3.8.2]: https://github.com/AaronLasseigne/active_interaction/compare/v3.8.1...v3.8.2
|
768
775
|
[3.8.1]: https://github.com/AaronLasseigne/active_interaction/compare/v3.8.0...v3.8.1
|
769
776
|
[3.8.0]: https://github.com/AaronLasseigne/active_interaction/compare/v3.7.1...v3.8.0
|
770
777
|
[3.7.1]: https://github.com/AaronLasseigne/active_interaction/compare/v3.7.0...v3.7.1
|
@@ -963,3 +970,4 @@ Example.run
|
|
963
970
|
[#457]: https://github.com/AaronLasseigne/active_interaction/issues/457
|
964
971
|
[#477]: https://github.com/AaronLasseigne/active_interaction/issues/477
|
965
972
|
[#476]: https://github.com/AaronLasseigne/active_interaction/issues/476
|
973
|
+
[#479]: https://github.com/AaronLasseigne/active_interaction/issues/479
|
data/CONTRIBUTING.md
CHANGED
@@ -10,4 +10,4 @@
|
|
10
10
|
|
11
11
|
Running the tests using `rake` (with no args) will also check for style issues in the code. Ideally all submissions would pass these checks. If the code style is causing issues (particularly the method or class size) we can work with you to correct it. Don't let it stop you from contributing.
|
12
12
|
|
13
|
-
[fork]: https://github.com/
|
13
|
+
[fork]: https://github.com/AaronLasseigne/active_interaction/fork
|
@@ -71,24 +71,18 @@ module ActiveInteraction
|
|
71
71
|
|
72
72
|
# @return (see #result=)
|
73
73
|
# @return [nil]
|
74
|
-
def run
|
75
|
-
self.result =
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
if result_or_errors.is_a?(ActiveInteraction::Errors)
|
86
|
-
errors.merge!(result_or_errors)
|
87
|
-
else
|
88
|
-
result_or_errors
|
89
|
-
end
|
74
|
+
def run
|
75
|
+
return self.result = nil unless valid?
|
76
|
+
|
77
|
+
run_callbacks(:execute) do
|
78
|
+
self.result =
|
79
|
+
begin
|
80
|
+
execute
|
81
|
+
rescue Interrupt => interrupt
|
82
|
+
errors.backtrace = interrupt.errors.backtrace || interrupt.backtrace
|
83
|
+
errors.merge!(interrupt.errors)
|
90
84
|
end
|
91
|
-
|
85
|
+
end
|
92
86
|
end
|
93
87
|
|
94
88
|
# @return [Object]
|
@@ -101,6 +95,7 @@ module ActiveInteraction
|
|
101
95
|
|
102
96
|
e = InvalidInteractionError.new(errors.full_messages.join(', '))
|
103
97
|
e.interaction = self
|
98
|
+
e.set_backtrace(errors.backtrace) if errors.backtrace
|
104
99
|
raise e
|
105
100
|
end
|
106
101
|
|
@@ -24,6 +24,12 @@ InterruptInteraction = Class.new(TestInteraction) do
|
|
24
24
|
class: Object,
|
25
25
|
default: nil
|
26
26
|
|
27
|
+
# NOTE: the relative position between this method
|
28
|
+
# and the compose line should be preserved.
|
29
|
+
def self.composition_location
|
30
|
+
"#{__FILE__}:#{__LINE__ + 4}:in `execute'"
|
31
|
+
end
|
32
|
+
|
27
33
|
def execute
|
28
34
|
compose(AddInteraction, x: x, y: z)
|
29
35
|
end
|
@@ -371,6 +377,15 @@ describe ActiveInteraction::Base do
|
|
371
377
|
expect(outcome.errors.details)
|
372
378
|
.to eql(x: [{ error: :missing }], base: [{ error: 'Y is required' }])
|
373
379
|
end
|
380
|
+
|
381
|
+
it 'has the correct backtrace' do
|
382
|
+
begin
|
383
|
+
described_class.run!(inputs)
|
384
|
+
rescue ActiveInteraction::InvalidInteractionError => e
|
385
|
+
expect(e.backtrace)
|
386
|
+
.to include(InterruptInteraction.composition_location)
|
387
|
+
end
|
388
|
+
end
|
374
389
|
end
|
375
390
|
end
|
376
391
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_interaction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.8.
|
4
|
+
version: 3.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Lasseigne
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-04-
|
12
|
+
date: 2020-04-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|