Sha256: c130c083242fe45b9c5248b7cfa14d7906cc5338fa8515586898f739755227fd

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

module DataModel
	# Test data around symbol schemas
	module Fixtures::Symbol
		extend self
		include Fixtures

		# a simple symbol example
		# @return [Example] the example
		def simple
			Example.new(
				[:symbol],
				variants: {
					valid: :valid,
					coerce: "valid",
					missing: nil,
					other_type: 22
				},
			)
		end

		# a symbol example that is optional
		# @return [Example] the example
		def optional
			Example.new(
				[:symbol, { optional: true }],
				variants: {
					missing: nil,
					present: :valid,
					number: 22
				},
			)
		end

		# a symbol example where :valid is the only allowed Symbol
		# @return [Example] the example
		def inclusion
			Example.new(
				[:symbol, { included: [:valid] }],
				variants: {
					valid: :valid,
					outside: :outside
				},
			)
		end

		# a symbol example where :invalid is the only disallowed Symbol
		# @return [Example] the example
		def exclusion
			Example.new(
				[:symbol, { excluded: [:invalid] }],
				variants: {
					valid: :valid,
					inside: :invalid
				},
			)
		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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