Module: Fixtures::Array

Extended by:
Array
Includes:
Fixtures
Included in:
Array
Defined in:
lib/data_model/fixtures/array.rb

Overview

test fixtures for array type

Instance Method Summary collapse

Instance Method Details

#any_arrayExample

a simple array of any types

Returns:



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

def any_array
	Example.new(
		[:array],
		variants: {
			mixed: ["a", 2, [], ::Object.new]
		},
	)
end

#array_optional_stringExample

an array of optional strings

Returns:



64
65
66
67
68
69
70
71
72
# File 'lib/data_model/fixtures/array.rb', line 64

def array_optional_string
	Example.new(
		[:array, [:string, { optional: true }]],
		variants: {
			optional_strings: ["a", nil, "c"],
			numbers: [1, nil, 3]
		},
	)
end

#optional_string_arrayExample

an optional example

Returns:



52
53
54
55
56
57
58
59
60
# File 'lib/data_model/fixtures/array.rb', line 52

def optional_string_array
	Example.new(
		[:array, { optional: true }, :string],
		variants: {
			strings: ["a", "b", "c"],
			missing: nil
		},
	)
end

#string_arrayExample

a simple array of strings example

Returns:



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

def string_array
	Example.new(
		[:array, :string],
		variants: {
			strings: ["a", "b", "c"],
			string: ["a", ["a"]],
			number: [1, ["1"]],
			missing: nil,
			numbers: [[1, 2, 3], ["1", "2", "3"]],
			other_type: ::Object.new
		},
	)
end

#wrapping_string_arrayExample

a simple array of strings that wraps single values

Returns:



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/data_model/fixtures/array.rb', line 36

def wrapping_string_array
	Example.new(
		[:array, { wrap_single_value: true }, :string],
		variants: {
			strings: ["a", "b", "c"],
			string: ["a", ["a"]],
			number: [1, ["1"]],
			missing: nil,
			numbers: [[1, 2, 3], ["1", "2", "3"]],
			other_type: ::Object.new
		},
	)
end