cucumber-rest-bdd 0.3.4.pre.alpha.pre.86

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 354ca6b1520bfe6005fb8021e4a392b6c5e98f5c
4
+ data.tar.gz: 5d5e38d996f3d5766b641e1a9b1cb41db0c2edae
5
+ SHA512:
6
+ metadata.gz: 7f3d861a146be7a1365d626948b92d922a55b64dc1bd767921446c06541f51fd71ea53844f1dba5f95515561bca5d2f82cfbcfadcdf254deab2a65362546e1b5
7
+ data.tar.gz: 7b0c99880dff53a71d2df02542f813cfd583ef31c08a2b91063283a650abcd03b1775d17d14fbd55e4be5a1e78ecb8313eedd65c69f6ea53bd989e9d2791024c
data/.gitignore ADDED
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ language: shell
2
+ sudo: required
3
+ services:
4
+ - docker
5
+ install:
6
+ - make build
7
+ script:
8
+ - make test
9
+ deploy:
10
+ provider: rubygems
11
+ api_key:
12
+ secure: obDis+hzVaV8Dk0i2V9bd3QiFhjdEpMZ6SxmTWDnbLcnYuhJyY7VPO3Jk9hINAWZPxH//uByVT+5p2r3YpmKUQxxoMtqJ7R8+aybfvlrDC9ZNoyE6lYF/Ysnj03pXMA5qwfqXt5ZVZuMvqAUj8J3sQBRSFwq7f/tlsAQdG1nowPL9lkxqOE++z+WvMvzkTs4x2RosrBg81eFNiCe0XKUXQGFbIneUA34Xjf/Mg+dls0UckyKBJO/3yoq3aCjYAaMGeA0UtfXwVqBdv7xhv8edzuJwbwrnstgQmwk6pR6XVIPff8wqHvRMHRXcFlPvRYv9WW4/CIxi6nvdpSlgeVXs9q1I22Z7f5sJy0As41wLoG95NVokqb2tFRz7ZwZU6tFNsJvK2tO8Bas0Gx6KTTThb2NTNdWQFczYBI/ERtYUB9qVRVlPDsK+iLRmFLi71H50aSbwnuXGEAfinXRmXvpLgPe1ZMYxMq+uz/ETBpCBfD26FQm3ieXIEb92GG7eswbIyv/LktCglEhNXR6FImqf1Ni2OOSXskJH+DTGnOkDHVFq5AhGQ8MtvJdsnJdm4p3PKzddzMPJ58cTwDOEd4uq7uNR/PGtE1w5FE3FNVIXr5ny1f9CpDwMpLL9xQ/AbgV9bJxBzqseBvXhn3HondJyZld1rfiUopvz/XGrydRvAo=
13
+ gem: cucumber-rest-bdd
14
+ on:
15
+ repo: graze/cucumber-rest-bdd
data/Dockerfile ADDED
@@ -0,0 +1,17 @@
1
+ FROM ruby
2
+
3
+ MAINTAINER "Harry Bragg <harry.bragg@graze.com>"
4
+ LABEL version="0.3.4" \
5
+ license="MIT"
6
+
7
+ RUN gem install cucumber-rest-bdd
8
+
9
+ WORKDIR /opt/src
10
+
11
+ ENV field_separator=_
12
+ ENV field_camel=false
13
+ ENV resource_single=false
14
+ ENV cucumber_api_verbose=false
15
+ ENV data_key=
16
+
17
+ CMD ["cucumber"]
data/Dockerfile.dev ADDED
@@ -0,0 +1,22 @@
1
+ FROM ruby
2
+
3
+ MAINTAINER "Harry Bragg <harry.bragg@graze.com>"
4
+ LABEL version="0.3.4" \
5
+ license="MIT"
6
+
7
+ COPY . /usr/local/cucumber-rest-bdd
8
+ WORKDIR /usr/local/cucumber-rest-bdd
9
+
10
+ RUN gem build cucumber-rest-bdd.gemspec \
11
+ && gem install cucumber-rest-bdd-*.gem \
12
+ && rm -rf /usr/local/cucumber-rest-bdd
13
+
14
+ WORKDIR /opt/src
15
+
16
+ ENV field_separator=_
17
+ ENV field_camel=false
18
+ ENV resource_single=false
19
+ ENV cucumber_api_verbose=false
20
+ ENV data_key=
21
+
22
+ CMD ["cucumber"]
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016 graze.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/Makefile ADDED
@@ -0,0 +1,15 @@
1
+ TAG := graze/cucumber-rest-bdd
2
+ RUN := docker run --rm -it -v $(PWD):/opt/src -w /opt/src ${TAG}
3
+
4
+ build:
5
+ docker-compose build runner
6
+
7
+ test: start-test-server
8
+ docker-compose run --rm runner cucumber --order random
9
+ make stop-test-server > /dev/null 2>&1 &
10
+
11
+ start-test-server: stop-test-server
12
+ docker-compose up -d test-server
13
+
14
+ stop-test-server:
15
+ docker-compose stop test-server
data/README.md ADDED
@@ -0,0 +1,267 @@
1
+ # Cucumber Rest BDD
2
+
3
+ [![Build Status](https://travis-ci.org/graze/cucumber-rest-bdd.svg?branch=master)](https://travis-ci.org/graze/cucumber-rest-bdd)
4
+ [![](https://images.microbadger.com/badges/image/graze/cucumber-rest-bdd.svg)](https://microbadger.com/images/graze/cucumber-rest-bdd "Get your own image badge on microbadger.com")
5
+ [![](https://images.microbadger.com/badges/version/graze/cucumber-rest-bdd.svg)](https://microbadger.com/images/graze/cucumber-rest-bdd "Get your own version badge on microbadger.com")
6
+ [![](https://images.microbadger.com/badges/license/graze/cucumber-rest-bdd.svg)](https://microbadger.com/images/graze/cucumber-rest-bdd "Get your own license badge on microbadger.com")
7
+
8
+ A set of Behavioural tests that can be run against a REST API.
9
+
10
+ ![Giphy](https://media3.giphy.com/media/Tv7VPg6Os488g/giphy.gif)
11
+
12
+ This is based from: http://gregbee.ch/blog/effective-api-testing-with-cucumber
13
+
14
+ A list of [Steps](STEPS.md) shows the comparison between Behavioural and Functional tests provided by this package.
15
+
16
+ ## Configuration
17
+
18
+ The following environment variables modify how this will operate:
19
+
20
+ - `endpoint` - (string) the base url to call for each request
21
+ - `data_key` - (string) the root data key (if applicable) (for example: `"data"` if all responses have a `{"data":{}}` field)
22
+ - `field_separator` - (string) the separator used between words by the api
23
+ - `field_camel` - (bool [`true`|`false`]) does this endpoint use camelCase for fields (default: `false`)
24
+ - `resource_single` - (bool [`true`|`false`]) if each resource should be singularized or not (default: `false`)
25
+
26
+ ## Examples
27
+
28
+ - For a full list of steps see: [STEPS](STEPS.md)
29
+ - These examples are taken from the test [features](features)
30
+
31
+ ### Retrieve items
32
+
33
+ ```gherkin
34
+ Given I am a client
35
+ When I request the post "1"
36
+ Then the request was successful
37
+ And the response has the following attributes:
38
+ | attribute | type | value |
39
+ | User Id | numeric | 1 |
40
+ | Id | numeric | 1 |
41
+ | Title | string | sunt aut facere repellat provident occaecati excepturi optio reprehenderit |
42
+ | Body | string | quia et suscipit\\nsuscipit recusandae consequuntur expedita et cum\\nreprehenderit molestiae ut ut quas totam\\nnostrum rerum est autem sunt rem eveniet architecto |
43
+ ```
44
+
45
+ ```gherkin
46
+ Given I am a client
47
+ When I request a list of posts with:
48
+ | User Id | 2 |
49
+ Then the request is successful
50
+ And the response is a list of at least 2 posts
51
+ And one response has the following attributes:
52
+ | attribute | type | value |
53
+ | User Id | numeric | 2 |
54
+ | Id | numeric | 11 |
55
+ | Title | string | et ea vero quia laudantium autem |
56
+ | Body | string | delectus reiciendis molestiae occaecati non minima eveniet qui voluptatibus\\naccusamus in eum beatae sit\\nvel qui neque voluptates ut commodi qui incidunt\nut animi commodi |
57
+ ```
58
+
59
+ You can inspect child objects by using `:` in between the names
60
+
61
+ ```gherkin
62
+ Given I am a client
63
+ When I request the comment "1" with:
64
+ | `_expand` | post |
65
+ Then the response has the following attributes:
66
+ | attribute | type | value |
67
+ | name | string | id labore ex et quam laborum |
68
+ | email | string | Eliseo@gardner.biz |
69
+ | body | string | laudantium enim quasi est quidem magnam voluptate ipsam eos\\ntempora quo necessitatibus\\ndolor quam autem quasi\\nreiciendis et nam sapiente accusantium |
70
+ | post : title | string | sunt aut facere repellat provident occaecati excepturi optio reprehenderit |
71
+ | post : body | string | quia et suscipit\\nsuscipit recusandae consequuntur expedita et cum\\nreprehenderit molestiae ut ut quas totam\\nnostrum rerum est autem sunt rem eveniet architecto |
72
+ ```
73
+
74
+ Alternatively you can inspect child arrays and objects by describing the path of the object with attributes
75
+
76
+ ```gherkin
77
+ Given I am a client
78
+ When I set JSON request body to:
79
+ """
80
+ {"title":"test","body":"multiple",
81
+ "comments":[
82
+ {"common":1,"id":1,"title":"fish","body":"cake","image":{"href":"some_url"}},
83
+ {"common":1,"id":2,"title":"foo","body":"bar","image":{"href":"some_url"}}
84
+ ]}
85
+ """
86
+ And I send a POST request to "http://test-server/posts"
87
+ Then the response has the attributes:
88
+ | attribute | type | value |
89
+ | title | string | test |
90
+ | body | string | multiple |
91
+ And the response has a list of comments
92
+ And the response has a list of 2 comments
93
+ And the response has two comments with attributes:
94
+ | attribute | type | value |
95
+ | common | integer | 1 |
96
+ And the response has two comments with an image with attributes:
97
+ | attribute | type | value |
98
+ | href | string | some_url |
99
+ And the response has one comment with attributes:
100
+ | attribute | type | value |
101
+ | Id | integer | 1 |
102
+ | Title | string | fish |
103
+ | Body | string | cake |
104
+ And the response has one comment with attributes:
105
+ | attribute | type | value |
106
+ | Id | integer | 2 |
107
+ | Title | string | foo |
108
+ | Body | string | bar |
109
+ ```
110
+
111
+ Each numeric request can be prefixed with a modifier to modify the number specified
112
+
113
+ ```gherkin
114
+ Given I am a client
115
+ When I request a list of posts with:
116
+ | `_embed` | comments |
117
+ Then the response is a list of posts
118
+ Then the response is a list of more than 5 posts
119
+ Then the response is a list of at least 10 posts
120
+ Then more than three posts have the attributes:
121
+ | attribute | type | value |
122
+ | User Id | integer | 5 |
123
+ Then less than 200 posts have more than four comments
124
+ Then more than 50 posts have less than six comments
125
+ Then more than 80 posts have a list of comments
126
+ Then at least 90 posts have a list of five comments
127
+ Then more than 10 posts have five comments
128
+ Then less than 200 posts have five comments
129
+ ```
130
+
131
+ ### Creation
132
+
133
+ ```gherkin
134
+ Given I am a client
135
+ When I request to create a post with:
136
+ | attribute | type | value |
137
+ | Title | string | foo |
138
+ | Body | string | bar |
139
+ | User Id | numeric | 1 |
140
+ Then the request is successful and a post was created
141
+ And the response has the following attributes:
142
+ | attribute | type | value |
143
+ | User Id | numeric | 1 |
144
+ | Title | string | foo |
145
+ | Body | string | bar |
146
+ ```
147
+
148
+ ### Removal
149
+
150
+ ```gherkin
151
+ Given I am a client
152
+ When I request to remove the post "20"
153
+ Then the request is successful
154
+ ```
155
+
156
+ ### Modification
157
+
158
+ ```gherkin
159
+ Given I am a client
160
+ When I request to modify the post "21" with:
161
+ | attribute | type | value |
162
+ | Title | string | foo |
163
+ Then the request is successful
164
+ And the response has the following attributes:
165
+ | attribute | type | value |
166
+ | User Id | numeric | 3 |
167
+ | Title | string | foo |
168
+ | Body | string | repellat aliquid praesentium dolorem quo\\nsed totam minus non itaque\\nnihil labore molestiae sunt dolor eveniet hic recusandae veniam\\ntempora et tenetur expedita sunt |
169
+ ```
170
+
171
+ ### Multiple Requests
172
+
173
+ ```gherkin
174
+ Given I am a client
175
+ When I request to create a post with:
176
+ | attribute | type | value |
177
+ | Title | string | foo |
178
+ | Body | string | bar |
179
+ | User Id | integer | 12 |
180
+ Then the request is successful
181
+ When I save "id"
182
+ And I request the post "{id}"
183
+ Then the request is successful
184
+ And the response has the following attributes:
185
+ | attribute | type | value |
186
+ | Title | string | foo |
187
+ | Body | string | bar |
188
+ | User Id | numeric | 12 |
189
+ | Id | numeric | {id} |
190
+ ```
191
+
192
+ ## Resources
193
+
194
+ A resource "name" is attempted to be retrieved from the given name of the item to be retrieved. This pluralises, ensures everything is lower case, removes any unparameterisable characters and uses a `-` separator.
195
+
196
+ ```
197
+ Token -> tokens
198
+ User -> users
199
+ Big Life -> big-lifes
200
+ octopus -> octopi
201
+ ```
202
+
203
+ If the environment variable: `resource_single` is set to `true` then it will not attempt to pluralise the resources.
204
+
205
+ ```
206
+ Token -> token
207
+ User -> user
208
+ ```
209
+
210
+ You can directly pass what you want using:
211
+ ```
212
+ `field`
213
+ ```
214
+ this will not modify the field.
215
+
216
+ ## Attributes
217
+
218
+ ### Types
219
+
220
+ Attribute types:
221
+ The following types are supported:
222
+
223
+ | type | other names | example |
224
+ |---------|-----------------------|-----------|
225
+ | integer | numeric, number, long | 12 |
226
+ | float | double, decimal | 4.8 |
227
+ | string | text | "text" |
228
+ | array | array | ["a"] |
229
+ | object | object | {"a":"b"} |
230
+ | null | nil | |
231
+ | bool | boolean | true |
232
+
233
+ ### Name conversion
234
+
235
+ attributes are converted into singular parametrised versions of the provided name:
236
+
237
+ The conversion is based on the provided environment variables `field_camel` and `field_separator`
238
+
239
+ **Default**
240
+ ```
241
+ field_camel=false
242
+ field_separator=_
243
+
244
+ Someid -> someid
245
+ Product Id -> product_id
246
+ Bodies -> body
247
+ ```
248
+
249
+ **CamelCase**
250
+ ```
251
+ field_camel=true
252
+ field_separator=_
253
+
254
+ Someid -> someid
255
+ Product Id -> productId
256
+ Bodies -> body
257
+ ```
258
+
259
+ **Other separator**
260
+ ```
261
+ field_camel=false
262
+ field_separator=-
263
+
264
+ Someid -> someid
265
+ Product Id -> product-id
266
+ Bodies -> body
267
+ ```
data/STEPS.md ADDED
@@ -0,0 +1,199 @@
1
+ # Gherkin Steps
2
+
3
+ This test suite introduces behavioural test steps on top of functional REST API steps from [cucumber-api](https://github.com/hidroh/cucumber-api)
4
+
5
+ The following is a list of steps, and their equivalent functional step
6
+
7
+ ## Setup
8
+
9
+ ```
10
+ Behavioural Functional
11
+ --------------------------------------------------- --------------------------------------------------------------
12
+ Given I am a client Given I send and accept JSON
13
+ ```
14
+
15
+ ## Retrieval
16
+
17
+ ```
18
+ Behavioural Functional
19
+ --------------------------------------------------- --------------------------------------------------------------
20
+ When I request an item "2" When I send a GET request to "http://url/items/2"
21
+
22
+ When I request a list of items When I send a GET request to "http://url/items"
23
+
24
+ When I request a list of items with: When I send a GET request to "http://url/items" with:
25
+ | User Id | 12 | | userId |
26
+ | 12 |
27
+ ```
28
+
29
+ ## Creation
30
+
31
+ ```
32
+ Behavioural Functional
33
+ --------------------------------------------------- --------------------------------------------------------------
34
+ When I request to create an item When I send a POST request to "http://url/items"
35
+
36
+ When I request to create an item with: When I set JSON request body to:
37
+ | attribute | type | value | """
38
+ | User Id | integer | 12 | {"userId":12,"title":"foo"}
39
+ | Title | string | foo | """
40
+ And I send a POST request to "http://url/items"
41
+
42
+ When I request to create an item with id "4" When I send a PUT request to "http://url/items/4"
43
+
44
+ When I request to replace the item "4" with: When I set JSON request body to:
45
+ | attribute | type | value | """
46
+ | User Id | integer | 7 | {"userId":7,"title":"foo"}
47
+ | Title | string | foo | """
48
+ And I send a PUT request to "http://url/items/4"
49
+ ```
50
+
51
+ ## Modification
52
+
53
+ ```
54
+ Behavioural Functional
55
+ --------------------------------------------------- --------------------------------------------------------------
56
+ When I request to modify the item "4" with: When I set JSON request body to:
57
+ | attribute | type | value | """
58
+ | Body | string | bar | {"body":"bar"}
59
+ """
60
+ And I send a PATCH request to "http://url/items/4"
61
+ ```
62
+
63
+ ## Status Inspection
64
+
65
+ ```
66
+ Behavioural Functional
67
+ --------------------------------------------------- --------------------------------------------------------------
68
+ Then the request is successful Then the response status should be "200"
69
+
70
+ Then the request was redirected <N/A> (response status between "300" and "400")
71
+
72
+ Then the request failed <N/A> (response status between "400" and "600")
73
+
74
+ Then the request was successful and an item was Then the response status should be "201"
75
+ created
76
+
77
+ Then the request was successfully accepted Then the response status should be "202"
78
+
79
+ Then the request was successful and no response Then the response status should be "204"
80
+ body is returned
81
+
82
+ Then the request failed because it was invalid Then the response status should be "400"
83
+
84
+ Then the request failed because I am unauthorised Then the response status should be "401"
85
+
86
+ Then the request failed because it was forbidden Then the response status should be "403"
87
+
88
+ Then the request failed because the item was not Then the response status should be "404"
89
+ found
90
+
91
+ Then the request failed because it was not allowed Then the response status should be "405"
92
+
93
+ Then the request failed because there was a Then the response status should be "409"
94
+ conflict
95
+
96
+ Then the request failed because the item has gone Then the response status should be "410"
97
+
98
+ Then the request failed because it was not Then the response status should be "501"
99
+ implemented
100
+ ```
101
+
102
+ ## Response Inspection
103
+
104
+ ```
105
+ Behavioural Functional
106
+ --------------------------------------------------- --------------------------------------------------------------
107
+ Then the response has the following attributes: Then the JSON response should have "userId" of type numeric
108
+ | attribute | type | value | with value "12"
109
+ | User Id | integer | 12 | Then the JSON response should have "title" of type numeric
110
+ | Title | string | foo | with value "foo"
111
+ | Body | string | bar | Then the JSON response should have "body" of type numeric with
112
+ value "bar"
113
+
114
+ Then the response is a list of 12 items Then the JSON response should have "$." of type array with 12
115
+ entries
116
+
117
+ Then the response is a list of at least 12 items Then the JSON response should have "$." of type array with at
118
+ least 12 entries
119
+ Then the response is a list of at most 12 items <N/A>
120
+ Then the response is a list of fewer than 12 items <N/A>
121
+ Then the response is a list of more than 12 items <N/A>
122
+
123
+ Then two items have have the following attributes: <N/A>
124
+ | attribute | type | value |
125
+ | User Id | integer | 12 |
126
+ | Title | string | foo |
127
+ | Body | string | bar |
128
+
129
+ Then more than two items have have the following <N/A>
130
+ attributes:
131
+ | attribute | type | value |
132
+ | User Id | integer | 12 |
133
+ | Title | string | foo |
134
+ | Body | string | bar |
135
+
136
+ <N/A> Then the JSON response should follow "schema.json"
137
+
138
+ <N/A> Then the response has the header "Content Type" with value
139
+ "application/json"
140
+ ```
141
+
142
+ ### Attribute saving and re-use
143
+
144
+ ```
145
+ Behavioural Functional
146
+ --------------------------------------------------- --------------------------------------------------------------
147
+ When I save "User Id" as "user" When I grab "$.userId" as "user"
148
+ And I request the user "{user}" And I send a GET request to "http://url/users/{user}"
149
+ ```
150
+
151
+ ### Nested responses
152
+
153
+ ```
154
+ Behavioural Functional
155
+ --------------------------------------------------- --------------------------------------------------------------
156
+ Then the response has the following attributes: Then the JSON response should have "userId" of type numeric
157
+ | attribute | type | value | with value "12"
158
+ | User Id | integer | 12 | Then the JSON response should have "title" of type numeric
159
+ | Title | string | foo | with value "foo"
160
+ | Body | string | bar | Then the JSON response should have "body" of type numeric with
161
+ | Post : Title | string | baz | value "bar"
162
+ | Post : Body | string | boo | Then the JSON response should have "post.title" of type string
163
+ with value "baz"
164
+ Then the JSON response should have "post.body" of type string
165
+ with value "boo"
166
+
167
+ Then the response has a list of comments Then the JSON response should have "comments" of type array
168
+
169
+ Then the response has a list of 2 comments Then the JSON response should have "comments" of type array with
170
+ 2 entries
171
+ Then the response has a list of at least Then the JSON response should have "comments" of type array with
172
+ 2 comments at least 2 entries
173
+
174
+ Then the response has a post with two comments <N/A>
175
+ with attributes:
176
+ | attribute | type | value |
177
+ | Title | string | foo |
178
+ | Body | string | bar |
179
+
180
+ Then two items contains two posts with three <N/A>
181
+ comments with an image with attributes:
182
+ | attribute | type | value |
183
+ | Href | string | some_url |
184
+
185
+ Then more than two items contains fewer than two <N/A>
186
+ posts with at least three comments with an
187
+ image with attributes:
188
+ | attribute | type | value |
189
+ | Href | string | some_url |
190
+
191
+ Then the response has a post with a list of Then the JSON response should have "post.comments" of type array
192
+ comments
193
+
194
+ Then the response has a post with a list of more Then the JSON response should have "post.comments" of type array
195
+ than 3 comments with at least 4 comments
196
+
197
+ Then more than three posts have less than two <N/A>
198
+ comments
199
+ ```
@@ -0,0 +1,19 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'cucumber-rest-bdd'
3
+ s.version = '0.3.4'
4
+ s.version = "#{s.version}-alpha-#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV['TRAVIS'] && ENV['TRAVIS_TAG'] == ''
5
+ s.platform = Gem::Platform::RUBY
6
+ s.date = '2017-01-10'
7
+ s.summary = 'BDD Rest API specifics for cucumber'
8
+ s.description = 'Series of BDD cucumber rules for testing API endpoints'
9
+ s.authors = ["Harry Bragg"]
10
+ s.email = ["harry.bragg@graze.com"]
11
+ s.files = `git ls-files`.split("\n")
12
+ s.require_paths = ["lib"]
13
+ s.homepage = 'http://github.com/graze/cucumber-rest-bdd'
14
+ s.license = 'MIT'
15
+
16
+ s.add_dependency('cucumber-api', '~> 0.4')
17
+ s.add_dependency('activesupport', '~> 5.0')
18
+ s.add_dependency('easy_diff', '~> 1.0')
19
+ end
@@ -0,0 +1,22 @@
1
+ version: '2'
2
+ services:
3
+ test-server:
4
+ image: clue/json-server
5
+ volumes:
6
+ - ./server/db.json:/data/db.json:ro
7
+
8
+ runner:
9
+ image: graze/cucumber-rest-bdd
10
+ build:
11
+ context: .
12
+ dockerfile: Dockerfile.dev
13
+ volumes:
14
+ - .:/opt/src
15
+ working_dir: /opt/src
16
+ environment:
17
+ - endpoint=http://test-server/
18
+ - cucumber_api_verbose=false
19
+ - field_separator=_
20
+ - field_camel=true
21
+ - resource_single=false
22
+ - data_key=