-
-
Save untitaker/f2b6b20ad7d1a658264c3f6a8334fa5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'dry-struct' | |
module Types | |
include Dry::Types.module | |
end | |
class Bar < Dry::Struct | |
constructor_type :strict_with_defaults | |
attribute :baz, Types::Strict::Int | |
attribute :bam, Types::Strict::Int.optional.default(nil) | |
end | |
describe Bar do | |
specify { expect { Bar.new() }.to raise_error } | |
specify { expect { Bar.new(baz: 342) }.not_to raise_error } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment