Skip to content

Commit 2268f94

Browse files
committed
fix resource_struct_build
1 parent 8b42686 commit 2268f94

File tree

4 files changed

+29
-9
lines changed

4 files changed

+29
-9
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
source 'https://rubygems.org'
44

55
# gem "rails"
6+
gem 'activesupport'
67
gem 'rspec'
78
gem 'sorbet-coerce', '>= 0.2.6'
89
gem 'sorbet-static-and-runtime', '>= 0.5.11511'

Gemfile.lock

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4+
activesupport (7.2.0)
5+
base64
6+
bigdecimal
7+
concurrent-ruby (~> 1.0, >= 1.3.1)
8+
connection_pool (>= 2.2.5)
9+
drb
10+
i18n (>= 1.6, < 2)
11+
logger (>= 1.4.2)
12+
minitest (>= 5.1)
13+
securerandom (>= 0.3)
14+
tzinfo (~> 2.0, >= 2.0.5)
15+
base64 (0.2.0)
16+
bigdecimal (3.1.8)
17+
concurrent-ruby (1.3.4)
18+
connection_pool (2.4.1)
419
diff-lcs (1.5.1)
20+
drb (2.2.1)
21+
i18n (1.14.5)
22+
concurrent-ruby (~> 1.0)
23+
logger (1.6.0)
24+
minitest (5.25.1)
525
polyfill (1.9.0)
626
rspec (3.13.0)
727
rspec-core (~> 3.13.0)
@@ -17,6 +37,7 @@ GEM
1737
rspec-support (~> 3.13.0)
1838
rspec-support (3.13.1)
1939
safe_type (1.1.1)
40+
securerandom (0.3.1)
2041
sorbet (0.5.11531)
2142
sorbet-static (= 0.5.11531)
2243
sorbet-coerce (0.7.0)
@@ -28,12 +49,15 @@ GEM
2849
sorbet-static-and-runtime (0.5.11531)
2950
sorbet (= 0.5.11531)
3051
sorbet-runtime (= 0.5.11531)
52+
tzinfo (2.0.6)
53+
concurrent-ruby (~> 1.0)
3154

3255
PLATFORMS
3356
ruby
3457
x86_64-linux
3558

3659
DEPENDENCIES
60+
activesupport
3761
rspec
3862
sorbet-coerce (>= 0.2.6)
3963
sorbet-static-and-runtime (>= 0.5.11511)

lib/public/resource_struct_builder.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# typed: strict
22

33
require 'sorbet-coerce'
4+
require 'active_support/hash_with_indifferent_access'
45

56
module ResourceRegistry
67
# Constructs a resource struct (like Dtos and Entities) from a hash of arguments
@@ -38,13 +39,6 @@ def build(value)
3839
build_other(value)
3940
end
4041
rescue TypeError, ArgumentError, TypeCoerce::CoercionError => e
41-
CustomLogger.info(
42-
message: "Failed to parse provided arguments into #{resource_type}",
43-
payload: {
44-
request: value,
45-
response: e.to_s
46-
}
47-
)
4842
raise ParseInputError, e.message
4943
end
5044

spec/resource_struct_builder_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
require 'spec_helper'
55
require_relative '../lib/public/resource_struct_builder'
66

7-
module ::ResourceRegistry
7+
module ResourceRegistry
88
module DtoBuilderSpec
99
module Dtos
1010
class SimpleDto < T::Struct
@@ -133,7 +133,8 @@ class SetDto < T::Struct
133133
end
134134
end
135135

136-
context 'with a nested value-object dto' do
136+
# ValueObjects is an internal detail of Factorial
137+
xcontext 'with a nested value-object dto' do
137138
let(:dto) { ResourceRegistry::DtoBuilderSpec::Dtos::NestedValueObjectDto }
138139
let(:period) { ValueObjects::TimeRange.new(from: Time.zone.now, to: Time.zone.now.tomorrow) }
139140
let(:args) { { type: 'one-type', period: { from: period.from, to: period.to } } }

0 commit comments

Comments
 (0)