fitting 2.14.1 → 2.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +33 -0
- data/.ruby-version +1 -1
- data/.tool-versions +1 -1
- data/CHANGELOG.md +27 -0
- data/README.md +96 -282
- data/fitting.gemspec +5 -5
- data/images/example.png +0 -0
- data/images/example2.png +0 -0
- data/images/logo.png +0 -0
- data/lib/fitting/report/actions.rb +1 -5
- data/lib/fitting/report/console.rb +1 -1
- data/lib/fitting/report/prefix.rb +37 -2
- data/lib/fitting/report/prefixes.rb +14 -2
- data/lib/fitting/report/response.rb +2 -2
- data/lib/fitting/report/test.rb +14 -0
- data/lib/fitting/report/tests.rb +8 -1
- data/lib/fitting/version.rb +1 -1
- data/lib/tasks/fitting.rake +2 -0
- data/lib/templates/bomboniere/dist/css/app.aa2bcd8a.css +1 -0
- data/lib/templates/bomboniere/dist/index.html +1 -1
- data/lib/templates/bomboniere/dist/js/app.e5f1a5ec.js +2 -0
- data/lib/templates/bomboniere/dist/js/app.e5f1a5ec.js.map +1 -0
- data/lib/templates/bomboniere/dist/js/{chunk-vendors.90aeb613.js → chunk-vendors.0f99b670.js} +1 -1
- data/lib/templates/bomboniere/dist/js/{chunk-vendors.90aeb613.js.map → chunk-vendors.0f99b670.js.map} +1 -1
- data/lib/templates/bomboniere/package-lock.json +91 -70
- data/lib/templates/bomboniere/package.json +2 -1
- data/lib/templates/bomboniere/src/components/HelloWorld.vue +21 -5
- data/lib/templates/bomboniere/src/views/Action.vue +22 -3
- metadata +44 -34
- data/.travis.yml +0 -4
- data/lib/templates/bomboniere/dist/css/app.62e086ac.css +0 -1
- data/lib/templates/bomboniere/dist/js/app.4356d509.js +0 -2
- data/lib/templates/bomboniere/dist/js/app.4356d509.js.map +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 122a6d2713a74d7e0610f1378b7be6fdd42d0798fa6f6a008dc114186f86eade
|
4
|
+
data.tar.gz: 3af5cf786f1489c9b249603551fe64c2d1fbb6b69183054d9ddadc8553b0a6de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f11047db22a04c8562c75be538152e61cbf78ecd223ac941a61adaca5c2edda6ad44d1a14ac2dd535ca3f5e20bc4ffde4c101e9b48f0525392e248f6c870157e
|
7
|
+
data.tar.gz: 99309897c90a7ea145141a00a073cf82ad56091557c9cd0044a9c5421440f945439e510440820f0f48c7a9f5dd8abec246e6e1872d8ba77d25d8843e94519b80
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v2
|
23
|
+
- name: Set up Ruby
|
24
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
25
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
26
|
+
uses: ruby/setup-ruby@v1
|
27
|
+
# uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
|
28
|
+
with:
|
29
|
+
ruby-version: 2.7
|
30
|
+
- name: Install dependencies
|
31
|
+
run: bundle install
|
32
|
+
- name: Run tests
|
33
|
+
run: bundle exec rake
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.1
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 2.
|
1
|
+
ruby 2.6.1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,32 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
### 2.17.0 - 2021-09-20
|
4
|
+
|
5
|
+
* features
|
6
|
+
* display tests_without_responses details on the main page [#115](https://github.com/funbox/fitting/issues/115)
|
7
|
+
|
8
|
+
### 2.16.1 - 2021-02-10
|
9
|
+
* patch
|
10
|
+
* make prefix optional [#98](https://github.com/funbox/fitting/issues/98)
|
11
|
+
|
12
|
+
### 2.16.0 - 2021-02-10
|
13
|
+
|
14
|
+
* features
|
15
|
+
* support swagger and openapi [#96](https://github.com/funbox/fitting/issues/96)
|
16
|
+
* patch
|
17
|
+
* let's bump to tomograph '3.0.1' [#95](https://github.com/funbox/fitting/issues/95)
|
18
|
+
|
19
|
+
### 2.15.0 - 2020-10-12
|
20
|
+
|
21
|
+
* features
|
22
|
+
* color for bad response [#79](https://github.com/funbox/fitting/issues/79)
|
23
|
+
* show test details [#81](https://github.com/funbox/fitting/issues/81)
|
24
|
+
* patch
|
25
|
+
* update ruby [#83](https://github.com/funbox/fitting/issues/83)
|
26
|
+
* update bundler [#84](https://github.com/funbox/fitting/issues/84)
|
27
|
+
* update tomograph [#85](https://github.com/funbox/fitting/issues/85)
|
28
|
+
* use github actions for CI instead of Travis [#30](https://github.com/funbox/fitting/issues/30)
|
29
|
+
|
3
30
|
### 2.14.1 - 2020-09-23
|
4
31
|
|
5
32
|
* fixes
|
data/README.md
CHANGED
@@ -1,42 +1,38 @@
|
|
1
1
|
# Fitting
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
<img align="right" width="192" height="192"
|
4
|
+
alt="Optimizt avatar: OK sign with Mona Lisa picture between the fingers"
|
5
|
+
src="./images/logo.png">
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
There are such ways of describing the API documentation as API Blueprint, Swagger and OpenAPI. And using the tests already writed for your code, you can reuse them to find out the documentation coverage.
|
8
|
+
This makes it easy to find out how much the documentation matches the implementation.
|
8
9
|
|
9
|
-
|
10
|
+
* Cool if you already have a project with tests and documentation, you can check how good everything is and fix microbags.
|
10
11
|
|
11
|
-
|
12
|
+
* If are you going developing API and write documentation for it, this tool will help you document-driven development easily create high-quality write API documentation and API.
|
12
13
|
|
13
|
-
|
14
|
+
* Also, if you have an undocumented API, this is an easy way to describe it.
|
14
15
|
|
16
|
+
![exmaple](images/example.png)
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
Add this line to your application's Gemfile:
|
15
20
|
```ruby
|
16
21
|
gem 'fitting'
|
17
22
|
```
|
18
23
|
|
19
24
|
After that execute:
|
20
|
-
|
21
25
|
```bash
|
22
26
|
$ bundle
|
23
27
|
```
|
24
28
|
|
25
29
|
Or install the gem by yourself:
|
26
|
-
|
27
30
|
```bash
|
28
31
|
$ gem install fitting
|
29
32
|
```
|
30
33
|
|
31
34
|
## Usage
|
32
|
-
|
33
|
-
Add this to your `.fitting.yml`:
|
34
|
-
|
35
|
-
```yaml
|
36
|
-
apib_path: /path/to/doc.apib
|
37
|
-
```
|
38
|
-
|
39
|
-
And this to your `spec_helper.rb`:
|
35
|
+
And next to your `spec_helper.rb`:
|
40
36
|
|
41
37
|
```ruby
|
42
38
|
require 'fitting'
|
@@ -44,304 +40,122 @@ require 'fitting'
|
|
44
40
|
Fitting.save_test_data
|
45
41
|
```
|
46
42
|
|
47
|
-
|
48
|
-
|
49
|
-
Output example:
|
50
|
-
|
51
|
-
```json
|
52
|
-
[
|
53
|
-
{
|
54
|
-
"method": "GET",
|
55
|
-
"path": "/api/v1/book",
|
56
|
-
"body": {},
|
57
|
-
"response": {
|
58
|
-
"status": 200,
|
59
|
-
"body": {
|
60
|
-
"title": "The Martian Chronicles"
|
61
|
-
}
|
62
|
-
},
|
63
|
-
"title": "/spec/controllers/api/v1/books_controller_spec.rb:11",
|
64
|
-
"group": "/spec/controllers/api/v1/books_controller_spec.rb"
|
65
|
-
},
|
66
|
-
{
|
67
|
-
"method": "POST",
|
68
|
-
"path": "/api/v1/book",
|
69
|
-
"body": {},
|
70
|
-
"response": {
|
71
|
-
"status": 200,
|
72
|
-
"body": {
|
73
|
-
"title": "The Old Man and the Sea"
|
74
|
-
}
|
75
|
-
},
|
76
|
-
"title": "/spec/controllers/api/v1/books_controller_spec.rb:22",
|
77
|
-
"group": "/spec/controllers/api/v1/books_controller_spec.rb"
|
78
|
-
}
|
79
|
-
]
|
80
|
-
```
|
81
|
-
|
82
|
-
## Documentation coverage
|
83
|
-
|
84
|
-
To match routes and validate JSON-schemas run:
|
85
|
-
|
86
|
-
```bash
|
87
|
-
rake fitting:documentation_responses[report_size]
|
88
|
-
```
|
89
|
-
|
90
|
-
There are four types (or `report_size`) of reports available:
|
91
|
-
|
92
|
-
- `xs` — the smallest report;
|
93
|
-
- `s` — includes coverage for `required` fields;
|
94
|
-
- `m` — includes coverage for `required` and `enum` fields;
|
95
|
-
- `l` — includes coverage for `required`, `enum` and `oneOf` fields.
|
96
|
-
|
97
|
-
E.g. for `xs` size:
|
98
|
-
|
99
|
-
```bash
|
100
|
-
rake fitting:documentation_responses[xs]
|
101
|
-
```
|
102
|
-
|
103
|
-
**Note**: In zsh you should add quotes around the task:
|
104
|
-
|
105
|
-
```bash
|
106
|
-
rake 'fitting:documentation_responses[xs]'
|
107
|
-
```
|
108
|
-
|
109
|
-
Also you can use `documentation_responses_error` to get more detailed errors description.
|
110
|
-
Check the examples below.
|
111
|
-
|
112
|
-
### Examples
|
113
|
-
|
114
|
-
`xs` size:
|
115
|
-
|
116
|
-
```text
|
117
|
-
Fully conforming requests:
|
118
|
-
DELETE /api/v1/book ✔ 200 ✔ 201 ✔ 404
|
119
|
-
DELETE /api/v1/book/{id} ✔ 200 ✔ 201 ✔ 404
|
120
|
-
GET /api/v1/book/{id}/seller ✔ 200 ✔ 201 ✔ 404
|
121
|
-
|
122
|
-
Partially conforming requests:
|
123
|
-
GET /api/v1/book ✖ 200 ✔ 404
|
124
|
-
POST /api/v1/book ✖ 200 ✔ 201 ✔ 404
|
125
|
-
GET /api/v1/book/{id} ✖ 200 ✔ 404 ✔ 200
|
126
|
-
PATCH /api/v1/book/{id} ✖ 200 ✔ 201 ✔ 404
|
127
|
-
|
128
|
-
Non-conforming requests:
|
129
|
-
GET /api/v1/seller ✖ 200 ✖ 201 ✖ 404
|
130
|
-
GET /api/v1/buyer ✖ 200 ✖ 404
|
131
|
-
|
132
|
-
API requests with fully implemented responses: 3 (33.33% of 9).
|
133
|
-
API requests with partially implemented responses: 4 (44.44% of 9).
|
134
|
-
API requests with no implemented responses: 2 (22.22% of 9).
|
135
|
-
|
136
|
-
API responses conforming to the blueprint: 16 (64.00% of 25).
|
137
|
-
API responses with validation errors or untested: 9 (36.00% of 25).
|
138
|
-
```
|
139
|
-
|
140
|
-
`s` size:
|
141
|
-
|
142
|
-
```text
|
143
|
-
Fully conforming requests:
|
144
|
-
DELETE /api/v1/book 100% 200 100% 201 100% 404
|
145
|
-
DELETE /api/v1/book/{id} 100% 200 100% 201 100% 404
|
146
|
-
GET /api/v1/book/{id}/seller 100% 200 100% 201 100% 404
|
147
|
-
|
148
|
-
Partially conforming requests:
|
149
|
-
GET /api/v1/book 0% 200 66% 404
|
150
|
-
POST /api/v1/book 0% 200 90% 201 100% 404
|
151
|
-
GET /api/v1/book/{id} 0% 200 88% 404 10% 200
|
152
|
-
PATCH /api/v1/book/{id} 0% 200 100% 201 10% 404
|
153
|
-
|
154
|
-
Non-conforming requests:
|
155
|
-
GET /api/v1/seller 0% 200 0% 201 0 404
|
156
|
-
GET /api/v1/buyer 0% 200 0% 404
|
157
|
-
|
158
|
-
API requests with fully implemented responses: 3 (33.33% of 9).
|
159
|
-
API requests with partially implemented responses: 4 (44.44% of 9).
|
160
|
-
API requests with no implemented responses: 2 (22.22% of 9).
|
161
|
-
|
162
|
-
API responses conforming to the blueprint: 16 (64.00% of 25).
|
163
|
-
API responses with validation errors or untested: 9 (36.00% of 25).
|
164
|
-
```
|
43
|
+
Add this to your `.fitting.yml`:
|
165
44
|
|
166
|
-
|
45
|
+
### OpenAPI 2.0
|
46
|
+
Also Swagger
|
167
47
|
|
48
|
+
```yaml
|
49
|
+
prefixes:
|
50
|
+
- name: /api/v1
|
51
|
+
openapi2_json_path: doc.json
|
168
52
|
```
|
169
|
-
request method: GET
|
170
|
-
request path: /api/v1/book
|
171
|
-
response status: 200
|
172
|
-
source json-schema: {"$schema"=>"http://json-schema.org/draft-04/schema#", "type"=>"object", ...}
|
173
|
-
combination: ["required", "pages"]
|
174
|
-
new json-schema: {"$schema"=>"http://json-schema.org/draft-04/schema#", "type"=>"object", ...}
|
175
|
-
```
|
176
|
-
|
177
|
-
### Experimental report
|
178
53
|
|
179
|
-
|
54
|
+
### OpenAPI 3.0
|
55
|
+
Also OpenAPI
|
180
56
|
|
181
|
-
```
|
182
|
-
|
57
|
+
```yaml
|
58
|
+
prefixes:
|
59
|
+
- name: /api/v1
|
60
|
+
openapi3_yaml_path: doc.yaml
|
183
61
|
```
|
184
62
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
## Tests coverage
|
63
|
+
### API Blueprint
|
64
|
+
First you need to install [drafter](https://github.com/apiaryio/drafter).
|
65
|
+
Works after conversion from API Blueprint to API Elements (in YAML file) with Drafter.
|
189
66
|
|
190
|
-
|
67
|
+
That is, I mean that you first need to do this
|
191
68
|
|
192
69
|
```bash
|
193
|
-
|
70
|
+
drafter doc.apib -o doc.yaml
|
194
71
|
```
|
195
72
|
|
196
|
-
|
197
|
-
|
198
|
-
You can specify the settings either in a YAML file `.fitting.yml` or in a config.
|
199
|
-
If your project uses several prefixes, for each one you should create a separate YAML file in the folder `fitting` (`fitting/*.yml`).
|
200
|
-
|
201
|
-
All the available config options are described below.
|
202
|
-
|
203
|
-
### `apib_path`
|
204
|
-
|
205
|
-
Path to API Blueprint v3 documentation.
|
206
|
-
There must be an installed [drafter](https://github.com/apiaryio/drafter) to parse it.
|
207
|
-
|
208
|
-
### `drafter_yaml_path`
|
209
|
-
|
210
|
-
Path to API Blueprint v3 documentation, pre-parsed with `drafter` and saved to a YAML file.
|
211
|
-
|
212
|
-
### `drafter_4_apib_path`
|
213
|
-
|
214
|
-
Path to API Blueprint v4 documentation.
|
215
|
-
There must be an installed [drafter](https://github.com/apiaryio/drafter) to parse it.
|
216
|
-
|
217
|
-
### `drafter_4_yaml_path`
|
218
|
-
|
219
|
-
Path to API Blueprint v4 documentation, pre-parsed with `drafter` and saved to a YAML file.
|
220
|
-
|
221
|
-
### `crafter_apib_path`
|
222
|
-
|
223
|
-
Path to API Blueprint v4 documentation.
|
224
|
-
|
225
|
-
### `crafter_yaml_path`
|
226
|
-
|
227
|
-
Path to API Blueprint v4 documentation, pre-parsed with `crafter` and saved to a YAML file.
|
228
|
-
|
229
|
-
### `tomogram_json_path`
|
230
|
-
|
231
|
-
Path to Tomogram documentation, pre-parsed with [tomograph](https://github.com/funbox/tomograph) and saved to a JSON file.
|
232
|
-
|
233
|
-
### `strict`
|
234
|
-
|
235
|
-
Default: `false`
|
236
|
-
|
237
|
-
When `true` all properties are considered to have `"required": true` and all objects are considered to have `"additionalProperties": false`.
|
238
|
-
|
239
|
-
### `prefix`
|
240
|
-
|
241
|
-
Prefix for API requests. E.g. `'/api'`. Validation will not be performed if the request path does not start with a prefix.
|
242
|
-
|
243
|
-
### `white_list`
|
244
|
-
|
245
|
-
Default: all paths
|
246
|
-
|
247
|
-
This is an array of paths that are mandatory for implementation.
|
248
|
-
The list does not affect the work of the matcher.
|
249
|
-
It's used for the CLI report only.
|
73
|
+
and then
|
250
74
|
|
251
75
|
```yaml
|
252
|
-
|
253
|
-
/
|
254
|
-
|
255
|
-
- POST
|
256
|
-
/users/{id}:
|
257
|
-
- GET
|
258
|
-
- PATCH
|
259
|
-
/users/{id}/employees:
|
260
|
-
- GET
|
261
|
-
/sessions: []
|
76
|
+
prefixes:
|
77
|
+
- name: /api/v1
|
78
|
+
drafter_yaml_path: doc.yaml
|
262
79
|
```
|
263
80
|
|
264
|
-
|
81
|
+
### Tomograph
|
265
82
|
|
266
|
-
|
267
|
-
|
268
|
-
Default: all resources
|
269
|
-
|
270
|
-
This is an array of resources that are mandatory for implementation.
|
271
|
-
The list does not affect the work of the matcher.
|
272
|
-
It's used for the CLI report only.
|
83
|
+
To use additional features of the pre-converted [tomograph](https://github.com/funbox/tomograph)
|
273
84
|
|
274
85
|
```yaml
|
275
|
-
|
276
|
-
/
|
277
|
-
|
278
|
-
- POST /users
|
279
|
-
- GET /users/{id}
|
280
|
-
- PATCH /users/{id}
|
281
|
-
/users/{id}/employees:
|
282
|
-
- GET /users/{id}/employees
|
283
|
-
/sessions: []
|
86
|
+
prefixes:
|
87
|
+
- name: /api/v1
|
88
|
+
tomogram_json_path: doc.json
|
284
89
|
```
|
285
90
|
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
Default: false
|
291
|
-
|
292
|
-
JSON-schema covering becomes mandatory.
|
293
|
-
However, if you don't use `Fitting.statistics` you can call `responses.statistics.cover_save`.
|
294
|
-
|
295
|
-
### `include_resources`
|
296
|
-
|
297
|
-
Default: all resources (but only when `include_resources` and `include_actions` are not defined)
|
298
|
-
|
299
|
-
This is an array of resources that are mandatory for implementation.
|
300
|
-
The list does not affect the work of the matcher.
|
301
|
-
It's used for the CLI report only.
|
302
|
-
|
303
|
-
```yaml
|
304
|
-
include_resources:
|
305
|
-
- /sessions
|
91
|
+
## Run
|
92
|
+
Run tests first to get run artifacts
|
93
|
+
```bash
|
94
|
+
bundle e rspec
|
306
95
|
```
|
307
96
|
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
This is an array of paths that are mandatory for implementation.
|
313
|
-
The list does not affect the work of the matcher.
|
314
|
-
It's used for the CLI report only.
|
315
|
-
|
316
|
-
```yaml
|
317
|
-
include_actions:
|
318
|
-
- DELETE /users/{id}
|
319
|
-
- POST /users
|
320
|
-
- GET /users/{id}
|
321
|
-
- PATCH /users/{id}
|
322
|
-
- GET /users/{id}/employees
|
97
|
+
and then
|
98
|
+
```bash
|
99
|
+
bundle e rake fitting:report
|
323
100
|
```
|
324
101
|
|
325
|
-
|
102
|
+
Console ouptut
|
326
103
|
|
327
|
-
|
104
|
+
```text
|
105
|
+
/api/v1
|
106
|
+
POST /api/v1/accounts/{account_id}/inboxes 0% 200 0% 404 0% 403
|
107
|
+
PATCH /api/v1/accounts/{account_id}/inboxes/{id} 0% 200 0% 404 0% 403
|
108
|
+
POST /api/v1/accounts/{account_id}/inboxes/{id}/set_agent_bot 0% 204 100% 404 0% 403
|
109
|
+
GET /api/v1/agent_bots 0% 200 0% 404 0% 403
|
110
|
+
GET /api/v1/accounts/{account_id}/conversations 0% 200 0% 400 0% description
|
111
|
+
POST /api/v1/accounts/{account_id}/conversations 0% 200 0% 403
|
112
|
+
GET /api/v1/accounts/{account_id}/conversations/{id} 59% 200 0% 404 0% 403
|
113
|
+
POST /api/v1/accounts/{account_id}/conversations/{id}/toggle_status 80% 200 0% 404 0% 403
|
114
|
+
GET /api/v1/accounts/{account_id}/conversations/{id}/messages 47% 200 0% 404 0% 403
|
115
|
+
POST /api/v1/accounts/{account_id}/conversations/{id}/messages 0% 200 0% 404 0% 403
|
116
|
+
GET /api/v1/accounts/{account_id}/conversations/{id}/labels 100% 200 0% 404 0% 403
|
117
|
+
POST /api/v1/accounts/{account_id}/conversations/{id}/labels 100% 200 0% 404 0% 403
|
118
|
+
POST /api/v1/accounts/{account_id}/conversations/{id}/assignments 77% 200 0% 404 0% 403
|
119
|
+
GET /api/v1/accounts/{account_id}/contacts 0% 200 0% 400
|
120
|
+
POST /api/v1/accounts/{account_id}/contacts 14% 200 0% 400
|
121
|
+
GET /api/v1/accounts/{account_id}/contacts/{id} 14% 200 0% 404 0% 403
|
122
|
+
PUT /api/v1/accounts/{account_id}/contacts/{id} 0% 204 0% 404 0% 403
|
123
|
+
GET /api/v1/accounts/{account_id}/contacts/{id}/conversations 0% 200 0% 404 0% 403
|
124
|
+
GET /api/v1/accounts/{account_id}/contacts/search 0% 200 0% 401
|
125
|
+
POST /api/v1/accounts/{account_id}/contacts/{id}/contact_inboxes 0% 200 0% 401 100% 422
|
126
|
+
GET /api/v1/profile 88% 200 100% 401
|
127
|
+
|
128
|
+
tests_without_prefixes: 42
|
129
|
+
tests_without_actions: 144
|
130
|
+
tests_without_responses: 43
|
131
|
+
```
|
132
|
+
|
133
|
+
And task will create HTML (`fitting/index.html`) reports.
|
134
|
+
|
135
|
+
![exmaple](images/example.png)
|
136
|
+
|
137
|
+
More information on action coverage
|
138
|
+
|
139
|
+
![exmaple2](images/example2.png)
|
140
|
+
|
141
|
+
## prefix name
|
142
|
+
|
143
|
+
Setting the prefix name is optional. For example, you can do this:
|
328
144
|
|
329
145
|
```yaml
|
330
|
-
|
331
|
-
-
|
332
|
-
- %r{/api/v1/comments}
|
146
|
+
prefixes:
|
147
|
+
- openapi2_json_path: doc.json
|
333
148
|
```
|
334
149
|
|
335
|
-
|
336
|
-
|
337
|
-
### `prefixes`
|
338
|
-
|
339
|
-
Example:
|
150
|
+
## prefix skip
|
340
151
|
|
152
|
+
It is not necessary to immediately describe each prefix in detail, you can only specify its name and skip it until you are ready to documented it
|
341
153
|
```yaml
|
342
154
|
prefixes:
|
343
|
-
|
344
|
-
|
155
|
+
- name: /api/v1
|
156
|
+
openapi2_json_path: doc.json
|
157
|
+
- name: /api/v3
|
158
|
+
skip: true
|
345
159
|
```
|
346
160
|
|
347
161
|
## Contributing
|
data/fitting.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ['d.efimov']
|
9
9
|
spec.email = ['d.efimov@fun-box.ru']
|
10
10
|
|
11
|
-
spec.summary = '
|
12
|
-
spec.description = '
|
11
|
+
spec.summary = 'Coverage API Blueprint, Swagger and OpenAPI with RSpec'
|
12
|
+
spec.description = 'Coverage API Blueprint, Swagger and OpenAPI with RSpec for easily make high-quality API and documenatiton'
|
13
13
|
spec.homepage = 'https://github.com/funbox/fitting'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
@@ -20,10 +20,10 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'json-schema', '~> 2.6', '>= 2.6.2'
|
22
22
|
spec.add_runtime_dependency 'multi_json', '~> 1.11'
|
23
|
-
spec.add_runtime_dependency 'tomograph', '~>
|
24
|
-
spec.add_development_dependency 'bundler', '~>
|
23
|
+
spec.add_runtime_dependency 'tomograph', '~> 3.1', '>= 3.1.0'
|
24
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
25
25
|
spec.add_development_dependency 'byebug', '~> 8.2', '>= 8.2.1'
|
26
|
-
spec.add_development_dependency 'rake', '>= 12.3.3'
|
26
|
+
spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
|
27
27
|
spec.add_development_dependency 'rspec', '~> 3.4', '>= 3.4.0'
|
28
28
|
spec.add_development_dependency 'rubocop', '~> 0.49.1', '>= 0.49.1'
|
29
29
|
spec.add_development_dependency 'simplecov', '~> 0.11', '>= 0.11.2'
|
data/images/example.png
ADDED
Binary file
|
data/images/example2.png
ADDED
Binary file
|
data/images/logo.png
ADDED
Binary file
|
@@ -3,11 +3,7 @@ require 'fitting/report/action'
|
|
3
3
|
module Fitting
|
4
4
|
module Report
|
5
5
|
class Actions
|
6
|
-
def initialize(
|
7
|
-
actions = Tomograph::Tomogram.new(
|
8
|
-
prefix: prefix,
|
9
|
-
tomogram_json_path: tomogram_json_path
|
10
|
-
)
|
6
|
+
def initialize(actions)
|
11
7
|
@actions = []
|
12
8
|
actions.to_a.map do |action|
|
13
9
|
@actions.push(Fitting::Report::Action.new(action))
|
@@ -15,7 +15,7 @@ module Fitting
|
|
15
15
|
@tests_without_actions += prefix_details[:actions][:tests_without_actions]
|
16
16
|
res += prefix_details[:actions][:actions_details].inject('') do |res_actions, action|
|
17
17
|
res_actions += "#{action[:method]}\t#{action[:path]}"
|
18
|
-
tab = "\t" * (
|
18
|
+
tab = "\t" * (8 - action[:path].size / 8)
|
19
19
|
@tests_without_responses += action[:responses][:tests_without_responses]
|
20
20
|
res_actions += tab + action[:responses][:responses_details].inject('') do |res_responses, response|
|
21
21
|
@good = false if response[:combinations][:cover_percent] != '100%'
|
@@ -3,13 +3,48 @@ require 'fitting/report/actions'
|
|
3
3
|
module Fitting
|
4
4
|
module Report
|
5
5
|
class Prefix
|
6
|
-
def initialize(name, tomogram_json_path, skip
|
6
|
+
def initialize(name: '', openapi2_json_path: nil, openapi3_yaml_path: nil, drafter_yaml_path: nil, tomogram_json_path: nil, crafter_yaml_path: nil, skip: false)
|
7
7
|
@name = name
|
8
8
|
@tomogram_json_path = tomogram_json_path
|
9
9
|
@tests = Fitting::Report::Tests.new([])
|
10
10
|
@skip = skip
|
11
11
|
unless skip
|
12
|
-
@actions =
|
12
|
+
@actions = if openapi2_json_path
|
13
|
+
Fitting::Report::Actions.new(
|
14
|
+
Tomograph::Tomogram.new(
|
15
|
+
prefix: name,
|
16
|
+
openapi2_json_path: openapi2_json_path
|
17
|
+
)
|
18
|
+
)
|
19
|
+
elsif openapi3_yaml_path
|
20
|
+
Fitting::Report::Actions.new(
|
21
|
+
Tomograph::Tomogram.new(
|
22
|
+
prefix: name,
|
23
|
+
openapi3_yaml_path: openapi3_yaml_path
|
24
|
+
)
|
25
|
+
)
|
26
|
+
elsif drafter_yaml_path
|
27
|
+
Fitting::Report::Actions.new(
|
28
|
+
Tomograph::Tomogram.new(
|
29
|
+
prefix: name,
|
30
|
+
drafter_yaml_path: drafter_yaml_path
|
31
|
+
)
|
32
|
+
)
|
33
|
+
elsif crafter_yaml_path
|
34
|
+
Fitting::Report::Actions.new(
|
35
|
+
Tomograph::Tomogram.new(
|
36
|
+
prefix: name,
|
37
|
+
crafter_yaml_path: crafter_yaml_path
|
38
|
+
)
|
39
|
+
)
|
40
|
+
else
|
41
|
+
Fitting::Report::Actions.new(
|
42
|
+
Tomograph::Tomogram.new(
|
43
|
+
prefix: name,
|
44
|
+
tomogram_json_path: tomogram_json_path
|
45
|
+
)
|
46
|
+
)
|
47
|
+
end
|
13
48
|
end
|
14
49
|
end
|
15
50
|
|
@@ -6,12 +6,24 @@ module Fitting
|
|
6
6
|
def initialize(config_path)
|
7
7
|
@prefixes = []
|
8
8
|
YAML.safe_load(File.read(config_path))['prefixes'].map do |prefix|
|
9
|
-
@prefixes.push(
|
9
|
+
@prefixes.push(
|
10
|
+
Fitting::Report::Prefix.new(
|
11
|
+
name: prefix['name'],
|
12
|
+
openapi2_json_path: prefix['openapi2_json_path'],
|
13
|
+
openapi3_yaml_path: prefix['openapi3_yaml_path'],
|
14
|
+
drafter_yaml_path: prefix['drafter_yaml_path'],
|
15
|
+
tomogram_json_path: prefix['tomogram_json_path'],
|
16
|
+
crafter_yaml_path: prefix['crafter_yaml_path'],
|
17
|
+
skip: prefix['skip']
|
18
|
+
)
|
19
|
+
)
|
10
20
|
end
|
11
21
|
end
|
12
22
|
|
13
23
|
def is_there_a_suitable_prefix?(test_path)
|
14
24
|
@prefixes.map do |prefix|
|
25
|
+
return true if prefix.name.nil?
|
26
|
+
return true if prefix.name == ''
|
15
27
|
return true if test_path[0..prefix.name.size - 1] == prefix.name
|
16
28
|
end
|
17
29
|
|
@@ -20,7 +32,7 @@ module Fitting
|
|
20
32
|
|
21
33
|
def cram_into_the_appropriate_prefix(test)
|
22
34
|
@prefixes.map do |prefix|
|
23
|
-
if test.path[0..prefix.name.size - 1] == prefix.name
|
35
|
+
if prefix.name.nil? || prefix.name == '' || test.path[0..prefix.name.size - 1] == prefix.name
|
24
36
|
prefix.add_test(test)
|
25
37
|
return
|
26
38
|
end
|