Sha256: 0982f309e7ba5ce330e19a518b971a7433d525764f46fba1eadce89d50543953

Contents?: true

Size: 944 Bytes

Versions: 3

Compression:

Stored size: 944 Bytes

Contents

module DataModel
	# Test data for integer schemas
	module Fixtures::Integer
		include Fixtures
		extend self

		# simple integer example
		# @return [Hash{Symbol => untyped}] the variants used by each example
		def simple
			Example.new(
				[:integer],
				variants: {
					valid: 5,
					missing: nil,
					string: ["5", 5]
				},
			)
		end

		# integer example that is optional
		# @return [Example] the example
		def optional
			Example.new(
				[:integer, { optional: true }],
				variants: {
					missing: nil
				},
			)
		end

		# integer example that has a minimum value
		# @return [Example] the example
		def min
			Example.new(
				[:integer, { min: 5 }],
				variants: {
					bigger: 6,
					smaller: 4
				},
			)
		end

		# integer example that has a maximum value
		# @return [Example] the example
		def max
			Example.new(
				[:integer, { max: 5 }],
				variants: {
					bigger: 6,
					smaller: 4
				},
			)
		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
data_model-0.6.1 lib/data_model/fixtures/integer.rb
data_model-0.6.0 lib/data_model/fixtures/integer.rb
data_model-0.5.0 lib/data_model/fixtures/integer.rb