Module: Fixtures::Symbol

Extended by:
Symbol
Includes:
Fixtures
Included in:
Symbol
Defined in:
lib/data_model/fixtures/symbol.rb

Overview

Test data around symbol schemas

Instance Method Summary collapse

Instance Method Details

#exclusionExample

a symbol example where :invalid is the only disallowed Symbol

Returns:



48
49
50
51
52
53
54
55
56
# File 'lib/data_model/fixtures/symbol.rb', line 48

def exclusion
	Example.new(
		[:symbol, { excluded: [:invalid] }],
		variants: {
			valid: :valid,
			inside: :invalid
		},
	)
end

#inclusionExample

a symbol example where :valid is the only allowed Symbol

Returns:



36
37
38
39
40
41
42
43
44
# File 'lib/data_model/fixtures/symbol.rb', line 36

def inclusion
	Example.new(
		[:symbol, { included: [:valid] }],
		variants: {
			valid: :valid,
			outside: :outside
		},
	)
end

#optionalExample

a symbol example that is optional

Returns:



23
24
25
26
27
28
29
30
31
32
# File 'lib/data_model/fixtures/symbol.rb', line 23

def optional
	Example.new(
		[:symbol, { optional: true }],
		variants: {
			missing: nil,
			present: :valid,
			number: 22
		},
	)
end

#simpleExample

a simple symbol example

Returns:



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/data_model/fixtures/symbol.rb', line 9

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