Sha256: 65299ef0dcdb6907ca3d6eaa5b7cc8dc2f8648e21b4c103ec01680171ef99d90

Contents?: true

Size: 936 Bytes

Versions: 3

Compression:

Stored size: 936 Bytes

Contents

require 'spec_helper'

describe 'Group Params' do
  def app
    Class.new(Grape::API) do
      format :json

      params do
        requires :required_group, type: Hash do
          requires :required_param_1
          requires :required_param_2
        end
      end
      post '/groups' do
        {}
      end

      add_swagger_documentation
    end
  end

  it 'retrieves the documentation for group parameters' do
    get '/swagger_doc/groups'

    body = JSON.parse last_response.body
    parameters = body['apis'].first['operations'].first['parameters']
    expect(parameters).to eq [
      { 'paramType' => 'form', 'name' => 'required_group[required_param_1]', 'description' => '', 'type' => 'string', 'required' => true, 'allowMultiple' => false },
      { 'paramType' => 'form', 'name' => 'required_group[required_param_2]', 'description' => '', 'type' => 'string', 'required' => true, 'allowMultiple' => false }]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grape-swagger-0.11.0 spec/group_params_spec.rb
grape-swagger-0.10.5 spec/group_params_spec.rb
grape-swagger-0.10.4 spec/group_params_spec.rb