Sha256: 48164b8c311b9264dfeee5fb9956b565333d219054f0fe0f979900cce79a5671

Contents?: true

Size: 1011 Bytes

Versions: 3

Compression:

Stored size: 1011 Bytes

Contents

require "bigdecimal/util"

module DataModel
	# test fixtures for BigDecimal
	module Fixtures::BigDecimal
		include Fixtures
		extend self

		# a simple decimal example
		# @return [Example] the example
		def simple
			Example.new(
				[:decimal],
				variants: {
					valid: 5.to_d,
					missing: nil,
					string: ["5", 5.to_d]
				},
			)
		end

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

		# a decimal example that has a restriction on the minimum value
		# @return [Example] the example
		def min
			Example.new(
				[:decimal, { min: 5 }],
				variants: {
					bigger: 6.to_d,
					smaller: 4.to_d
				},
			)
		end

		# a decimal example that has a restriction on the maximum value
		# @return [Example] the example
		def max
			Example.new(
				[:decimal, { max: 5 }],
				variants: {
					bigger: 6.to_d,
					smaller: 4.to_d
				},
			)
		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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