interactor_with_steroids 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/interactor.gemspec +2 -1
- data/lib/interactor/context.rb +1 -1
- data/lib/interactor.rb +1 -1
- data/spec/interactor_spec.rb +11 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee0822c1b5d0c7e5ec36e35a2eb7989f19587f8b64a6a784e183fc6545c2ce4b
|
4
|
+
data.tar.gz: 4759c36e11b659a8ddef357ac928c297f5383b370d0a075c1dd0eb20e2a392bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce654d725ec8ebec129d6667612d2bf74e309457589c05592c6ec6402fc69f5756ce05f392a132177c3b351ca362374ea1b75ce217c26c73a6a0313ee4e08bff
|
7
|
+
data.tar.gz: b562c0b40d1d4d95e16726b0aeb115b89ada4606d3371ebababda23be7ae74ca984138182c2790ee1fd9c837d614bcaf741c47dfe19f7083fd0d9d5f742f38bb
|
data/interactor.gemspec
CHANGED
@@ -2,7 +2,7 @@ require "English"
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "interactor_with_steroids"
|
5
|
-
spec.version = "1.
|
5
|
+
spec.version = "1.2.0"
|
6
6
|
|
7
7
|
spec.author = "Collective Idea/Sorare Team"
|
8
8
|
spec.email = "hello@sorare.com"
|
@@ -10,6 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.summary = "Simple interactor implementation"
|
11
11
|
spec.homepage = "https://github.com/sorare/interactor"
|
12
12
|
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = '>= 2.1'
|
13
14
|
|
14
15
|
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
15
16
|
spec.test_files = spec.files.grep(/^spec/)
|
data/lib/interactor/context.rb
CHANGED
data/lib/interactor.rb
CHANGED
@@ -145,7 +145,7 @@ module Interactor
|
|
145
145
|
end
|
146
146
|
rescue Failure => e
|
147
147
|
# Make sure we fail the current context when a call! to another interactor fails
|
148
|
-
context.fail!(error: e.context&.error)
|
148
|
+
context.fail!(error: e.context&.error, error_cause: e.cause)
|
149
149
|
end
|
150
150
|
|
151
151
|
# Public: Invoke an Interactor instance without any hooks, tracking, or
|
data/spec/interactor_spec.rb
CHANGED
@@ -63,6 +63,8 @@ describe Interactor do
|
|
63
63
|
|
64
64
|
describe "#run" do
|
65
65
|
let(:instance) { interactor.new }
|
66
|
+
let(:exception_klass) { Class.new(Exception) }
|
67
|
+
let(:failure_cause) { exception_klass.new }
|
66
68
|
|
67
69
|
it "runs the interactor" do
|
68
70
|
expect(instance).to receive(:run!).once.with(no_args)
|
@@ -78,6 +80,15 @@ describe Interactor do
|
|
78
80
|
}.not_to raise_error
|
79
81
|
end
|
80
82
|
|
83
|
+
it "persists failure cause" do
|
84
|
+
expect(instance).to receive(:call).and_raise(
|
85
|
+
Interactor::Failure.new(instance.context), cause: failure_cause
|
86
|
+
)
|
87
|
+
|
88
|
+
instance.run
|
89
|
+
expect(instance.context.error_cause).to eq(failure_cause)
|
90
|
+
end
|
91
|
+
|
81
92
|
it "raises other errors" do
|
82
93
|
expect(instance).to receive(:run!).and_raise("foo")
|
83
94
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: interactor_with_steroids
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Collective Idea/Sorare Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -93,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '2.1'
|
97
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
99
|
- - ">="
|