grape-swagger/spec/swagger_v2/api_swagger_v2_definitions-...

35 lines
683 B
Ruby
Raw Normal View History

2015-12-11 09:35:02 +08:00
require 'spec_helper'
2015-12-18 05:12:00 +08:00
describe 'exposing additional models' do
include_context "the api entities"
2015-12-11 09:35:02 +08:00
before :all do
module TheApi
class ModelApi < Grape::API
format :json
add_swagger_documentation models: [
TheApi::Entities::UseResponse,
TheApi::Entities::ApiError
]
end
end
end
def app
TheApi::ModelApi
end
describe "adds model definitions" do
subject do
get '/swagger_doc'
JSON.parse(last_response.body)
end
specify do
expect(subject).to include 'definitions'
expect(subject['definitions']).to include 'ResponseItem', 'UseResponse', 'ApiError'
end
end
end