Sha256: 5e3dd42bc6c3f727564d193de982768667b6f58acf1d4fc76629d368c9c51392

Contents?: true

Size: 1.95 KB

Versions: 1

Compression:

Stored size: 1.95 KB

Contents

Feature: Core schema: default

  Scenario: validation succeeds because of default
    When the schema is:
      """
      {
          "properties": {
              "name": {
                  "type": "string",
                  "required": true
              }
          },

          "default": {
              "name": "Gristle Thornbody"
          }
      }
      """
      Then '{ "age": 35 }' is valid JSON

  Scenario: validation fails because of default
    When the schema is:
      """
      {
          "properties": {
              "name": {
                  "type": "string"
              }
          },

          "default": {
              "name": 1999
          }
      }
      """
    Then '{ "age": 35 }' is not valid JSON

  Scenario: validation of property succeeds because of default
    When the schema is:
      """
      {
          "properties": {
              "pi": {
                  "type": "number",
                  "required": true,
                  "default": 3.1415
              }
          }
      }
      """
    Then '{ "somethingElse": "foo" }' is valid JSON
    But '{ "pi": "is delicious" }' is not valid JSON

  Scenario: validation of property fails because of default
    When the schema is:
      """
      {
          "properties": {
              "pi": {
                  "type": "number",
                  "required": true,
                  "default": "is delicious"
              }
          }
      }
      """
    Then '{ "somethingElse": "foo" }' is not valid JSON
    But '{ "pi": 3.1415 }' is valid JSON

  Scenario: does not fall back for boolean false
    When the schema is:
      """
      {
          "properties": {
              "enabled": {
                  "type": "boolean",
                  "required": true,
                  "default": "is delicious"
              }
          }
      }
      """
    Then '{ "enabled": false }' is valid JSON
    But '{}' is not valid JSON


  Scenario: default for all types
    TODO: spec

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jschematic-0.1.0 features/default.feature