Sha256: c4d55e1ba5af0c4f1de15a7299427be1dce5b506fee55849cd81b6b7cc55daec

Contents?: true

Size: 1.58 KB

Versions: 29

Compression:

Stored size: 1.58 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe 'hide documentation path' do
  include_context "#{MODEL_PARSER} swagger example"

  before :all do
    module TheApi
      class HideDocumentationApi < Grape::API
        format :json

        desc 'This returns something',
             params: Entities::UseResponse.documentation,
             failure: [{ code: 400, message: 'NotFound', model: Entities::ApiError }]
        params do
          requires :foo, type: Integer
        end
        get '/params_response' do
          { 'declared_params' => declared(params) }
        end

        desc 'This returns something',
             entity: Entities::UseResponse,
             failure: [{ code: 400, message: 'NotFound', model: Entities::ApiError }]
        get '/entity_response' do
          { 'declared_params' => declared(params) }
        end

        desc 'This returns something',
             failure: [{ code: 400, message: 'NotFound', model: Entities::ApiError }]
        get '/present_response' do
          foo = OpenStruct.new id: 1, name: 'bar'
          something = OpenStruct.new description: 'something', item: foo
          present :somethings, something, with: Entities::UseResponse
        end

        add_swagger_documentation hide_documentation_path: false
      end
    end
  end

  def app
    TheApi::HideDocumentationApi
  end

  describe 'shows documentation paths' do
    subject do
      get '/swagger_doc'
      JSON.parse(last_response.body)
    end

    specify do
      expect(subject['paths'].keys).to include '/swagger_doc', '/swagger_doc/{name}'
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
grape-swagger-1.6.1 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-1.6.0 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
gitlab-grape-swagger-1.5.0 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-1.5.0 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-1.4.2 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-1.4.1 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-1.4.0 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-1.3.1 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-1.3.0 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-1.2.1 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-1.2.0 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-1.1.0 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-1.0.0 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-0.34.2 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-0.34.1 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-0.34.0 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-0.33.0 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-0.32.1 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-0.32.0 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb
grape-swagger-0.31.1 spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb