dry-initializer 3.0.3 → 3.0.4
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/CHANGELOG.md +234 -242
- data/dry-initializer.gemspec +28 -15
- data/lib/dry/initializer/builders/attribute.rb +1 -1
- data/lib/dry/initializer/version.rb +1 -1
- metadata +24 -104
- data/.codeclimate.yml +0 -12
- data/.github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md +0 -10
- data/.github/ISSUE_TEMPLATE/---bug-report.md +0 -30
- data/.github/ISSUE_TEMPLATE/---feature-request.md +0 -18
- data/.github/workflows/custom_ci.yml +0 -58
- data/.github/workflows/docsite.yml +0 -34
- data/.github/workflows/sync_configs.yml +0 -56
- data/.gitignore +0 -12
- data/.rspec +0 -4
- data/.rubocop.yml +0 -102
- data/CODE_OF_CONDUCT.md +0 -13
- data/CONTRIBUTING.md +0 -29
- data/Gemfile +0 -36
- data/Gemfile.devtools +0 -16
- data/Guardfile +0 -5
- data/LICENSE.txt +0 -21
- data/Rakefile +0 -8
- data/benchmarks/compare_several_defaults.rb +0 -82
- data/benchmarks/plain_options.rb +0 -63
- data/benchmarks/plain_params.rb +0 -84
- data/benchmarks/with_coercion.rb +0 -71
- data/benchmarks/with_defaults.rb +0 -66
- data/benchmarks/with_defaults_and_coercion.rb +0 -59
- data/bin/.gitkeep +0 -0
- data/docsite/source/attributes.html.md +0 -106
- data/docsite/source/container-version.html.md +0 -39
- data/docsite/source/index.html.md +0 -43
- data/docsite/source/inheritance.html.md +0 -43
- data/docsite/source/optionals-and-defaults.html.md +0 -130
- data/docsite/source/options-tolerance.html.md +0 -27
- data/docsite/source/params-and-options.html.md +0 -74
- data/docsite/source/rails-support.html.md +0 -101
- data/docsite/source/readers.html.md +0 -43
- data/docsite/source/skip-undefined.html.md +0 -59
- data/docsite/source/type-constraints.html.md +0 -160
- data/project.yml +0 -2
- data/spec/attributes_spec.rb +0 -38
- data/spec/coercion_of_nil_spec.rb +0 -25
- data/spec/custom_dispatchers_spec.rb +0 -35
- data/spec/custom_initializer_spec.rb +0 -30
- data/spec/default_values_spec.rb +0 -83
- data/spec/definition_spec.rb +0 -111
- data/spec/invalid_default_spec.rb +0 -13
- data/spec/list_type_spec.rb +0 -32
- data/spec/missed_default_spec.rb +0 -14
- data/spec/nested_type_spec.rb +0 -48
- data/spec/optional_spec.rb +0 -71
- data/spec/options_tolerance_spec.rb +0 -11
- data/spec/public_attributes_utility_spec.rb +0 -22
- data/spec/reader_spec.rb +0 -87
- data/spec/repetitive_definitions_spec.rb +0 -69
- data/spec/several_assignments_spec.rb +0 -41
- data/spec/spec_helper.rb +0 -24
- data/spec/subclassing_spec.rb +0 -49
- data/spec/support/coverage.rb +0 -7
- data/spec/support/warnings.rb +0 -7
- data/spec/type_argument_spec.rb +0 -35
- data/spec/type_constraint_spec.rb +0 -96
- data/spec/value_coercion_via_dry_types_spec.rb +0 -29
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'dry-types'
|
2
|
-
|
3
|
-
describe 'value coercion via dry-types' do
|
4
|
-
before do
|
5
|
-
module Test::Types
|
6
|
-
include Dry.Types
|
7
|
-
end
|
8
|
-
|
9
|
-
class Test::Foo
|
10
|
-
extend Dry::Initializer
|
11
|
-
|
12
|
-
param :foo, type: Test::Types::Coercible::String
|
13
|
-
option :bar, proc(&:to_i), default: proc { '16' }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'coerces assigned values' do
|
18
|
-
subject = Test::Foo.new :foo, bar: '13'
|
19
|
-
|
20
|
-
expect(subject.foo).to eql 'foo'
|
21
|
-
expect(subject.bar).to eql 13
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'coerces defaults as well' do
|
25
|
-
subject = Test::Foo.new :foo
|
26
|
-
|
27
|
-
expect(subject.bar).to eql 16
|
28
|
-
end
|
29
|
-
end
|