This repository has been archived by the owner on May 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathdata_tables.feature
51 lines (48 loc) · 1.62 KB
/
data_tables.feature
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
Feature: Data Tables
Scenario: a data table interpreted as an array
Given a scenario with:
"""
Given the following cukes:
| Cucumis sativus | Cucumber |
| Cucumis anguria | Burr Gherkin |
"""
And the step "the following cukes:" has a passing mapping that receives a data table
When Cucumber executes the scenario
Then the scenario passes
And the received data table array equals the following:
"""
[
[ "Cucumis sativus", "Cucumber" ],
[ "Cucumis anguria", "Burr Gherkin" ]
]
"""
Scenario: a data table can be read as an array of hashes
Given the following data table in a step:
"""
| Latin | English |
| Cucumis sativus | Cucumber |
| Cucumis anguria | Burr Gherkin |
"""
When the data table is passed to a step mapping that converts it to key/value pairs
Then the data table is converted to the following:
"""
[
{ "Latin":"Cucumis sativus", "English":"Cucumber" },
{ "Latin":"Cucumis anguria", "English":"Burr Gherkin" }
]
"""
Scenario: a data table can be read as an array of values
Given the following data table in a step:
"""
| Latin | English |
| Cucumis sativus | Cucumber |
| Cucumis anguria | Burr Gherkin |
"""
When the data table is passed to a step mapping that gets the row arrays without the header
Then the data table is converted to the following:
"""
[
[ "Cucumis sativus", "Cucumber" ],
[ "Cucumis anguria", "Burr Gherkin" ]
]
"""