Sha256: dd3ddd87007ebfacbb969541507235870d18be92ae98e638f35b2e8b62895dec

Contents?: true

Size: 1013 Bytes

Versions: 6

Compression:

Stored size: 1013 Bytes

Contents

require 'spec_helper'

describe 'details' do
  describe 'details, pass markdown with redcarpet even with nil description and detail', unless: RUBY_PLATFORM.eql?('java') do
    before :all do
      module TheApi
        class GfmRcDetailApi < Grape::API
          format :json

          desc nil,
               detail: nil,
               entity: Entities::UseResponse,
               failure: [{ code: 400, model: Entities::ApiError }]
          get '/use_gfm_rc_detail' do
            { 'declared_params' => declared(params) }
          end

          add_swagger_documentation markdown: GrapeSwagger::Markdown::RedcarpetAdapter.new
        end
      end
    end

    def app
      TheApi::GfmRcDetailApi
    end

    subject do
      get '/swagger_doc'
      JSON.parse(last_response.body)
    end

    specify do
      expect(subject['paths']['/use_gfm_rc_detail']['get']).not_to include('description')
      expect(subject['paths']['/use_gfm_rc_detail']['get']['description']).to eql(nil)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
grape-swagger-0.26.0 spec/swagger_v2/description_not_initialized.rb
grape-swagger-0.25.3 spec/swagger_v2/description_not_initialized.rb
grape-swagger-0.25.2 spec/swagger_v2/description_not_initialized.rb
grape-swagger-0.25.1 spec/swagger_v2/description_not_initialized.rb
grape-swagger-0.25.0 spec/swagger_v2/description_not_initialized.rb
grape-swagger-0.24.0 spec/swagger_v2/description_not_initialized.rb