Skip to content

Commit a4acfcc

Browse files
committed
1 parent f493536 commit a4acfcc

File tree

4 files changed

+89
-89
lines changed

4 files changed

+89
-89
lines changed

features/api_blueprint_documentation.feature

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -262,18 +262,18 @@ Feature: Generate API Blueprint documentation from test examples
262262
263263
+ Headers
264264
265-
Host: example.org
265+
Host: example.org
266266
267267
+ Response 200 (text/html;charset=utf-8)
268268
269269
+ Headers
270270
271-
Content-Type: text/html;charset=utf-8
272-
Content-Length: 57
271+
Content-Type: text/html;charset=utf-8
272+
Content-Length: 57
273273
274274
+ Body
275275
276-
{"data":{"id":"1","type":"instructions","attributes":{}}}
276+
{"data":{"id":"1","type":"instructions","attributes":{}}}
277277
278278
# Group Orders
279279
@@ -287,71 +287,71 @@ Feature: Generate API Blueprint documentation from test examples
287287
288288
+ Headers
289289
290-
Content-Type: application/json
291-
Host: example.org
290+
Content-Type: application/json
291+
Host: example.org
292292
293293
+ Body
294294
295-
{
296-
"data": {
297-
"type": "order",
298-
"attributes": {
299-
"name": "Order 1",
300-
"amount": 100.0,
301-
"description": "A description"
295+
{
296+
"data": {
297+
"type": "order",
298+
"attributes": {
299+
"name": "Order 1",
300+
"amount": 100.0,
301+
"description": "A description"
302+
}
303+
}
302304
}
303-
}
304-
}
305305
306306
+ Response 201 (application/json)
307307
308308
+ Headers
309309
310-
Content-Type: application/json
311-
Content-Length: 73
310+
Content-Type: application/json
311+
Content-Length: 73
312312
313313
+ Body
314314
315-
{
316-
"order": {
317-
"name": "Order 1",
318-
"amount": 100.0,
319-
"description": "A great order"
320-
}
321-
}
315+
{
316+
"order": {
317+
"name": "Order 1",
318+
"amount": 100.0,
319+
"description": "A great order"
320+
}
321+
}
322322
323323
### Return all orders [GET]
324324
325325
+ Request Getting a list of orders
326326
327327
+ Headers
328328
329-
Host: example.org
329+
Host: example.org
330330
331331
+ Response 200 (application/vnd.api+json)
332332
333333
+ Headers
334334
335-
Content-Type: application/vnd.api+json
336-
Content-Length: 137
335+
Content-Type: application/vnd.api+json
336+
Content-Length: 137
337337
338338
+ Body
339339
340-
{
341-
"page": 1,
342-
"orders": [
343-
{
344-
"name": "Order 1",
345-
"amount": 9.99,
346-
"description": null
347-
},
348340
{
349-
"name": "Order 2",
350-
"amount": 100.0,
351-
"description": "A great order"
341+
"page": 1,
342+
"orders": [
343+
{
344+
"name": "Order 1",
345+
"amount": 9.99,
346+
"description": null
347+
},
348+
{
349+
"name": "Order 2",
350+
"amount": 100.0,
351+
"description": "A great order"
352+
}
353+
]
352354
}
353-
]
354-
}
355355
356356
## Single Order [/orders/:id{?optional=:optional}]
357357
@@ -370,96 +370,96 @@ Feature: Generate API Blueprint documentation from test examples
370370
371371
+ Headers
372372
373-
Host: example.org
374-
Content-Type: application/x-www-form-urlencoded
373+
Host: example.org
374+
Content-Type: application/x-www-form-urlencoded
375375
376376
+ Response 200 (text/html;charset=utf-8)
377377
378378
+ Headers
379379
380-
Content-Type: text/html;charset=utf-8
381-
Content-Length: 0
380+
Content-Type: text/html;charset=utf-8
381+
Content-Length: 0
382382
383383
### Returns a single order [GET]
384384
385385
+ Request Getting a specific order
386386
387387
+ Headers
388388
389-
Host: example.org
389+
Host: example.org
390390
391391
+ Response 200 (application/json)
392392
393393
+ Headers
394394
395-
Content-Type: application/json
396-
Content-Length: 73
395+
Content-Type: application/json
396+
Content-Length: 73
397397
398398
+ Body
399399
400-
{
401-
"order": {
402-
"name": "Order 1",
403-
"amount": 100.0,
404-
"description": "A great order"
405-
}
406-
}
400+
{
401+
"order": {
402+
"name": "Order 1",
403+
"amount": 100.0,
404+
"description": "A great order"
405+
}
406+
}
407407
408408
### Updates a single order [PUT]
409409
410410
+ Request Invalid request (application/json; charset=utf-16)
411411
412412
+ Headers
413413
414-
Content-Type: application/json; charset=utf-16
415-
Host: example.org
414+
Content-Type: application/json; charset=utf-16
415+
Host: example.org
416416
417417
+ Response 400 (application/json)
418418
419419
+ Headers
420420
421-
Content-Type: application/json
422-
Content-Length: 0
421+
Content-Type: application/json
422+
Content-Length: 0
423423
424424
+ Request Update an order (application/json; charset=utf-16)
425425
426426
+ Headers
427427
428-
Content-Type: application/json; charset=utf-16
429-
Host: example.org
428+
Content-Type: application/json; charset=utf-16
429+
Host: example.org
430430
431431
+ Body
432432
433-
{
434-
"data": {
435-
"id": "1",
436-
"type": "order",
437-
"attributes": {
438-
"name": "Order 1"
433+
{
434+
"data": {
435+
"id": "1",
436+
"type": "order",
437+
"attributes": {
438+
"name": "Order 1"
439+
}
440+
}
439441
}
440-
}
441-
}
442442
443443
+ Response 200 (application/json)
444444
445445
+ Headers
446446
447-
Content-Type: application/json
448-
Content-Length: 111
447+
Content-Type: application/json
448+
Content-Length: 111
449449
450450
+ Body
451451
452-
{
453-
"data": {
454-
"id": "1",
455-
"type": "order",
456-
"attributes": {
457-
"name": "Order 1",
458-
"amount": 100.0,
459-
"description": "A description"
452+
{
453+
"data": {
454+
"id": "1",
455+
"type": "order",
456+
"attributes": {
457+
"name": "Order 1",
458+
"amount": 100.0,
459+
"description": "A description"
460+
}
461+
}
460462
}
461-
}
462-
}
463463
"""
464464

465465
Scenario: Example 'Deleting an order' file should not be created

lib/rspec_api_documentation/views/api_blueprint_example.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module RspecApiDocumentation
22
module Views
33
class ApiBlueprintExample < MarkupExample
4-
TOTAL_SPACES_INDENTATION = 8.freeze
4+
TOTAL_SPACES_INDENTATION = 12.freeze
55

66
def initialize(example, configuration)
77
super

spec/views/api_blueprint_example_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@
5959

6060
context 'when charset=utf-8 is present' do
6161
it "just strips that because it's the default for json" do
62-
expect(subject).to eq "Content-Type: application/json\n Another: header; charset=utf-8"
62+
expect(subject).to eq "Content-Type: application/json\n Another: header; charset=utf-8"
6363
end
6464
end
6565

6666
context 'when charset=utf-16 is present' do
6767
let(:content_type) { "application/json; charset=utf-16" }
6868

6969
it "keeps that because it's NOT the default for json" do
70-
expect(subject).to eq "Content-Type: application/json; charset=utf-16\n Another: header; charset=utf-8"
70+
expect(subject).to eq "Content-Type: application/json; charset=utf-16\n Another: header; charset=utf-8"
7171
end
7272
end
7373
end
@@ -95,15 +95,15 @@
9595

9696
context 'when charset=utf-8 is present' do
9797
it "just strips that because it's the default for json" do
98-
expect(subject).to eq "Content-Type: application/json\n Another: header; charset=utf-8"
98+
expect(subject).to eq "Content-Type: application/json\n Another: header; charset=utf-8"
9999
end
100100
end
101101

102102
context 'when charset=utf-16 is present' do
103103
let(:content_type) { "application/json; charset=utf-16" }
104104

105105
it "keeps that because it's NOT the default for json" do
106-
expect(subject).to eq "Content-Type: application/json; charset=utf-16\n Another: header; charset=utf-8"
106+
expect(subject).to eq "Content-Type: application/json; charset=utf-16\n Another: header; charset=utf-8"
107107
end
108108
end
109109
end

templates/rspec_api_documentation/api_blueprint_index.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ explanation: {{ explanation }}
4848

4949
+ Headers
5050

51-
{{{ request_headers_text }}}
51+
{{{ request_headers_text }}}
5252
{{/ request_headers_text }}
5353
{{# request_body }}
5454

5555
+ Body
5656

57-
{{{ request_body }}}
57+
{{{ request_body }}}
5858
{{/ request_body }}
5959
{{# has_response? }}
6060

@@ -64,13 +64,13 @@ explanation: {{ explanation }}
6464

6565
+ Headers
6666

67-
{{{ response_headers_text }}}
67+
{{{ response_headers_text }}}
6868
{{/ response_headers_text }}
6969
{{# response_body }}
7070

7171
+ Body
7272

73-
{{{ response_body }}}
73+
{{{ response_body }}}
7474
{{/ response_body }}
7575
{{/ requests }}
7676
{{/ examples }}

0 commit comments

Comments
 (0)