servactory 1.6.6 → 1.6.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8df03a33262af045766ff179c047c3260b85f182aa0541137597e13d7d50bbe
4
- data.tar.gz: 813454694dafd13757259a9c45ad455e30e4fd73013a8d51b5022624d3bd194a
3
+ metadata.gz: 36958cd40c5a7f821265cbbaa4509262da61fb1dcb799d9ba57433012d2e35c1
4
+ data.tar.gz: 3a7a5736e738bc71be30ddef3bee4c536c108a29f24493da9359aa3cfd3eef3c
5
5
  SHA512:
6
- metadata.gz: b61bf7ef77779b5f8c697c514a2af1baac91095c553a31ff60c9e6080233f6153eae13b24a818e527a3f887755e35c3643ffd81c47fbbabdb5c64f8dc1a98054
7
- data.tar.gz: 9722ed5fff0d2390a11636e2dc28e313cb338c726e8a9c630c4eee75ac1046a8684cb7dc7385691aaab7393bf1b9568a61b500c5a2334ca2d157d2eb239988d5
6
+ metadata.gz: e9b3da95a52a025298169b2f6eea8e6b75bf538dc1ea98c4e903c3c43e50dccada335f37b6883f1cf7c1cb49ed4370a2b182ee2c05cb1c48e35b888575bdd26e
7
+ data.tar.gz: d52fe6ad625529e3f5efb114cbea5331505df217802f3acfc3a68acaa61e761de770c394210d28dd16be134c2eb1003e42d6ed1dc994e8ed8ec8ddad6538e1ad
@@ -6,6 +6,8 @@ module Servactory
6
6
  def call!(arguments = {}) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
7
7
  @context_store = Store.new(self)
8
8
 
9
+ context_store.context.send(:assign_service_strict_mode, true)
10
+
9
11
  assign_data_with(arguments)
10
12
 
11
13
  inputs_workbench.find_unnecessary!
@@ -31,6 +33,8 @@ module Servactory
31
33
  def call(arguments = {}) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
32
34
  @context_store = Store.new(self)
33
35
 
36
+ context_store.context.send(:assign_service_strict_mode, false)
37
+
34
38
  assign_data_with(arguments)
35
39
 
36
40
  inputs_workbench.find_unnecessary!
@@ -29,7 +29,17 @@ module Servactory
29
29
  end
30
30
 
31
31
  def fail!(message:, meta: nil)
32
- errors << Servactory.configuration.failure_class.new(message: message, meta: meta)
32
+ failure = Servactory.configuration.failure_class.new(message: message, meta: meta)
33
+
34
+ raise failure if @service_strict_mode
35
+
36
+ errors << failure
37
+ end
38
+
39
+ private
40
+
41
+ def assign_service_strict_mode(flag)
42
+ @service_strict_mode = flag
33
43
  end
34
44
  end
35
45
  end
@@ -94,7 +94,7 @@ module Servactory
94
94
  end
95
95
 
96
96
  def prepared_value
97
- @prepared_value ||= @input.optional? && !@input.default.nil? ? @input.default : @value
97
+ @prepared_value ||= @input.optional? && !@input.default.nil? && @value.blank? ? @input.default : @value
98
98
  end
99
99
  end
100
100
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Servactory
4
+ module Test
5
+ class FakeType; end
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Servactory
4
+ module Test
5
+ class Result
6
+ def initialize(**attributes)
7
+ attributes.each_pair do |method_name, method_return|
8
+ define_singleton_method(method_name) { method_return }
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -4,7 +4,7 @@ module Servactory
4
4
  module VERSION
5
5
  MAJOR = 1
6
6
  MINOR = 6
7
- PATCH = 6
7
+ PATCH = 7
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH].join(".")
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: servactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.6
4
+ version: 1.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
@@ -247,6 +247,8 @@ files:
247
247
  - lib/servactory/outputs/validations/type.rb
248
248
  - lib/servactory/outputs/workbench.rb
249
249
  - lib/servactory/result.rb
250
+ - lib/servactory/test/fake_type.rb
251
+ - lib/servactory/test/result.rb
250
252
  - lib/servactory/utils.rb
251
253
  - lib/servactory/version.rb
252
254
  homepage: https://github.com/afuno/servactory