Sha256: c1121b8f9732a9996133cb1e2403fcb8d9465b8aa0fb457152cf82b6f31a20ba

Contents?: true

Size: 667 Bytes

Versions: 3

Compression:

Stored size: 667 Bytes

Contents

require 'spec_helper'

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

      params do
        requires :a_hash, type: Hash
      end
      post :splines do
      end

      add_swagger_documentation
    end
  end

  subject do
    get '/swagger_doc/splines'
    expect(last_response.status).to eq 200
    body = JSON.parse last_response.body
    body['apis'].first['operations'].first['parameters']
  end

  it 'declares hash types as object' do
    expect(subject).to eq [
      { 'paramType' => 'form', 'name' => 'a_hash', 'description' => '', 'type' => 'object', 'required' => true, 'allowMultiple' => false }
    ]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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