servactory 2.14.0 → 2.14.1
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/lib/servactory/test_kit/result.rb +17 -4
- data/lib/servactory/test_kit/rspec/helpers.rb +2 -12
- data/lib/servactory/version.rb +1 -1
- 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: ee6b7f861c6725a1cc1addd81413b0d84eef974ee2290543145293561b9b23d8
|
4
|
+
data.tar.gz: 855d74bbded65bd281bbb9c8018e7e7d0272d555593b0b78464432cda42481e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34ba463f5c90df781dbc93761e7f73b5776532fa53ba5d6ff663e4c00d9fd5ffa744fe5a8f62704cd84496f6ee10b277b674b7c2c9e2262f02d6fead30a2cfc8
|
7
|
+
data.tar.gz: 32dbeb464202b1e3e64eb62677e3ed61ba8acd95616ac8098a269869e099946c2030bc9272124727288eb166d3f58414ca812cc27a173292af6d168d0453a749
|
@@ -3,16 +3,29 @@
|
|
3
3
|
module Servactory
|
4
4
|
module TestKit
|
5
5
|
class Result
|
6
|
-
def self.as_success(attributes
|
6
|
+
def self.as_success(**attributes)
|
7
|
+
service_class = attributes.delete(:service_class) || self
|
8
|
+
|
7
9
|
context = new(attributes)
|
8
10
|
|
9
|
-
Servactory::Result
|
11
|
+
if service_class == Servactory::TestKit::Result
|
12
|
+
Servactory::Result.success_for(context:)
|
13
|
+
else
|
14
|
+
service_class.config.result_class.success_for(context:)
|
15
|
+
end
|
10
16
|
end
|
11
17
|
|
12
|
-
def self.as_failure(attributes
|
18
|
+
def self.as_failure(**attributes)
|
19
|
+
service_class = attributes.delete(:service_class) || self
|
20
|
+
exception = attributes.delete(:exception)
|
21
|
+
|
13
22
|
context = new(attributes)
|
14
23
|
|
15
|
-
Servactory::Result
|
24
|
+
if service_class == Servactory::TestKit::Result
|
25
|
+
Servactory::Result.failure_for(context:, exception:)
|
26
|
+
else
|
27
|
+
service_class.config.result_class.failure_for(context:, exception:)
|
28
|
+
end
|
16
29
|
end
|
17
30
|
|
18
31
|
def initialize(attributes = {})
|
@@ -64,17 +64,7 @@ module Servactory
|
|
64
64
|
{}
|
65
65
|
end
|
66
66
|
|
67
|
-
|
68
|
-
# puts <<~RUBY
|
69
|
-
# allow(#{service_class}).to(
|
70
|
-
# receive(#{method_call.inspect})
|
71
|
-
# .public_send(
|
72
|
-
# #{and_return_or_raise.inspect},
|
73
|
-
# Servactory::TestKit::Result.public_send(#{result_type.inspect}, #{result})
|
74
|
-
# )
|
75
|
-
# )
|
76
|
-
# RUBY
|
77
|
-
# puts
|
67
|
+
result[:service_class] = service_class
|
78
68
|
|
79
69
|
allow(service_class).to(
|
80
70
|
receive(method_call)
|
@@ -92,7 +82,7 @@ module Servactory
|
|
92
82
|
if as_success || !with_bang
|
93
83
|
Servactory::TestKit::Result.public_send(result_type, **result)
|
94
84
|
else
|
95
|
-
|
85
|
+
result.fetch(:exception)
|
96
86
|
end
|
97
87
|
)
|
98
88
|
)
|
data/lib/servactory/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: servactory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.14.
|
4
|
+
version: 2.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Sokolov
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activesupport
|
@@ -354,7 +354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
354
354
|
- !ruby/object:Gem::Version
|
355
355
|
version: '0'
|
356
356
|
requirements: []
|
357
|
-
rubygems_version: 3.6.
|
357
|
+
rubygems_version: 3.6.7
|
358
358
|
specification_version: 4
|
359
359
|
summary: A set of tools for building reliable services of any complexity
|
360
360
|
test_files: []
|