-
Notifications
You must be signed in to change notification settings - Fork 476
/
Copy pathapi_documentation_spec.rb
42 lines (38 loc) · 1.01 KB
/
api_documentation_spec.rb
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
# frozen_string_literal: true
require 'spec_helper'
describe 'API with additional options' do
let(:api) do
Class.new(Grape::API) do
add_swagger_documentation \
api_documentation: { desc: 'Swagger compatible API description' },
specific_api_documentation: { desc: 'Swagger compatible API description for specific API' }
end
end
subject do
api.routes.map do |route|
route.settings[:description]
end
end
it 'documents api' do
expect(subject).to eq(
[
{ description: 'Swagger compatible API description' },
{
description: 'Swagger compatible API description for specific API',
params: {
'locale' => {
desc: 'Locale of API documentation',
required: false,
type: Symbol
},
'name' => {
desc: 'Resource name of mounted API',
required: true,
type: String
}
}
}
]
)
end
end