Sha256: c9ca4e3db5c2bd7e1e64698c73d35f5c022309869f8846439831d5a6ba0a3035

Contents?: true

Size: 913 Bytes

Versions: 11

Compression:

Stored size: 913 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe '#427 nested entity given as string' do
  let(:app) do
    Class.new(Grape::API) do
      namespace :issue_427 do
        module Permission
          class WithoutRole < Grape::Entity
            expose :id
            expose :description
          end
        end

        class RoleEntity < Grape::Entity
          expose :id
          expose :description
          expose :role
          expose :permissions, using: 'Permission::WithoutRole'
        end
        desc 'Get a list of roles',
             success: RoleEntity
        get '/' do
          present [], with: RoleEntity
        end
      end

      add_swagger_documentation format: :json
    end
  end

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

  specify { expect(subject.keys).to include 'RoleEntity', 'Permission_WithoutRole' }
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
grape-swagger-1.6.1 spec/issues/427_entity_as_string_spec.rb
grape-swagger-1.6.0 spec/issues/427_entity_as_string_spec.rb
gitlab-grape-swagger-1.5.0 spec/issues/427_entity_as_string_spec.rb
grape-swagger-1.5.0 spec/issues/427_entity_as_string_spec.rb
grape-swagger-1.4.2 spec/issues/427_entity_as_string_spec.rb
grape-swagger-1.4.1 spec/issues/427_entity_as_string_spec.rb
grape-swagger-1.4.0 spec/issues/427_entity_as_string_spec.rb
grape-swagger-1.3.1 spec/issues/427_entity_as_string_spec.rb
grape-swagger-1.3.0 spec/issues/427_entity_as_string_spec.rb
grape-swagger-1.2.1 spec/issues/427_entity_as_string_spec.rb
grape-swagger-1.2.0 spec/issues/427_entity_as_string_spec.rb