Sha256: 2370e57b7b5919d3e76674786d305613fd9b00615964de24b5b18c372ab8a76c
Contents?: true
Size: 1.69 KB
Versions: 3
Compression:
Stored size: 1.69 KB
Contents
module DataModel # Test data for string schemas module Fixtures::String extend self include Fixtures # a simple string example # @return [Example] the example def simple Example.new( [:string], variants: { valid: "valid", other_type: 22, missing: nil }, ) end # an email string example # @return [Example] the example def email Example.new( [:string, { format: "@" }], variants: { valid: "foo@bar.com", invalid: "invalid" }, ) end # a string example that is optional # @return [Example] the example def optional Example.new( [:string, { optional: true }], variants: { valid: "valid", blank: "", missing: nil }, ) end # a string example where "valid" is the only allowed String # @return [Example] the example def inclusion Example.new( [:string, { included: ["valid"] }], variants: { valid: "valid", outside: "invalid" }, ) end # a string example where "invalid" is the only disallowed String # @return [Example] the example def exclusion Example.new( [:string, { excluded: ["invalid"] }], variants: { valid: "valid", inside: "invalid" }, ) end # a string example where blank strings are allowed # @return [Example] the example def allow_blank Example.new( [:string, { allow_blank: true }], variants: { blank: "", not_blank: "content", missing: nil }, ) end # a string example where blank strings are not allowed # @return [Example] the example def dont_allow_blank Example.new( [:string, { allow_blank: false }], variants: { blank: "" }, ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
data_model-0.6.1 | lib/data_model/fixtures/string.rb |
data_model-0.6.0 | lib/data_model/fixtures/string.rb |
data_model-0.5.0 | lib/data_model/fixtures/string.rb |