servactory 2.12.0 → 2.13.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: effe21494947a824c5ee5f49b022a92157a69906a6b5f41cdf96a02b08bedc55
|
4
|
+
data.tar.gz: 7d52a8e143393e05824426f6c62e2d767191cee35b106fc159f3c2d72bfab50e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e10b019ae010c04a64fe28fc0e06b7e10d756ad7f6217e45c9241cc81c421fdbae8e36944de03b3de035aa307ed0b93a73a77e375fa218bfe198ed2a24a3e37a
|
7
|
+
data.tar.gz: 511d7cb765402d1a3b1ce41d30d7abf1964a0070191a10aaa3eb0109089b8a5ad49dde6e6904e539c8a1cc4bfe5343e48a10f13df378b0ab8472ed02d6d584ef
|
@@ -4,9 +4,6 @@ module Servactory
|
|
4
4
|
module Context
|
5
5
|
module Workspace
|
6
6
|
class Inputs
|
7
|
-
RESERVED_ATTRIBUTES = %i[type required default].freeze
|
8
|
-
private_constant :RESERVED_ATTRIBUTES
|
9
|
-
|
10
7
|
def initialize(context:, collection_of_inputs:)
|
11
8
|
@context = context
|
12
9
|
@collection_of_inputs = collection_of_inputs
|
data/lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/schema_matcher.rb
CHANGED
@@ -29,8 +29,7 @@ module Servactory
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def description
|
32
|
-
|
33
|
-
result + schema_data
|
32
|
+
"schema: #{schema_data}"
|
34
33
|
end
|
35
34
|
|
36
35
|
def matches?(subject)
|
@@ -58,10 +57,20 @@ module Servactory
|
|
58
57
|
schema_data_equal?
|
59
58
|
end
|
60
59
|
|
61
|
-
def schema_data_equal?
|
60
|
+
def schema_data_equal? # rubocop:disable Metrics/MethodLength
|
61
|
+
matcher_result =
|
62
|
+
RSpec::Expectations::ExpectationHelper
|
63
|
+
.with_matcher(
|
64
|
+
RSpec::Expectations::PositiveExpectationHandler,
|
65
|
+
RSpec::Matchers::BuiltIn::Match.new(schema_data),
|
66
|
+
nil
|
67
|
+
) do |matcher|
|
68
|
+
matcher.matches?(attribute_schema_is)
|
69
|
+
end
|
70
|
+
|
62
71
|
@schema_data_equal ||=
|
63
72
|
(
|
64
|
-
schema_data.present? &&
|
73
|
+
schema_data.present? && matcher_result
|
65
74
|
) || schema_data.blank?
|
66
75
|
end
|
67
76
|
|
@@ -4,8 +4,8 @@ module Servactory
|
|
4
4
|
module ToolKit
|
5
5
|
module DynamicOptions
|
6
6
|
class Schema < Must # rubocop:disable Metrics/ClassLength
|
7
|
-
|
8
|
-
private_constant :
|
7
|
+
RESERVED_OPTIONS = %i[type required default payload].freeze
|
8
|
+
private_constant :RESERVED_OPTIONS
|
9
9
|
|
10
10
|
def self.use(option_name = :schema, default_hash_mode_class_names:)
|
11
11
|
instance = new(option_name, :is, false)
|
@@ -65,7 +65,7 @@ module Servactory
|
|
65
65
|
if attribute_type == Hash
|
66
66
|
validate_for!(
|
67
67
|
object: object.fetch(schema_key, {}),
|
68
|
-
schema: schema_value.except(*
|
68
|
+
schema: schema_value.except(*RESERVED_OPTIONS),
|
69
69
|
root_schema_key: schema_key
|
70
70
|
)
|
71
71
|
else
|
@@ -134,14 +134,18 @@ module Servactory
|
|
134
134
|
if attribute_type == Hash
|
135
135
|
prepare_object_with!(
|
136
136
|
object: object.fetch(schema_key, {}),
|
137
|
-
schema: schema_value.except(*
|
137
|
+
schema: schema_value.except(*RESERVED_OPTIONS)
|
138
138
|
)
|
139
139
|
else
|
140
|
-
|
140
|
+
unless (default = schema_value.fetch(:default, nil)).nil?
|
141
|
+
object[schema_key] = default
|
142
|
+
end
|
141
143
|
|
142
|
-
|
144
|
+
unless (input_prepare = schema_value.fetch(:prepare, nil)).nil?
|
145
|
+
object[schema_key] = input_prepare.call(value: object[schema_key])
|
146
|
+
end
|
143
147
|
|
144
|
-
object
|
148
|
+
object
|
145
149
|
end
|
146
150
|
end
|
147
151
|
end
|
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.
|
4
|
+
version: 2.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Sokolov
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-03-
|
10
|
+
date: 2025-03-06 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activesupport
|