File: paths.feature

package info (click to toggle)
ruby-json-spec 1.1.5-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 312 kB
  • sloc: ruby: 1,059; makefile: 2
file content (74 lines) | stat: -rw-r--r-- 1,712 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Feature: Paths
  Background:
    Given the JSON is:
      """
      {
        "array": [
          {
            "one": 1,
            "two": 2
          },
          {
            "four": 4,
            "three": 3
          }
        ],
        "hash": {
          "even": [
            6,
            8
          ],
          "odd": [
            5,
            7
          ]
        },
        "id": null
      }
      """

  Scenario: Base paths
    When I get the JSON
    Then the JSON should have "array"
    And the JSON should have "hash"
    And the JSON should have "id"

  Scenario: Nested paths
    When I get the JSON
    Then the JSON should have "array/0"
    And the JSON should have "array/1"
    And the JSON should have "hash/even"
    And the JSON should have "hash/odd"

  Scenario: Deeply nested paths
    When I get the JSON
    Then the JSON should have "array/0/one"
    And the JSON should have "array/0/two"
    And the JSON should have "array/1/four"
    And the JSON should have "array/1/three"
    And the JSON should have "hash/even/0"
    And the JSON should have "hash/even/1"
    And the JSON should have "hash/odd/0"
    And the JSON should have "hash/odd/1"

  Scenario: Ignored paths
    When I get the JSON
    Then the JSON should have "id"

  Scenario: Table format
    When I get the JSON
    Then the JSON should have the following:
      | array         |
      | hash          |
      | array/0       |
      | array/1       |
      | hash/even     |
      | hash/odd      |
      | array/0/one   |
      | array/0/two   |
      | array/1/four  |
      | array/1/three |
      | hash/even/0   |
      | hash/even/1   |
      | hash/odd/0    |
      | hash/odd/1    |