Module: Fixtures::Integer

Extended by:
Integer
Includes:
Fixtures
Included in:
Integer
Defined in:
lib/data_model/fixtures/integer.rb

Overview

Test data for integer schemas

Instance Method Summary collapse

Instance Method Details

#maxExample

integer example that has a maximum value

Returns:



45
46
47
48
49
50
51
52
53
# File 'lib/data_model/fixtures/integer.rb', line 45

def max
	Example.new(
		[:integer, { max: 5 }],
		variants: {
			bigger: 6,
			smaller: 4
		},
	)
end

#minExample

integer example that has a minimum value

Returns:



33
34
35
36
37
38
39
40
41
# File 'lib/data_model/fixtures/integer.rb', line 33

def min
	Example.new(
		[:integer, { min: 5 }],
		variants: {
			bigger: 6,
			smaller: 4
		},
	)
end

#optionalExample

integer example that is optional

Returns:



22
23
24
25
26
27
28
29
# File 'lib/data_model/fixtures/integer.rb', line 22

def optional
	Example.new(
		[:integer, { optional: true }],
		variants: {
			missing: nil
		},
	)
end

#simpleHash{Symbol => untyped}

simple integer example

Returns:

  • (Hash{Symbol => untyped})

    the variants used by each example



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

def simple
	Example.new(
		[:integer],
		variants: {
			valid: 5,
			missing: nil,
			string: ["5", 5]
		},
	)
end