2018-10-18 01:10:49 +08:00
|
|
|
# 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' },
|
2023-02-19 22:02:15 +08:00
|
|
|
{ description: 'Swagger compatible API description for specific API', params: {} }
|
2018-10-18 01:10:49 +08:00
|
|
|
]
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|