dry-transaction 0.11.2 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/dry/transaction/result_matcher.rb +4 -4
- data/lib/dry/transaction/version.rb +1 -1
- data/spec/examples.txt +77 -75
- data/spec/integration/auto_injection_spec.rb +26 -26
- data/spec/integration/transaction_spec.rb +5 -5
- data/spec/unit/step_adapters/check_spec.rb +1 -1
- data/spec/unit/step_adapters/try_spec.rb +4 -4
- data/spec/unit/step_spec.rb +7 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9a430a3af687e93cad0f8bc9aa0877eceb4f145b80af5cb54df568840d2dc07
|
4
|
+
data.tar.gz: 13eb42a38e5af90189ee5279031b4b5a9c8a2e84e7e07a9479b3c4fabf7f93af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a3e0f899dee7533dc4f1f6739334625f5e271ad7c09ddd89ccaa506206556ae1fe29e91b03500c14155946b5974296bc0705e7e74680bfc33c990050d098362
|
7
|
+
data.tar.gz: cff741a608627148418d0d89d55efd7b900ea42e38d1bf923aad384cecb49dd7f96364531ae5d0714c8dc1de6df7b559a7ba7915590f45c433b4765e743c47b6
|
data/Gemfile.lock
CHANGED
@@ -4,18 +4,18 @@ module Dry
|
|
4
4
|
module Transaction
|
5
5
|
ResultMatcher = Dry::Matcher.new(
|
6
6
|
success: Dry::Matcher::Case.new(
|
7
|
-
match: -> result { result.
|
7
|
+
match: -> result { result.success? },
|
8
8
|
resolve: -> result { result.value! }
|
9
9
|
),
|
10
10
|
failure: Dry::Matcher::Case.new(
|
11
11
|
match: -> result, step_name = nil {
|
12
12
|
if step_name
|
13
|
-
result.
|
13
|
+
result.failure? && result.failure.step.step_name == step_name
|
14
14
|
else
|
15
|
-
result.
|
15
|
+
result.failure?
|
16
16
|
end
|
17
17
|
},
|
18
|
-
resolve: -> result { result.
|
18
|
+
resolve: -> result { result.failure.value }
|
19
19
|
)
|
20
20
|
)
|
21
21
|
end
|
data/spec/examples.txt
CHANGED
@@ -1,83 +1,85 @@
|
|
1
1
|
example_id | status | run_time |
|
2
2
|
----------------------------------------------------------- | ------ | --------------- |
|
3
|
-
./spec/integration/around_spec.rb[1:1] | passed | 0.
|
4
|
-
./spec/integration/around_spec.rb[1:2] | passed | 0.
|
5
|
-
./spec/integration/around_spec.rb[1:3] | passed | 0.
|
6
|
-
./spec/integration/around_spec.rb[1:4] | passed | 0.
|
7
|
-
./spec/integration/auto_injection_spec.rb[1:1] | failed | 0.
|
8
|
-
./spec/integration/custom_step_adapters_spec.rb[1:1] | passed | 0.
|
9
|
-
./spec/integration/operation_spec.rb[1:1] | passed | 0.
|
10
|
-
./spec/integration/operation_spec.rb[1:2] | passed | 0.
|
11
|
-
./spec/integration/passing_step_arguments_spec.rb[1:1:1] | passed | 0.
|
12
|
-
./spec/integration/passing_step_arguments_spec.rb[1:2:1] | passed | 0.
|
13
|
-
./spec/integration/passing_step_arguments_spec.rb[1:3:1] | passed | 0.
|
14
|
-
./spec/integration/publishing_step_events_spec.rb[1:1:1] | passed | 0.
|
15
|
-
./spec/integration/publishing_step_events_spec.rb[1:1:2] | passed | 0.
|
16
|
-
./spec/integration/publishing_step_events_spec.rb[1:2:1] | passed | 0.
|
17
|
-
./spec/integration/publishing_step_events_spec.rb[1:2:2] | passed | 0.
|
18
|
-
./spec/integration/publishing_step_events_spec.rb[1:3:1] | passed | 0.
|
19
|
-
./spec/integration/publishing_step_events_spec.rb[1:3:2] | passed | 0.
|
20
|
-
./spec/integration/transaction_spec.rb[1:1:1] | passed | 0.
|
21
|
-
./spec/integration/transaction_spec.rb[1:1:2] | passed | 0.
|
22
|
-
./spec/integration/transaction_spec.rb[1:1:3] | passed | 0.
|
23
|
-
./spec/integration/transaction_spec.rb[1:1:4] | passed | 0.
|
24
|
-
./spec/integration/transaction_spec.rb[1:1:5] | passed | 0.
|
25
|
-
./spec/integration/transaction_spec.rb[1:2:1] | passed | 0.
|
26
|
-
./spec/integration/transaction_spec.rb[1:3:1] | passed | 0.
|
27
|
-
./spec/integration/transaction_spec.rb[1:4:1] | passed | 0.
|
3
|
+
./spec/integration/around_spec.rb[1:1] | passed | 0.00185 seconds |
|
4
|
+
./spec/integration/around_spec.rb[1:2] | passed | 0.00075 seconds |
|
5
|
+
./spec/integration/around_spec.rb[1:3] | passed | 0.00085 seconds |
|
6
|
+
./spec/integration/around_spec.rb[1:4] | passed | 0.00096 seconds |
|
7
|
+
./spec/integration/auto_injection_spec.rb[1:1] | failed | 0.00149 seconds |
|
8
|
+
./spec/integration/custom_step_adapters_spec.rb[1:1] | passed | 0.00213 seconds |
|
9
|
+
./spec/integration/operation_spec.rb[1:1] | passed | 0.00206 seconds |
|
10
|
+
./spec/integration/operation_spec.rb[1:2] | passed | 0.00089 seconds |
|
11
|
+
./spec/integration/passing_step_arguments_spec.rb[1:1:1] | passed | 0.00159 seconds |
|
12
|
+
./spec/integration/passing_step_arguments_spec.rb[1:2:1] | passed | 0.00057 seconds |
|
13
|
+
./spec/integration/passing_step_arguments_spec.rb[1:3:1] | passed | 0.00252 seconds |
|
14
|
+
./spec/integration/publishing_step_events_spec.rb[1:1:1] | passed | 0.00073 seconds |
|
15
|
+
./spec/integration/publishing_step_events_spec.rb[1:1:2] | passed | 0.00084 seconds |
|
16
|
+
./spec/integration/publishing_step_events_spec.rb[1:2:1] | passed | 0.00062 seconds |
|
17
|
+
./spec/integration/publishing_step_events_spec.rb[1:2:2] | passed | 0.00052 seconds |
|
18
|
+
./spec/integration/publishing_step_events_spec.rb[1:3:1] | passed | 0.00113 seconds |
|
19
|
+
./spec/integration/publishing_step_events_spec.rb[1:3:2] | passed | 0.00092 seconds |
|
20
|
+
./spec/integration/transaction_spec.rb[1:1:1] | passed | 0.0006 seconds |
|
21
|
+
./spec/integration/transaction_spec.rb[1:1:2] | passed | 0.00058 seconds |
|
22
|
+
./spec/integration/transaction_spec.rb[1:1:3] | passed | 0.00067 seconds |
|
23
|
+
./spec/integration/transaction_spec.rb[1:1:4] | passed | 0.00067 seconds |
|
24
|
+
./spec/integration/transaction_spec.rb[1:1:5] | passed | 0.00065 seconds |
|
25
|
+
./spec/integration/transaction_spec.rb[1:2:1] | passed | 0.00072 seconds |
|
26
|
+
./spec/integration/transaction_spec.rb[1:3:1] | passed | 0.00054 seconds |
|
27
|
+
./spec/integration/transaction_spec.rb[1:4:1] | passed | 0.00078 seconds |
|
28
28
|
./spec/integration/transaction_spec.rb[1:5:1] | passed | 0.00058 seconds |
|
29
|
-
./spec/integration/transaction_spec.rb[1:6:1] | passed | 0.
|
30
|
-
./spec/integration/transaction_spec.rb[1:7:1] | passed | 0.
|
31
|
-
./spec/integration/transaction_spec.rb[1:8:1] | passed | 0.
|
32
|
-
./spec/integration/transaction_spec.rb[1:9:1] | passed | 0.
|
33
|
-
./spec/integration/transaction_spec.rb[1:
|
34
|
-
./spec/integration/transaction_spec.rb[1:
|
35
|
-
./spec/integration/transaction_spec.rb[1:
|
36
|
-
./spec/integration/transaction_spec.rb[1:
|
37
|
-
./spec/integration/transaction_spec.rb[1:
|
38
|
-
./spec/integration/transaction_spec.rb[1:
|
39
|
-
./spec/integration/transaction_spec.rb[1:
|
40
|
-
./spec/integration/transaction_spec.rb[1:
|
41
|
-
./spec/integration/transaction_spec.rb[1:
|
42
|
-
./spec/integration/transaction_spec.rb[1:
|
43
|
-
./spec/integration/transaction_spec.rb[1:
|
44
|
-
./spec/integration/transaction_spec.rb[1:
|
45
|
-
./spec/integration/transaction_spec.rb[1:13:
|
46
|
-
./spec/integration/transaction_spec.rb[1:
|
47
|
-
./spec/integration/transaction_spec.rb[1:
|
48
|
-
./spec/integration/
|
49
|
-
./spec/integration/
|
50
|
-
./spec/integration/
|
51
|
-
./spec/integration/transaction_without_steps_spec.rb[1:1:
|
52
|
-
./spec/integration/transaction_without_steps_spec.rb[1:2
|
53
|
-
./spec/integration/transaction_without_steps_spec.rb[1:3
|
54
|
-
./spec/integration/
|
55
|
-
./spec/
|
56
|
-
./spec/
|
57
|
-
./spec/unit/step_adapters/around_spec.rb[1:1:
|
58
|
-
./spec/unit/step_adapters/
|
59
|
-
./spec/unit/step_adapters/
|
60
|
-
./spec/unit/step_adapters/check_spec.rb[1:1:
|
61
|
-
./spec/unit/step_adapters/check_spec.rb[1:1:
|
62
|
-
./spec/unit/step_adapters/
|
63
|
-
./spec/unit/step_adapters/
|
64
|
-
./spec/unit/step_adapters/
|
29
|
+
./spec/integration/transaction_spec.rb[1:6:1] | passed | 0.00036 seconds |
|
30
|
+
./spec/integration/transaction_spec.rb[1:7:1] | passed | 0.00063 seconds |
|
31
|
+
./spec/integration/transaction_spec.rb[1:8:1] | passed | 0.00216 seconds |
|
32
|
+
./spec/integration/transaction_spec.rb[1:9:1] | passed | 0.0005 seconds |
|
33
|
+
./spec/integration/transaction_spec.rb[1:10:1] | passed | 0.00048 seconds |
|
34
|
+
./spec/integration/transaction_spec.rb[1:11:1] | passed | 0.00053 seconds |
|
35
|
+
./spec/integration/transaction_spec.rb[1:12:1] | passed | 0.00063 seconds |
|
36
|
+
./spec/integration/transaction_spec.rb[1:12:2] | passed | 0.00062 seconds |
|
37
|
+
./spec/integration/transaction_spec.rb[1:12:3] | passed | 0.00064 seconds |
|
38
|
+
./spec/integration/transaction_spec.rb[1:12:4] | passed | 0.00065 seconds |
|
39
|
+
./spec/integration/transaction_spec.rb[1:12:5] | passed | 0.00064 seconds |
|
40
|
+
./spec/integration/transaction_spec.rb[1:12:6] | passed | 0.0006 seconds |
|
41
|
+
./spec/integration/transaction_spec.rb[1:13:1] | passed | 0.00062 seconds |
|
42
|
+
./spec/integration/transaction_spec.rb[1:13:2] | passed | 0.00062 seconds |
|
43
|
+
./spec/integration/transaction_spec.rb[1:13:3] | passed | 0.0006 seconds |
|
44
|
+
./spec/integration/transaction_spec.rb[1:13:4] | passed | 0.00073 seconds |
|
45
|
+
./spec/integration/transaction_spec.rb[1:13:5] | passed | 0.00073 seconds |
|
46
|
+
./spec/integration/transaction_spec.rb[1:14:1] | passed | 0.0006 seconds |
|
47
|
+
./spec/integration/transaction_spec.rb[1:15:1] | passed | 0.00039 seconds |
|
48
|
+
./spec/integration/transaction_spec.rb[1:16:1:1:1] | passed | 0.00041 seconds |
|
49
|
+
./spec/integration/transaction_spec.rb[1:16:2:1:1] | passed | 0.00035 seconds |
|
50
|
+
./spec/integration/transaction_spec.rb[1:16:2:2:1] | passed | 0.0005 seconds |
|
51
|
+
./spec/integration/transaction_without_steps_spec.rb[1:1:1] | passed | 0.00064 seconds |
|
52
|
+
./spec/integration/transaction_without_steps_spec.rb[1:1:2] | passed | 0.0006 seconds |
|
53
|
+
./spec/integration/transaction_without_steps_spec.rb[1:1:3] | passed | 0.00066 seconds |
|
54
|
+
./spec/integration/transaction_without_steps_spec.rb[1:1:4] | passed | 0.00062 seconds |
|
55
|
+
./spec/integration/transaction_without_steps_spec.rb[1:2:1] | passed | 0.00069 seconds |
|
56
|
+
./spec/integration/transaction_without_steps_spec.rb[1:3:1] | passed | 0.0006 seconds |
|
57
|
+
./spec/unit/step_adapters/around_spec.rb[1:1:1:1] | passed | 0.00015 seconds |
|
58
|
+
./spec/unit/step_adapters/around_spec.rb[1:1:2:1] | passed | 0.00107 seconds |
|
59
|
+
./spec/unit/step_adapters/around_spec.rb[1:1:3:1] | passed | 0.00013 seconds |
|
60
|
+
./spec/unit/step_adapters/check_spec.rb[1:1:1] | passed | 0.00011 seconds |
|
61
|
+
./spec/unit/step_adapters/check_spec.rb[1:1:2:1] | passed | 0.00012 seconds |
|
62
|
+
./spec/unit/step_adapters/check_spec.rb[1:1:3:1] | passed | 0.00009 seconds |
|
63
|
+
./spec/unit/step_adapters/check_spec.rb[1:1:4:1] | passed | 0.00009 seconds |
|
64
|
+
./spec/unit/step_adapters/map_spec.rb[1:1:1] | passed | 0.00011 seconds |
|
65
|
+
./spec/unit/step_adapters/raw_spec.rb[1:1:1:1] | passed | 0.00011 seconds |
|
66
|
+
./spec/unit/step_adapters/raw_spec.rb[1:1:2:1] | passed | 0.00009 seconds |
|
65
67
|
./spec/unit/step_adapters/tee_spec.rb[1:1:1] | passed | 0.0001 seconds |
|
66
|
-
./spec/unit/step_adapters/try_spec.rb[1:1:1:1] | passed | 0.
|
67
|
-
./spec/unit/step_adapters/try_spec.rb[1:1:2:1:1] | passed | 0.
|
68
|
-
./spec/unit/step_adapters/try_spec.rb[1:1:2:1:2] | passed | 0.
|
68
|
+
./spec/unit/step_adapters/try_spec.rb[1:1:1:1] | passed | 0.00019 seconds |
|
69
|
+
./spec/unit/step_adapters/try_spec.rb[1:1:2:1:1] | passed | 0.00013 seconds |
|
70
|
+
./spec/unit/step_adapters/try_spec.rb[1:1:2:1:2] | passed | 0.00012 seconds |
|
69
71
|
./spec/unit/step_adapters/try_spec.rb[1:1:2:1:3:1] | passed | 0.00015 seconds |
|
70
|
-
./spec/unit/step_adapters/try_spec.rb[1:1:2:1:3:2] | passed | 0.
|
71
|
-
./spec/unit/step_adapters/try_spec.rb[1:1:2:2:1] | passed | 0.
|
72
|
+
./spec/unit/step_adapters/try_spec.rb[1:1:2:1:3:2] | passed | 0.00015 seconds |
|
73
|
+
./spec/unit/step_adapters/try_spec.rb[1:1:2:2:1] | passed | 0.00012 seconds |
|
72
74
|
./spec/unit/step_adapters/try_spec.rb[1:1:2:2:2:1] | passed | 0.0001 seconds |
|
73
75
|
./spec/unit/step_spec.rb[1:1:1:1] | passed | 0.00022 seconds |
|
74
|
-
./spec/unit/step_spec.rb[1:1:1:2] | passed | 0.
|
75
|
-
./spec/unit/step_spec.rb[1:1:2:1] | passed | 0.
|
76
|
-
./spec/unit/step_spec.rb[1:1:3:1] | passed | 0.
|
77
|
-
./spec/unit/step_spec.rb[1:1:3:2] | passed | 0.
|
78
|
-
./spec/unit/step_spec.rb[1:1:3:3] | passed | 0.
|
79
|
-
./spec/unit/step_spec.rb[1:2:1:1] | passed | 0.
|
80
|
-
./spec/unit/step_spec.rb[1:2:2:1] | passed | 0.
|
81
|
-
./spec/unit/step_spec.rb[1:2:3:1] | passed | 0.
|
82
|
-
./spec/unit/step_spec.rb[1:3:1:1] | passed | 0.
|
76
|
+
./spec/unit/step_spec.rb[1:1:1:2] | passed | 0.00039 seconds |
|
77
|
+
./spec/unit/step_spec.rb[1:1:2:1] | passed | 0.00038 seconds |
|
78
|
+
./spec/unit/step_spec.rb[1:1:3:1] | passed | 0.00019 seconds |
|
79
|
+
./spec/unit/step_spec.rb[1:1:3:2] | passed | 0.00191 seconds |
|
80
|
+
./spec/unit/step_spec.rb[1:1:3:3] | passed | 0.01503 seconds |
|
81
|
+
./spec/unit/step_spec.rb[1:2:1:1] | passed | 0.0001 seconds |
|
82
|
+
./spec/unit/step_spec.rb[1:2:2:1] | passed | 0.00012 seconds |
|
83
|
+
./spec/unit/step_spec.rb[1:2:3:1] | passed | 0.00012 seconds |
|
84
|
+
./spec/unit/step_spec.rb[1:3:1:1] | passed | 0.00013 seconds |
|
83
85
|
./spec/unit/step_spec.rb[1:3:2:1] | passed | 0.00012 seconds |
|
@@ -1,32 +1,32 @@
|
|
1
|
-
require "dry-monads"
|
2
|
-
require "dry-auto_inject"
|
1
|
+
# require "dry-monads"
|
2
|
+
# require "dry-auto_inject"
|
3
3
|
|
4
|
-
RSpec.describe "Using dry-auto_inject" do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
# RSpec.describe "Using dry-auto_inject" do
|
5
|
+
# let(:transaction) {
|
6
|
+
# Class.new do
|
7
|
+
# include Dry::Transaction(container: Test::Container)
|
8
|
+
# include Test::Inject[:extract_email]
|
9
9
|
|
10
|
-
|
10
|
+
# step :symbolize
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
# def call(input)
|
13
|
+
# super(input).bind(extract_email)
|
14
|
+
# end
|
15
|
+
# end.new
|
16
|
+
# }
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
# before do
|
19
|
+
# module Test
|
20
|
+
# Container = {
|
21
|
+
# symbolize: -> input { Dry::Monads::Right(name: input["name"], email: input["email"]) },
|
22
|
+
# extract_email: -> input { Dry::Monads::Right(email: input[:email]) },
|
23
|
+
# }
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
# Inject = Dry::AutoInject(container: Container)
|
26
|
+
# end
|
27
|
+
# end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
29
|
+
# it "support auto-injection of dependencies alongside step operations" do
|
30
|
+
# expect(transaction.("name" => "Jane", "email" => "jane@example.com").value).to eq(email: "jane@example.com")
|
31
|
+
# end
|
32
|
+
# end
|
@@ -338,7 +338,7 @@ RSpec.describe "Transactions" do
|
|
338
338
|
end
|
339
339
|
|
340
340
|
it "wraps the result of the failing operation" do
|
341
|
-
expect(transaction.call(input).
|
341
|
+
expect(transaction.call(input).failure).to be_a Test::NotValidError
|
342
342
|
end
|
343
343
|
|
344
344
|
it "supports matching on failure" do
|
@@ -421,17 +421,17 @@ RSpec.describe "Transactions" do
|
|
421
421
|
end
|
422
422
|
|
423
423
|
it "returns the failing value from the operation" do
|
424
|
-
expect(transaction.call(input).
|
424
|
+
expect(transaction.call(input).failure).to eq "raw failure"
|
425
425
|
end
|
426
426
|
|
427
427
|
it "returns an object that quacks like expected" do
|
428
|
-
result = transaction.call(input).
|
428
|
+
result = transaction.call(input).failure
|
429
429
|
|
430
430
|
expect(Array(result)).to eq(['raw failure'])
|
431
431
|
end
|
432
432
|
|
433
433
|
it "does not allow to call private methods on the result accidently" do
|
434
|
-
result = transaction.call(input).
|
434
|
+
result = transaction.call(input).failure
|
435
435
|
|
436
436
|
expect { result.print('') }.to raise_error(NoMethodError)
|
437
437
|
end
|
@@ -486,7 +486,7 @@ RSpec.describe "Transactions" do
|
|
486
486
|
end
|
487
487
|
|
488
488
|
it "calls the operations" do
|
489
|
-
expect(transaction.(input).value).to eql(name: 'Jane', age: 20)
|
489
|
+
expect(transaction.(input).value!).to eql(name: 'Jane', age: 20)
|
490
490
|
end
|
491
491
|
end
|
492
492
|
|
@@ -41,8 +41,8 @@ RSpec.describe Dry::Transaction::StepAdapters::Try do
|
|
41
41
|
|
42
42
|
it "returns the raised error as output" do
|
43
43
|
result = subject.(operation, options, [1234])
|
44
|
-
expect(result.
|
45
|
-
expect(result.
|
44
|
+
expect(result.failure).to be_a Test::NotValidError
|
45
|
+
expect(result.failure.message).to eql("not a string")
|
46
46
|
end
|
47
47
|
|
48
48
|
context "when using the :raise option" do
|
@@ -59,8 +59,8 @@ RSpec.describe Dry::Transaction::StepAdapters::Try do
|
|
59
59
|
|
60
60
|
it "returns the error specified by :raise as output" do
|
61
61
|
result = subject.(operation, options, [1234])
|
62
|
-
expect(result.
|
63
|
-
expect(result.
|
62
|
+
expect(result.failure).to be_a Test::BetterNamingError
|
63
|
+
expect(result.failure.message).to eql("not a string")
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
data/spec/unit/step_spec.rb
CHANGED
@@ -32,9 +32,9 @@ RSpec.describe Dry::Transaction::Step do
|
|
32
32
|
subject { step.call(input) }
|
33
33
|
|
34
34
|
context "when operation succeeds" do
|
35
|
-
let(:operation) { proc { |input| Dry::Monads
|
35
|
+
let(:operation) { proc { |input| Dry::Monads.Success(input) } }
|
36
36
|
|
37
|
-
it { is_expected.to
|
37
|
+
it { is_expected.to be_success }
|
38
38
|
|
39
39
|
it "publishes step_succeeded" do
|
40
40
|
expect(listener).to receive(:on_step_succeeded).and_call_original
|
@@ -46,7 +46,7 @@ RSpec.describe Dry::Transaction::Step do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
context "when operation starts" do
|
49
|
-
let(:operation) { proc { |input| Dry::Monads
|
49
|
+
let(:operation) { proc { |input| Dry::Monads.Success(input) } }
|
50
50
|
|
51
51
|
it "publishes step" do
|
52
52
|
expect(listener).to receive(:on_step).and_call_original
|
@@ -58,14 +58,14 @@ RSpec.describe Dry::Transaction::Step do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
context "when operation fails" do
|
61
|
-
let(:operation) { proc { |input| Dry::Monads
|
61
|
+
let(:operation) { proc { |input| Dry::Monads.Failure("error") } }
|
62
62
|
|
63
|
-
it { is_expected.to
|
63
|
+
it { is_expected.to be_failure }
|
64
64
|
|
65
65
|
it "wraps value in StepFailure" do
|
66
66
|
aggregate_failures do
|
67
|
-
expect(subject.
|
68
|
-
expect(subject.
|
67
|
+
expect(subject.failure).to be_a Dry::Transaction::StepFailure
|
68
|
+
expect(subject.failure.value).to eq "error"
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|