Module: Fixtures::BigDecimal

Extended by:
BigDecimal
Includes:
Fixtures
Included in:
BigDecimal
Defined in:
lib/data_model/fixtures/big_decimal.rb

Overview

test fixtures for BigDecimal

Instance Method Summary collapse

Instance Method Details

#maxExample

a decimal example that has a restriction on the maximum value

Returns:



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

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

#minExample

a decimal example that has a restriction on the minimum value

Returns:



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

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

#optionalExample

a decimal example that is optional

Returns:



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

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

#simpleExample

a simple decimal example

Returns:



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

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