Module: Fixtures::String
- Extended by:
- String
- Includes:
- Fixtures
- Included in:
- String
- Defined in:
- lib/data_model/fixtures/string.rb
Overview
Test data for string schemas
Instance Method Summary collapse
-
#allow_blank ⇒ Example
a string example where blank strings are allowed.
-
#dont_allow_blank ⇒ Example
a string example where blank strings are not allowed.
-
#email ⇒ Example
an email string example.
-
#exclusion ⇒ Example
a string example where “invalid” is the only disallowed String.
-
#inclusion ⇒ Example
a string example where “valid” is the only allowed String.
-
#optional ⇒ Example
a string example that is optional.
-
#simple ⇒ Example
a simple string example.
Instance Method Details
#allow_blank ⇒ Example
a string example where blank strings are allowed
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/data_model/fixtures/string.rb', line 71 def allow_blank Example.new( [:string, { allow_blank: true }], variants: { blank: "", not_blank: "content", missing: nil }, ) end |
#dont_allow_blank ⇒ Example
a string example where blank strings are not allowed
84 85 86 87 88 89 90 91 |
# File 'lib/data_model/fixtures/string.rb', line 84 def dont_allow_blank Example.new( [:string, { allow_blank: false }], variants: { blank: "" }, ) end |
#email ⇒ Example
an email string example
22 23 24 25 26 27 28 29 30 |
# File 'lib/data_model/fixtures/string.rb', line 22 def email Example.new( [:string, { format: "@" }], variants: { valid: "[email protected]", invalid: "invalid" }, ) end |
#exclusion ⇒ Example
a string example where “invalid” is the only disallowed String
59 60 61 62 63 64 65 66 67 |
# File 'lib/data_model/fixtures/string.rb', line 59 def exclusion Example.new( [:string, { excluded: ["invalid"] }], variants: { valid: "valid", inside: "invalid" }, ) end |
#inclusion ⇒ Example
a string example where “valid” is the only allowed String
47 48 49 50 51 52 53 54 55 |
# File 'lib/data_model/fixtures/string.rb', line 47 def inclusion Example.new( [:string, { included: ["valid"] }], variants: { valid: "valid", outside: "invalid" }, ) end |