Sha256: 6d13bfd1079723edd0b5258b6ded305c876bc6595f9b10a07b0ece2f418fbe1f

Contents?: true

Size: 683 Bytes

Versions: 3

Compression:

Stored size: 683 Bytes

Contents

require 'spec_helper'

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

      params do
        requires :a_float, type: Float
      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 'converts float types' do
    expect(subject).to eq [
      { 'paramType' => 'form', 'name' => 'a_float', 'description' => '', 'type' => 'number', 'format' => 'float', 'required' => true, 'allowMultiple' => false }
    ]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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