Sha256: 13b6f8d4702ada85397a0fb6ca7c9f0b0fe13f0e21be22c30a9d904184293d51

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

# typed: strict

module DataModel
	module Fixtures::String
		extend self
		extend T::Sig
		include Fixtures

		sig { returns(Example) }
		def simple
			Example.new(
				[:string],
				variants: {
					valid: "valid",
					other_type: 22,
					missing: nil
				},
			)
		end

		sig { returns(Example) }
		def optional
			Example.new(
				[:string, { optional: true }],
				variants: {
					valid: "valid",
					blank: "",
					missing: nil
				},
			)
		end

		sig { returns(Example) }
		def inclusion
			Example.new(
				[:string, { included: ["valid"] }],
				variants: {
					valid: "valid",
					outside: "invalid"
				},
			)
		end

		sig { returns(Example) }
		def exclusion
			Example.new(
				[:string, { excluded: ["invalid"] }],
				variants: {
					valid: "valid",
					inside: "invalid"
				},
			)
		end

		sig { returns(Example) }
		def allow_blank
			Example.new(
				[:string, { allow_blank: true }],
				variants: {
					blank: "",
					not_blank: "content",
					missing: nil
				},
			)
		end

		sig { returns(Example) }
		def dont_allow_blank
			Example.new(
				[:string, { allow_blank: false }],
				variants: {
					blank: ""
				},
			)
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
data_model-0.1.0 lib/data_model/fixtures/string.rb