Sha256: 7188136bac77cec092b823426e1392ae721f968e6e515c31db70934bf8142481

Contents?: true

Size: 734 Bytes

Versions: 3

Compression:

Stored size: 734 Bytes

Contents

require 'spec_helper'

describe 'Grape::Endpoint#path_and_definitions' do
  let(:api) do
    item = Class.new(Grape::API) do
      version 'v1', using: :path

      resource :item do
        get '/'
      end
    end

    Class.new(Grape::API) do
      mount item
      add_swagger_documentation add_version: true
    end
  end

  let(:options) { { add_version: true } }
  let(:target_routes) { api.combined_namespace_routes }

  subject { api.endpoints[0].path_and_definition_objects(target_routes, options) }

  it 'is returning a versioned path' do
    expect(subject[0].keys[0]).to eq '/v1/item'
  end

  it 'tags the endpoint with the resource name' do
    expect(subject.first['/v1/item'][:get][:tags]).to eq ['item']
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grape-swagger-0.24.0 spec/swagger_v2/endpoint_versioned_path_spec.rb
grape-swagger-0.23.0 spec/swagger_v2/endpoint_versioned_path_spec.rb
grape-swagger-0.22.0 spec/swagger_v2/endpoint_versioned_path_spec.rb