Skip to content

Commit 3c11307

Browse files
committed
Document table-format step usage in the readme
1 parent 4394b01 commit 3c11307

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ Now, you can use the json_spec steps in your features:
141141
"""
142142

143143
The background steps above aren't provided by json_spec and the "visit" steps are provided by
144-
Capybara. The remaining steps all stem from the five steps that json_spec provides. They're
145-
versatile and can be used in plenty of different formats:
144+
Capybara. The remaining steps, json_spec provides. They're versatile and can be used in plenty of
145+
different formats:
146146

147147
Then the JSON should be:
148148
"""
@@ -183,6 +183,30 @@ versatile and can be used in plenty of different formats:
183183

184184
_All instances of "should" above could be followed by "not" and all instances of "JSON" could be downcased and/or followed by "response."_
185185

186+
### Table format
187+
188+
Another step exists that uses Cucumber's table formatting and wraps two of the above steps:
189+
190+
Then the JSON should have the following:
191+
| path/0 | {"key":"value"} |
192+
| path/1 | ["entry","entry"] |
193+
194+
Any number of rows can be given. The step above is equivalent to:
195+
196+
Then the JSON at "path/0" should be {"key":"value"}
197+
And the JSON at "path/1" should be ["entry","entry"]
198+
199+
If only one column is given:
200+
201+
Then the JSON should have the following:
202+
| path/0 |
203+
| path/1 |
204+
205+
This is equivalent to:
206+
207+
Then the JSON should have "path/0"
208+
And the JSON should have "path/1"
209+
186210
### JSON Memory
187211

188212
There's one more Cucumber step that json_spec provides which hasn't been used above. It's used to

0 commit comments

Comments
 (0)